common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
2686
|
Train/png/2686.png
|
def marvcli_restore(file):
data = json.load(file)
site = create_app().site
site.restore_database(**data)
|
5913
|
Train/png/5913.png
|
def set_word_at_offset(self, offset, word):
return self.set_bytes_at_offset(offset, self.get_data_from_word(word))
|
8528
|
Train/png/8528.png
|
def import_block(block: BaseBlock, chain: BaseChain) -> BaseChain:
chain.import_block(block)
return chain
|
9821
|
Train/png/9821.png
|
def replace(s, replace):
for r in replace:
s = s.replace(*r)
return s
|
3459
|
Train/png/3459.png
|
def is_absolute(self):
return self.namespace and self.ext and self.scheme and self.path
|
1426
|
Train/png/1426.png
|
def writable(self):
return bool(lib.EnvSlotWritableP(self._env, self._cls, self._name))
|
4334
|
Train/png/4334.png
|
def set_remove(parent, idx, value):
lst = get_child(parent, idx)
if value in lst:
lst.remove(value)
|
8561
|
Train/png/8561.png
|
def raw(self):
if self._raw is None:
self._raw = HttpStream(self)
return self._raw
|
1201
|
Train/png/1201.png
|
def type_suffix(self):
if not self.type or self.type.lower() == 'ga':
return ''
return '-%s' % self.type.lower()
|
7884
|
Train/png/7884.png
|
def _badpath(path, base):
return not _resolved(os.path.join(base, path)).startswith(base)
|
4279
|
Train/png/4279.png
|
def _create_mappings(self):
'Create the field type mapping.'
created1 = self._create_tag_mapping()
created2 = self._create_assoc_mapping()
return created1 or created2
|
9018
|
Train/png/9018.png
|
def safe_dump(data, stream=None, **kwds):
return yaml.dump(data, stream=stream, Dumper=ODYD, **kwds)
|
8082
|
Train/png/8082.png
|
def dump(self, filename):
f = open(filename, "wb")
pickle.dump(self.__dict__, f, 2)
f.close()
|
2485
|
Train/png/2485.png
|
def pid(self, value):
self.bytearray[self._get_slicers(0)] = bytearray(c_int32(value or 0))
|
3013
|
Train/png/3013.png
|
def update_done(self, *args, **kwargs):
kwargs['state'] = 'done'
self.update(*args, **kwargs)
self.rec = None
|
5927
|
Train/png/5927.png
|
def roty(t):
c = np.cos(t)
s = np.sin(t)
return np.array([[c, 0, s],
[0, 1, 0],
[-s, 0, c]])
|
3804
|
Train/png/3804.png
|
def csvpretty(csvfile: csvfile = sys.stdin):
shellish.tabulate(csv.reader(csvfile))
|
2862
|
Train/png/2862.png
|
def delete(self, key):
"Delete a `key` from the keystore."
if key in self.data:
self.delete_from_index(key)
del self.data[key]
|
2337
|
Train/png/2337.png
|
def stop_class(self, class_):
"Stop all services of a given class"
matches = filter(lambda svc: isinstance(svc, class_), self)
map(self.stop, matches)
|
3074
|
Train/png/3074.png
|
def random_hex(length):
return escape.to_unicode(binascii.hexlify(os.urandom(length))[length:])
|
5853
|
Train/png/5853.png
|
def bitop_or(self, dest, key, *keys):
return self.execute(b'BITOP', b'OR', dest, key, *keys)
|
5639
|
Train/png/5639.png
|
def remove_handler(self, handler):
while handler in self.handlers:
self.handlers.remove(handler)
|
1499
|
Train/png/1499.png
|
def limit(self, limit):
query = self._copy()
query._limit = limit
return query
|
8159
|
Train/png/8159.png
|
def close(self):
if self._writer is not None:
self.flush()
self._writer.close()
self._writer = None
|
5160
|
Train/png/5160.png
|
def request_time(self, req):
r = time.time()
self._time_result.set_value(r)
return ("ok", r)
|
7965
|
Train/png/7965.png
|
def channels_history(self, room_id, **kwargs):
return self.__call_api_get('channels.history', roomId=room_id, kwargs=kwargs)
|
120
|
Train/png/120.png
|
def __getStationName(name, id):
name = name.replace("Meetstation", "")
name = name.strip()
name += " (%s)" % id
return name
|
5621
|
Train/png/5621.png
|
def register_bse_task(self, *args, **kwargs):
kwargs["task_class"] = BseTask
return self.register_task(*args, **kwargs)
|
3597
|
Train/png/3597.png
|
def arg_bool(name, default=False):
v = request.args.get(name, '')
if not len(v):
return default
return v in BOOL_TRUISH
|
5654
|
Train/png/5654.png
|
def fix_e301(self, result):
cr = '\n'
self.source[result['line'] - 1] = cr + self.source[result['line'] - 1]
|
7801
|
Train/png/7801.png
|
def read_tred_tsv(tsvfile):
df = pd.read_csv(tsvfile, sep="\t", index_col=0, dtype={"SampleKey": str})
return df
|
2889
|
Train/png/2889.png
|
def _c0(self):
"the logarithm of normalizing constant in pdf"
h_df = self.df / 2
p, S = self._p, self.S
return h_df * (logdet(S) + p * logtwo) + lpgamma(p, h_df)
|
1873
|
Train/png/1873.png
|
def naturalsortkey(s):
return [int(part) if part.isdigit() else part
for part in re.split('([0-9]+)', s)]
|
1750
|
Train/png/1750.png
|
def generate_direct_deps(self, target: Target):
yield from (self.targets[dep_name] for dep_name in sorted(target.deps))
|
2128
|
Train/png/2128.png
|
def as_table(self, name=None):
if name is None:
name = self._id
return alias(self.subquery(), name=name)
|
7307
|
Train/png/7307.png
|
def get(args):
from . import config
for key in args.key.split("."):
config = getattr(config, key)
print(json.dumps(config))
|
3218
|
Train/png/3218.png
|
def preview(self, when=timezone.now(), **kwargs):
return self.operate_on(when=when, apply=False, **kwargs)
|
7831
|
Train/png/7831.png
|
def diff_bearing(b1, b2):
d = abs(b2 - b1)
d = 360 - d if d > 180 else d
return d
|
872
|
Train/png/872.png
|
def stop(self):
if self._disconnector:
self._disconnector.stop()
self.client.disconnect()
|
6964
|
Train/png/6964.png
|
def add_relations(self, relations):
for source, destination in relations:
self.add_relation(source, destination)
|
5882
|
Train/png/5882.png
|
def sdiffstore(self, destkey, key, *keys):
return self.execute(b'SDIFFSTORE', destkey, key, *keys)
|
9046
|
Train/png/9046.png
|
def content(self):
return _bfd.section_get_content(self.bfd, self._ptr, 0, self.size)
|
7662
|
Train/png/7662.png
|
def output_callback(self, out, process_status):
self.final_status.append(process_status)
self.final_output.append(out)
|
8340
|
Train/png/8340.png
|
def remove_outliers(series, stddev):
return series[(series - series.mean()).abs() < stddev * series.std()]
|
6944
|
Train/png/6944.png
|
def by_user_name(cls, username):
return DBSession.query(cls).filter_by(user_name=username).first()
|
7747
|
Train/png/7747.png
|
def selecttrue(table, field, complement=False):
return select(table, field, lambda v: bool(v), complement=complement)
|
9286
|
Train/png/9286.png
|
def add(cls, zone_id, version_id, record):
return cls.call('domain.zone.record.add', zone_id, version_id, record)
|
1385
|
Train/png/1385.png
|
def Load(file):
with open(file, 'rb') as file:
model = dill.load(file)
return model
|
8024
|
Train/png/8024.png
|
def load_yaml(file):
if hasattr(yaml, "full_load"):
return yaml.full_load(file)
else:
return yaml.load(file)
|
7260
|
Train/png/7260.png
|
def create_frame(self):
frame = Gtk.Frame()
frame.set_shadow_type(Gtk.ShadowType.IN)
return frame
|
2150
|
Train/png/2150.png
|
def write_text(filename: str, text: str) -> None:
with open(filename, 'w') as f: # type: TextIO
print(text, file=f)
|
9509
|
Train/png/9509.png
|
def metric_from_cell(cell):
cell = np.asarray(cell, dtype=float)
return np.dot(cell, cell.T)
|
2983
|
Train/png/2983.png
|
def error_state(self):
self.buildstate.state.lasttime = time()
self.buildstate.commit()
return self.buildstate.state.error
|
9654
|
Train/png/9654.png
|
def cswap(self, ctl, tgt1, tgt2):
return self.append(FredkinGate(), [ctl, tgt1, tgt2], [])
|
1862
|
Train/png/1862.png
|
def close_panel(self):
self.hide()
self.lineEditReplace.clear()
self.lineEditSearch.clear()
|
7154
|
Train/png/7154.png
|
def start(self):
self.thread = threading.Thread(target=self._animate)
self.thread.start()
return
|
8641
|
Train/png/8641.png
|
def send_text(self, text):
return self.client.api.send_message(self.room_id, text)
|
104
|
Train/png/104.png
|
def fetch_trades_since(self, since: int) -> List[Trade]:
return self._fetch_since('trades', self.market.code)(self._trades_since)(since)
|
2167
|
Train/png/2167.png
|
def debug_query(self, sql: str, *args) -> None:
rows = self.fetchall(sql, *args)
debug_query_result(rows)
|
2821
|
Train/png/2821.png
|
def token_revoke(token):
db.session.delete(token)
db.session.commit()
return redirect(url_for('.index'))
|
7754
|
Train/png/7754.png
|
def room(request, slug, template="room.html"):
context = {"room": get_object_or_404(ChatRoom, slug=slug)}
return render(request, template, context)
|
4888
|
Train/png/4888.png
|
def deactivate_(self):
self.preDeactivate_()
self.active = False
self.image_dimensions = None
self.client = None
|
6907
|
Train/png/6907.png
|
def delete(self):
r = self._client.request('DELETE', self.url)
logger.info("delete(): %s", r.status_code)
|
9591
|
Train/png/9591.png
|
def run(self, hql, parameters=None):
return super().run(self._strip_sql(hql), parameters)
|
7248
|
Train/png/7248.png
|
def update(d, e):
res = copy.copy(d)
res.update(e)
return res
|
726
|
Train/png/726.png
|
def set_year(self, year):
self._set_attr(TDRC(encoding=3, text=str(year)))
|
9575
|
Train/png/9575.png
|
def write_spo(sub, prd, obj):
rcvtriples.append(make_spo(sub, prd, obj))
|
7806
|
Train/png/7806.png
|
def make_sequence(seq, name="S"):
return ["{}_{}_{}".format(name, i, x) for i, x in enumerate(seq)]
|
4239
|
Train/png/4239.png
|
def numberp(v):
return (not (isinstance(v, bool)) and
(isinstance(v, int) or isinstance(v, float)))
|
5554
|
Train/png/5554.png
|
def exception(self, *args, **kwargs):
kwargs['api'] = self.api
return exception(*args, **kwargs)
|
6378
|
Train/png/6378.png
|
def to_df(self) -> None:
"Create `pd.DataFrame` containing `items` from `self.x` and `self.y`."
return pd.DataFrame(dict(x=self.x._relative_item_paths(), y=[str(o) for o in self.y]))
|
1642
|
Train/png/1642.png
|
def _make_item(model):
item = Item(model.id, model.content, model.media_type)
return item
|
5121
|
Train/png/5121.png
|
def num_signups(self):
return EighthSignup.objects.filter(scheduled_activity__block=self, user__in=User.objects.get_students()).count()
|
8657
|
Train/png/8657.png
|
def mach2cas(Mach, H):
Vtas = mach2tas(Mach, H)
Vcas = tas2cas(Vtas, H)
return Vcas
|
1538
|
Train/png/1538.png
|
def write_message(self, data, binary=False):
self.client.write_message(data, binary=binary)
|
8960
|
Train/png/8960.png
|
def genslices_ndim(ndim, shape):
iterables = [genslices(shape[n]) for n in range(ndim)]
yield from product(*iterables)
|
4213
|
Train/png/4213.png
|
def update_bgp_speaker(self, bgp_speaker_id, body=None):
return self.put(self.bgp_speaker_path % bgp_speaker_id, body=body)
|
7103
|
Train/png/7103.png
|
def solve(self, angles0, target):
return self.optimizer.optimize(np.array(angles0), target)
|
7146
|
Train/png/7146.png
|
def restart_user(self, subid):
p = self.revoke_token(subid)
p = self.refresh_token(subid)
return p
|
8253
|
Train/png/8253.png
|
def volume(self, volume):
# max 100
volume = int(volume)
self._volume = max(0, min(volume, 100))
|
1978
|
Train/png/1978.png
|
def full(self):
if not self.size:
return False
return len(self.pq) == (self.size + self.removed_count)
|
7155
|
Train/png/7155.png
|
def hilbert(ts):
output = signal.hilbert(signal.detrend(ts, axis=0), axis=0)
return Timeseries(output, ts.tspan, labels=ts.labels)
|
4795
|
Train/png/4795.png
|
def topic(self, channel, topic=None):
if topic:
channel += ' :' + topic
self.send_line('TOPIC %s' % channel)
|
9474
|
Train/png/9474.png
|
def set(self, key, value):
if config.CACHE_POTENTIAL_PURVIEWS:
self.cache[key] = value
|
5600
|
Train/png/5600.png
|
def export_envar(self, key, val):
line = "export " + key + "=" + str(val)
self._add(line)
|
1530
|
Train/png/1530.png
|
def commit_fw_db(self):
fw_dict = self.get_fw_dict()
self.update_fw_db(fw_dict.get('fw_id'), fw_dict)
|
609
|
Train/png/609.png
|
def unlock(self, password, width=1080, length=1920) -> None:
self.wake()
self.swipe_up(width, length)
self.send_keys(str(password))
|
1659
|
Train/png/1659.png
|
def get_value(cls, bucket, key):
obj = cls.get(bucket, key)
return obj.value if obj else None
|
621
|
Train/png/621.png
|
def _setup_db(cls):
uri = cls._app.config.get("DB_URL")
if uri:
db.connect__(uri, cls._app)
|
5797
|
Train/png/5797.png
|
def _on_enter(self, *args):
self.config(foreground=self._hover_color, cursor=self._cursor)
|
6572
|
Train/png/6572.png
|
def _read_info(info_path):
if not tf.io.gfile.exists(info_path):
return None
with tf.io.gfile.GFile(info_path) as info_f:
return json.load(info_f)
|
9052
|
Train/png/9052.png
|
def _handleEnd(self):
self.cursorPos = len(self.inputBuffer)
self._refreshInputPrompt(len(self.inputBuffer))
|
9615
|
Train/png/9615.png
|
def expand_path(path: Union[str, Path]) -> Path:
return Path(path).expanduser().resolve()
|
5615
|
Train/png/5615.png
|
def register_ddk_task(self, *args, **kwargs):
kwargs["task_class"] = DdkTask
return self.register_task(*args, **kwargs)
|
8210
|
Train/png/8210.png
|
def load(cls, path, base=None):
obj = cls()
obj.read(path, base)
return obj
|
6695
|
Train/png/6695.png
|
def get_row_sep(self):
if self.eol_btn.isChecked():
return u"\n"
return to_text_string(self.line_edt_row.text())
|
3836
|
Train/png/3836.png
|
def pause(msg="Press Enter to Continue..."):
print('\n' + Fore.YELLOW + msg + Fore.RESET, end='')
input()
|
3354
|
Train/png/3354.png
|
def get_codomain(self, key):
return [v for k, v in self.all if k == key]
|
3583
|
Train/png/3583.png
|
def statement(self):
return (self.assignment ^ self.expression) + Suppress(
self.syntax.terminator)
|
2905
|
Train/png/2905.png
|
def ifelse(self, node):
'ifelse = "if" expr "then" expr "else" expr'
_, cond, _, cons, _, alt = node
return self.eval(cons) if self.eval(cond) else self.eval(alt)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.