common_id
stringlengths
1
5
image
stringlengths
15
19
code
stringlengths
26
239
6985
Train/png/6985.png
def keys(self) -> Iterator[str]: if self.param: yield self.param_name yield from self.paths.keys()
9636
Train/png/9636.png
def __coord_time(n, sr=22050, hop_length=512, **_kwargs): return core.frames_to_time(np.arange(n+1), sr=sr, hop_length=hop_length)
7553
Train/png/7553.png
def download(cls, url, filename=None): return utility.download(url, cls.directory(), filename)
5201
Train/png/5201.png
def pb_config(self): pb = ProcessingBlock(self._pb_id) return json.dumps(pb.config)
1512
Train/png/1512.png
def _rndPointDisposition(dx, dy): x = int(random.uniform(-dx, dx)) y = int(random.uniform(-dy, dy)) return (x, y)
6927
Train/png/6927.png
def get(s, delimiter='', format="diacritical"): return delimiter.join(_pinyin_generator(u(s), format=format))
9771
Train/png/9771.png
def t_number(self, s): r'\d+' pos = self.pos self.add_token('NUMBER', int(s)) self.pos = pos + len(s)
1607
Train/png/1607.png
def connect(self): await self.node.join_voice_channel(self.channel.guild.id, self.channel.id)
7713
Train/png/7713.png
def gen_ldm(src, dst): return ReilBuilder.build(ReilMnemonic.LDM, src, ReilEmptyOperand(), dst)
5392
Train/png/5392.png
def select_larva(self): action = sc_pb.Action() action.action_ui.select_larva.SetInParent() # Adds the empty proto field. return action
1807
Train/png/1807.png
def to_representation(self, value): value = apply_subfield_projection(self, value, deep=True) return super().to_representation(value)
1829
Train/png/1829.png
def update_brand(self) -> None: self.update(path=URL_GET + GROUP.format(group=BRAND))
5842
Train/png/5842.png
def rpop(self, key, *, encoding=_NOTSET): return self.execute(b'RPOP', key, encoding=encoding)
7990
Train/png/7990.png
def logout(self): resp = super(CookieSession, self).request('DELETE', self._session_url) resp.raise_for_status()
2470
Train/png/2470.png
def init_defaults(self): super(SimpleTable, self).init_defaults() self.name = self.table
855
Train/png/855.png
def flip_coords(X, loop): if (loop[0] == 1): return np.array(map(lambda i: np.array([i[2], i[1], i[0], i[5], i[4], i[3]]), X)) else: return X
8099
Train/png/8099.png
def eval_grad(self): # Compute D^T(D Y - S) return self.D.T.dot(self.D.dot(self.Y) - self.S)
1068
Train/png/1068.png
def show_report(self): self.action_show_report.setEnabled(False) self.action_show_log.setEnabled(True) self.load_html_file(self.report_path)
9260
Train/png/9260.png
def get_description(self): vo = ffi.cast('VipsObject *', self.pointer) return _to_string(vips_lib.vips_object_get_description(vo))
1990
Train/png/1990.png
def setup(self): self.allow = self.config['allow'] self.halt = self.config['halt'] self.skip = self.config['skip']
38
Train/png/38.png
def _parse_rdf(self, file): store = Graph() store.parse(file) print(len(store))
2511
Train/png/2511.png
def file_remove(self, path, filename): if os.path.isfile(path + filename): os.remove(path + filename)
1428
Train/png/1428.png
def name(self): return ffi.string(lib.EnvGetInstanceName(self._env, self._ist)).decode()
470
Train/png/470.png
def send_email(self, user, subject, msg): print('To:', user) print('Subject:', subject) print(msg)
1903
Train/png/1903.png
def init_app(self, app=None): config = getattr(app, 'config', app) self.team_id = config.get('TEAM_ID')
179
Train/png/179.png
def make_readable_path(path): home = os.path.expanduser("~") if path.startswith(home): path = "~" + path[len(home):] return path
6414
Train/png/6414.png
def apply_init(m, init_func: LayerFunc): "Initialize all non-batchnorm layers of `m` with `init_func`." apply_leaf(m, partial(cond_init, init_func=init_func))
6453
Train/png/6453.png
def CrossEntropyFlat(*args, axis: int = -1, **kwargs): "Same as `nn.CrossEntropyLoss`, but flattens input and target." return FlattenedLoss(nn.CrossEntropyLoss, *args, axis=axis, **kwargs)
1246
Train/png/1246.png
def all_node_style(self, **kwargs): for node in self.nodes: self.node_style(node, **kwargs)
2359
Train/png/2359.png
def set(self, key, value, extend=False, **kwargs): self.__setitem__(key, value, extend, **kwargs)
2649
Train/png/2649.png
def amean(x, weights=None): w_arr, x_arr = _preprocess_inputs(x, weights) return (w_arr*x_arr).sum(axis=0) / w_arr.sum(axis=0)
638
Train/png/638.png
def postprocessor(accepts, flag=None): def decorator(f): postprocessors.append((accepts, flag, f)) return f return decorator
431
Train/png/431.png
def flush(self): (slice_, self.__buffer) = (self.__buffer, '') self.__size = 0 return slice_
6654
Train/png/6654.png
def newDoc(version): ret = libxml2mod.xmlNewDoc(version) if ret is None: raise treeError('xmlNewDoc() failed') return xmlDoc(_obj=ret)
6619
Train/png/6619.png
def _write_items(self, row_lookup, col_lookup, item): self.qc.write_items(row_lookup, col_lookup, item)
2936
Train/png/2936.png
def loadJson(d): with codecs.open(jsonFn(d), 'r', 'utf-8') as f: return json.load(f)
752
Train/png/752.png
def runUAT(self, args): Utility.run([self.getRunUATScript()] + args, cwd=self.getEngineRoot(), raiseOnError=True)
2930
Train/png/2930.png
def progress(self, *msg): label = colors.purple("Progress") self._msg(label, *msg)
6235
Train/png/6235.png
def is_indiclang_char(c, lang): o = get_offset(c, lang) return (o >= 0 and o <= 0x7f) or ord(c) == DANDA or ord(c) == DOUBLE_DANDA
2614
Train/png/2614.png
def copy(self): new = self.__class__() new.__dict__ = dict(self.__dict__) return new
9302
Train/png/9302.png
def filter_opt(opt): return {k: GLib.Variant(*v) for k, v in opt.items() if v[1] is not None}
6108
Train/png/6108.png
def do_init(self, handler): self.waiting = True self.exc_info = None self.handler = handler
5347
Train/png/5347.png
def l2_norm(params): flattened, _ = flatten(params) return np.dot(flattened, flattened)
4802
Train/png/4802.png
def get(self, url, params=None): r = self.session.get(url, params=params) return self._response_parser(r, expect_json=False)
5980
Train/png/5980.png
def URem(a: BitVec, b: BitVec) -> BitVec: return _arithmetic_helper(a, b, z3.URem)
4998
Train/png/4998.png
def samtools_index(self, bam_file): cmd = self.tools.samtools + " index {0}".format(bam_file) return cmd
715
Train/png/715.png
def incr(name, value=1, rate=1, tags=None): client().incr(name, value, rate, tags)
8704
Train/png/8704.png
def total_msgs(xml): count = 0 for x in xml: count += len(x.message) return count
499
Train/png/499.png
def start(self, id): path = partial(_path, self.adapter) path = path(id) return self._put(path)
8845
Train/png/8845.png
def _get_a2(bbar, dbar, slip_moment, mmax): return ((dbar - bbar) / bbar) * (slip_moment / _scale_moment(mmax))
2605
Train/png/2605.png
def _on_open(self, sender, *args, **kwargs): self.get_config() self.get_version() self.on_open()
4904
Train/png/4904.png
def tag_add(self, *tags): return View({**self.spec, 'tag': list(set(self.tags) | set(tags))})
2202
Train/png/2202.png
def any_unique(keys, axis=semantics.axis_default): index = as_index(keys, axis) return np.any(index.count == 1)
7087
Train/png/7087.png
def get_root(w): next_level = w while next_level.master: next_level = next_level.master return next_level
89
Train/png/89.png
def print_new(ctx, name, migration_type): click.echo(ctx.obj.repository.generate_migration_name(name, migration_type))
329
Train/png/329.png
def bm3_big_F(p, v, v0): f = bm3_small_f(v, v0) return cal_big_F(p, f)
127
Train/png/127.png
def truncate(value: Decimal, n_digits: int) -> Decimal: return Decimal(math.trunc(value * (10 ** n_digits))) / (10 ** n_digits)
84
Train/png/84.png
def filter_contour(imageFile, opFile): im = Image.open(imageFile) im1 = im.filter(ImageFilter.CONTOUR) im1.save(opFile)
6147
Train/png/6147.png
def add_list_opt(self, opt, values): self.add_opt(opt) for val in values: self.add_opt(val)
5355
Train/png/5355.png
def _to_hours_mins_secs(time_taken): mins, secs = divmod(time_taken, 60) hours, mins = divmod(mins, 60) return hours, mins, secs
7126
Train/png/7126.png
def _handle_sigusr1(signum: int, frame: Any) -> None: print('=' * 70) print(''.join(traceback.format_stack())) print('-' * 70)
3602
Train/png/3602.png
def build_status(namespace, name, branch='master') -> pin: return ci_data(namespace, name, branch).get('build_success', None)
165
Train/png/165.png
def has_ops_before(self, ts): spec = {'ts': {'$lt': ts}} return bool(self.coll.find_one(spec))
2407
Train/png/2407.png
def load_file(self, filename): with open(filename, 'r') as sourcefile: self.set_string(sourcefile.read())
3256
Train/png/3256.png
def get_val(self, x): interval, mean, std = self.probability_map[x] new_val = norm.rvs(mean, std) return new_val
2255
Train/png/2255.png
def _is_orphan(scc, graph): return all(p in scc for v in scc for p in graph.parents(v))
5051
Train/png/5051.png
def info_1(*tokens: Token, **kwargs: Any) -> None: info(bold, blue, "::", reset, *tokens, **kwargs)
2180
Train/png/2180.png
def camel_to_snake(s: str) -> str: return CAMEL_CASE_RE.sub(r'_\1', s).strip().lower()
5359
Train/png/5359.png
def set_etag(self, etag, weak=False): self.headers["ETag"] = quote_etag(etag, weak)
7224
Train/png/7224.png
def _post(self, url, attributes=None, **kwargs): return self._request('post', url, attributes, **kwargs)
828
Train/png/828.png
def factors(self, rank): self._check_rank(rank) return [result.factors for result in self.results[rank]]
2411
Train/png/2411.png
def has_space(self, length=1, offset=0): return self.pos + (length + offset) - 1 < self.length
4814
Train/png/4814.png
def _peek(tokens, n=0): return tokens.peek(n=n, skip=_is_comment, drop=True)
287
Train/png/287.png
def InstanceOf(cls, **kwargs): return Property(types=cls, load=cls.load, **kwargs)
2169
Train/png/2169.png
def get_cgi_parameter_list(form: cgi.FieldStorage, key: str) -> List[str]: return form.getlist(key)
48
Train/png/48.png
def page_title(step, title): with AssertContextManager(step): assert_equals(world.browser.title, title)
1205
Train/png/1205.png
def _set_condition(self, condition): assert isinstance(condition, CodeExpression.TYPES) self.condition = condition
7978
Train/png/7978.png
def subscriptions_read(self, rid, **kwargs): return self.__call_api_post('subscriptions.read', rid=rid, kwargs=kwargs)
5513
Train/png/5513.png
def CheckBlobsExist(self, blob_ids): result = {} for blob_id in blob_ids: result[blob_id] = blob_id in self.blobs return result
7895
Train/png/7895.png
def is_none(node): "Determine if a node is the `None` keyword." return isinstance(node, parso.python.tree.Keyword) and node.value == 'None'
2546
Train/png/2546.png
def parse_footnote(document, container, elem): "Parse the footnote element." _rid = elem.attrib[_name('{{{w}}}id')] foot = doc.Footnote(_rid) container.elements.append(foot)
87
Train/png/87.png
def read_map(fname): lst = [] with open(fname, "r") as f: for line in f: lst.append(line) return lst
8743
Train/png/8743.png
def _icon_by_painter(self, painter, options): engine = CharIconEngine(self, painter, options) return QIcon(engine)
2692
Train/png/2692.png
def distances(self, points): return [math.acos(self._pos3d.dot(p.vector)) for p in points]
780
Train/png/780.png
def hour_match(data, hours): hours = [hours] if isinstance(hours, int) else hours return data.isin(hours)
7991
Train/png/7991.png
def _count(self, X, Y): self.feature_count_ += safe_sparse_dot(Y.T, X) self.class_count_ += Y.sum(axis=0)
2238
Train/png/2238.png
def set_progress_brackets(self, start, end): self.sep_start = start self.sep_end = end
7590
Train/png/7590.png
def add_anchor(self, url, line, column, name, base): self.anchors.append((url, line, column, name, base))
8809
Train/png/8809.png
def build_payload(self, payload): for segment in self.segments: segment.pack(payload, commit=self.autocommit)
4562
Train/png/4562.png
def SegmentMin(a, ids): def func(idxs): return np.amin(a[idxs], axis=0) return seg_map(func, a, ids),
7926
Train/png/7926.png
def yaw(self): x, y, z, w = self.x, self.y, self.z, self.w return math.asin(2*x*y + 2*z*w)
4970
Train/png/4970.png
def splititer(self, string, *args, **kwargs): return self._pattern.splititer(string, *args, **kwargs)
6716
Train/png/6716.png
def is_in_pythonpath(self, dirname): return fixpath(dirname) in [fixpath(_p) for _p in self.pythonpath]
5723
Train/png/5723.png
def exception(self, url, exception): return (time.time() + self.ttl, self.factory(url))
7977
Train/png/7977.png
def subscriptions_get_one(self, room_id, **kwargs): return self.__call_api_get('subscriptions.getOne', roomId=room_id, kwargs=kwargs)
2908
Train/png/2908.png
def start(label, at=None): t = at if at is not None else time.time() marker = Marker().start(t) labels[label] = marker.dumps()
9151
Train/png/9151.png
def narrow(self): t, h = self.time, self.half_duration h /= self.scaling_coeff_x self.set_interval((t - h, t + h))
8382
Train/png/8382.png
def skew_normal_expval(mu, tau, alpha): delta = alpha / np.sqrt(1. + alpha ** 2) return mu + np.sqrt(2 / pi / tau) * delta
8526
Train/png/8526.png
def name(class_name: str, chain_class: Type[BaseChain]) -> Type[BaseChain]: return chain_class.configure(__name__=class_name)
8328
Train/png/8328.png
def delete_taskset(self, taskset_id): s = self.restore_taskset(taskset_id) if s: s.delete()