common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
8605 | Train/png/8605.png | def yview(self, *args):
self.after_idle(self.__updateWnds)
ttk.Treeview.yview(self, *args)
|
7559 | Train/png/7559.png | def pickle_load(fname):
assert type(fname) is str and os.path.exists(fname)
print("loaded", fname)
return pickle.load(open(fname, "rb"))
|
2203 | Train/png/2203.png | def all_equal(keys, axis=semantics.axis_default):
index = as_index(keys, axis)
return index.groups == 1
|
8867 | Train/png/8867.png | def disable_torque(self, ids):
self._set_torque_enable(dict(zip(ids, itertools.repeat(False))))
|
6937 | Train/png/6937.png | def _synced(method, self, args, kwargs):
with self._lock:
return method(*args, **kwargs)
|
2608 | Train/png/2608.png | def terminate(self):
for t in self._threads:
t.quit()
self._thread = []
self._workers = []
|
2990 | Train/png/2990.png | def storage_method(func):
def wrap(self, *args, **kwargs):
return func(self._root_storage, *args, **kwargs)
return wrap
|
4892 | Train/png/4892.png | def zip(self, other):
return self.__class__(p1 % p2 for p1, p2 in zip(self, other))
|
8334 | Train/png/8334.png | def drange(v0, v1, d):
assert v0 < v1
return xrange(int(v0)//d, int(v1+d)//d)
|
3249 | Train/png/3249.png | def value(self, name):
return self.tracks.get(name).row_value(self.controller.row)
|
111 | Train/png/111.png | def cancel_all_orders(self) -> List[str]:
order_ids = [o.id for o in self.fetch_all_open_orders()]
return self.cancel_orders(order_ids)
|
7389 | Train/png/7389.png | def skew_matrix(w):
return np.array([[0, -w[2], w[1]],
[w[2], 0, -w[0]],
[-w[1], w[0], 0]])
|
8603 | Train/png/8603.png | def null_write_block(fo, block_bytes):
write_long(fo, len(block_bytes))
fo.write(block_bytes)
|
4434 | Train/png/4434.png | def sunion(self, keys, *args):
def func(left, right): return left.union(right)
return self._apply_to_sets(func, "SUNION", keys, *args)
|
896 | Train/png/896.png | def get_system_flags() -> FrozenSet[Flag]:
return frozenset({Seen, Recent, Deleted, Flagged, Answered, Draft})
|
445 | Train/png/445.png | def streams(self):
if self._streams is None:
self._streams = list(self._stream_df["STREAM"].values)
return self._streams
|
245 | Train/png/245.png | def write_results(filename, config, srcfile, samples):
results = createResults(config, srcfile, samples=samples)
results.write(filename)
|
944 | Train/png/944.png | def statsId(obj):
if hasattr(obj, ID_KEY):
return getattr(obj, ID_KEY)
newId = next(NEXT_ID)
setattr(obj, ID_KEY, newId)
return newId
|
4276 | Train/png/4276.png | def parse(string):
"return a BaseX tree for the string"
print(string)
if string.strip().lower().startswith('create index'):
return IndexX(string)
return YACC.parse(string, lexer=LEXER.clone())
|
2671 | Train/png/2671.png | def copy(self):
return Header([line.copy() for line in self.lines], self.samples.copy())
|
64 | Train/png/64.png | def serialize(v, known_modules=[]):
tname = name(v, known_modules=known_modules)
func = serializer(tname)
return func(v), tname
|
8433 | Train/png/8433.png | def projR(gamma, p):
return np.multiply(gamma.T, p / np.maximum(np.sum(gamma, axis=1), 1e-10)).T
|
4934 | Train/png/4934.png | def add(self, queue_name, transactional=False):
task = self.to_task()
task.add(queue_name, transactional)
|
4965 | Train/png/4965.png | def compile_search(pattern, flags=0, **kwargs):
return _regex.compile(_apply_search_backrefs(pattern, flags), flags, **kwargs)
|
4778 | Train/png/4778.png | def __locate(self):
if self.ns[1] != self.schema.tns[1]:
return self.schema.locate(self.ns)
|
10006 | Train/png/10006.png | def position(self) -> Position:
return Position(self._index, self._lineno, self._col_offset)
|
2623 | Train/png/2623.png | def validate(self):
if self.required and not self.has_value:
raise RequiredValueMissing(name=self.name, item=self)
|
1788 | Train/png/1788.png | def set_rainbow(self, duration):
for i in range(0, 359):
self.set_color_hsv(i, 100, 100)
time.sleep(duration/359)
|
9714 | Train/png/9714.png | def decode_base64(text, encoding='utf-8'):
text = to_bytes(text, encoding)
return to_unicode(base64.b64decode(text), encoding)
|
5354 | Train/png/5354.png | def output(self, name: str, value: Any):
self.outputs[name] = value
|
833 | Train/png/833.png | def get_default_vpc():
ec2 = get_ec2_resource()
for vpc in ec2.vpcs.all():
if vpc.is_default:
return vpc
|
1132 | Train/png/1132.png | def list_dirs(directory):
return [f for f in pathlib.Path(directory).iterdir() if f.is_dir()]
|
4305 | Train/png/4305.png | def _request_titles_xml() -> ET.ElementTree:
response = api.titles_request()
return api.unpack_xml(response.text)
|
1136 | Train/png/1136.png | def dump(self, file, sort_keys: bool = True, **kwargs) -> None:
json.dump(self.to_json(), file, sort_keys=sort_keys, **kwargs)
|
5271 | Train/png/5271.png | def event_return(events):
for event in events:
ret = event.get('data', False)
if ret:
returner(ret)
|
8830 | Train/png/8830.png | def _compute_magnitude_squared_term(self, P, M, Q, W, mag):
return P * (mag - M) + Q * (mag - M) ** 2 + W
|
1348 | Train/png/1348.png | def precesion(date): # pragma: no cover
zeta, theta, z = np.deg2rad(_precesion(date))
return rot3(zeta) @ rot2(-theta) @ rot3(z)
|
2738 | Train/png/2738.png | def stops(self):
stops = set()
for stop_time in self.stop_times():
stops |= stop_time.stops()
return stops
|
9261 | Train/png/9261.png | def at_least_libvips(x, y):
major = version(0)
minor = version(1)
return major > x or (major == x and minor >= y)
|
8393 | Train/png/8393.png | def all_pkgs(self):
if not self.packages:
self.packages = self.get_pkg_list()
return self.packages
|
6897 | Train/png/6897.png | def register(self, name, fun, description=None):
self.methods[name] = fun
self.descriptions[name] = description
|
5070 | Train/png/5070.png | def store_directory(ctx, param, value):
Path(value).mkdir(parents=True, exist_ok=True)
set_git_home(value)
return value
|
2988 | Train/png/2988.png | def get_runconfig(path=None, root=None, db=None):
return load(path, root=root, db=db)
|
9322 | Train/png/9322.png | def restart(ctx, **kwargs):
update_context(ctx, kwargs)
daemon = mk_daemon(ctx)
daemon.stop()
daemon.start()
|
41 | Train/png/41.png | def delete_file(self, fid):
url = self.get_file_url(fid)
return self.conn.delete_data(url)
|
3758 | Train/png/3758.png | def to_pascal_case(s):
return re.sub(r'(?!^)_([a-zA-Z])', lambda m: m.group(1).upper(), s.capitalize())
|
9358 | Train/png/9358.png | def extract_zipfile(archive_name, destpath):
"Unpack a zip file"
archive = zipfile.ZipFile(archive_name)
archive.extractall(destpath)
|
9889 | Train/png/9889.png | def get_list(self, id, name=None):
return self.create_list(dict(id=id, name=name))
|
1483 | Train/png/1483.png | def check(self, feature):
mapper = feature.as_dataframe_mapper()
mapper.fit_transform(self.X, y=self.y)
|
3920 | Train/png/3920.png | def get(self, name: str, default: Any = None) -> Any:
return super().get(name, [default])[0]
|
6464 | Train/png/6464.png | def reset_local_buffers(self):
agent_ids = list(self.keys())
for k in agent_ids:
self[k].reset_agent()
|
1095 | Train/png/1095.png | def to_spans(self):
"Convert the tree to a set of nonterms and spans."
s = set()
self._convert_to_spans(self.tree, 1, s)
return s
|
1751 | Train/png/1751.png | def hash_file(filepath: str) -> str:
md5 = hashlib.md5()
acc_hash(filepath, md5)
return md5.hexdigest()
|
2532 | Train/png/2532.png | def toString(self) -> str:
return ' '.join(attr.html for attr in self._dict.values())
|
5234 | Train/png/5234.png | def get(self, item):
uri = "/%s/%s" % (self.uri_base, utils.get_id(item))
return self._get(uri)
|
9568 | Train/png/9568.png | def get_auth(self):
return (self._cfgparse.get(self._section, 'username'), self._cfgparse.get(self._section, 'password'))
|
7052 | Train/png/7052.png | def inHouseJoy(self):
house = self.house()
return props.object.houseJoy[self.obj.id] == house.id
|
8291 | Train/png/8291.png | def image_delete_properties(request, image_id, keys):
return glanceclient(request, '2').images.update(image_id, keys)
|
1539 | Train/png/1539.png | def destroy(self):
super(AndroidTabLayout, self).destroy()
if self.tabs:
del self.tabs
|
9248 | Train/png/9248.png | def echo_headers(headers, file=None):
for k, v in sorted(headers.items()):
click.echo("{0}: {1}".format(k.title(), v), file=file)
click.echo(file=file)
|
2130 | Train/png/2130.png | def mutate(self, p_i, func_set, term_set): # , max_depth=2
self.point_mutate(p_i, func_set, term_set)
|
1606 | Train/png/1606.png | def refresh_all_state_machines(self):
self.refresh_state_machines(
list(self.model.state_machine_manager.state_machines.keys()))
|
3657 | Train/png/3657.png | def build_message(self, stat, value):
return ' '.join((self.prefix + str(stat), str(value), str(round(time()))))
|
6556 | Train/png/6556.png | def writeline(self, x, node=None, extra=0):
self.newline(node, extra)
self.write(x)
|
9379 | Train/png/9379.png | def resolve_dependencies(self):
self._concatenate_inner(True)
self._concatenate_inner(False)
self._insert_breaklines()
|
1527 | Train/png/1527.png | def fw_rule_update(self, data, fw_name=None):
LOG.debug("FW Update Debug")
self._fw_rule_update(fw_name, data)
|
2722 | Train/png/2722.png | def unbounded(self):
self._check_valid()
return (self._problem._p.get_status() ==
qsoptex.SolutionStatus.UNBOUNDED)
|
1031 | Train/png/1031.png | def gray2bin(G):
return farray([G[i:].uxor() for i, _ in enumerate(G)])
|
4620 | Train/png/4620.png | def completenames(self, text, *ignored):
return sorted(cmd.Cmd.completenames(self, text, *ignored) + self.argparse_names(text))
|
3033 | Train/png/3033.png | def sethello(self, time):
_runshell([brctlexe, 'sethello', self.name, str(time)],
"Could not set hello time in %s." % self.name)
|
5921 | Train/png/5921.png | def refresh(self):
self._screen.block_transfer(self._buffer, self._dx, self._dy)
|
6261 | Train/png/6261.png | def set_y(self, y):
"Set y position and reset x"
self.x = self.l_margin
if (y >= 0):
self.y = y
else:
self.y = self.h+y
|
615 | Train/png/615.png | def get_constants(self):
url = self.BASE + '/constants'
data = await self.request(url)
return Constants(self, data)
|
9596 | Train/png/9596.png | def _z(self, x):
with tf.name_scope("standardize"):
return (x - self.loc) / self.scale
|
7318 | Train/png/7318.png | def sd(self):
v = self.var()
if len(v):
return np.sqrt(v)
else:
return None
|
31 | Train/png/31.png | def sort_generators(self):
self.generators.sort(key=lambda gn: gn.bus._i)
|
2100 | Train/png/2100.png | def uniquify_list(L):
return [e for i, e in enumerate(L) if L.index(e) == i]
|
8805 | Train/png/8805.png | def means_abs_diff(X):
return np.mean(np.abs(np.diff(X, axis=1)), axis=1)
|
9383 | Train/png/9383.png | def parse_atom_file(filename: str) -> AtomFeed:
root = parse_xml(filename).getroot()
return _parse_atom(root)
|
7682 | Train/png/7682.png | def VERSION(self):
return int(re.match(r'^(\D+)(\d+)$', self.__class__.__name__).group(2))
|
8284 | Train/png/8284.png | def predict(self, inputs: np.ndarray) -> np.ndarray:
return self.sess.run(self.out_var, {self.inp_var: inputs})
|
7852 | Train/png/7852.png | def create(self, item, dry_run=None):
return self.backend.create(validate(item, version=self.version, context=self.context), dry_run=dry_run)
|
9315 | Train/png/9315.png | def has_edge(self, p_from, p_to):
return p_from in self._edges and p_to in self._edges[p_from]
|
7499 | Train/png/7499.png | def get_asset(self):
import predix.data.asset
asset = predix.data.asset.Asset()
return asset
|
7463 | Train/png/7463.png | def rdy(self, count):
self.ready = count
self.last_ready_sent = count
return self.send(constants.RDY + ' ' + str(count))
|
2954 | Train/png/2954.png | def consume(self, seq):
for kmer in iter_kmers(seq, self.k, canonical=self.canonical):
self._incr(kmer)
|
2440 | Train/png/2440.png | def visit_Num(self, node: AST, dfltChaining: bool = True) -> str:
return str(node.n)
|
4940 | Train/png/4940.png | def complex_type(name=None):
def wrapped(cls):
ParseType.type_mapping[name or cls.__name__] = cls
return cls
return wrapped
|
3432 | Train/png/3432.png | def list_keys(self):
keys = self._curl_bitmex("/apiKey/")
print(json.dumps(keys, sort_keys=True, indent=4))
|
8251 | Train/png/8251.png | def to_file_mode(self):
for message_no in range(len(self.messages)):
self.__to_file(message_no)
|
7857 | Train/png/7857.png | def count_partitions(self, topic):
return sum(1 for p in topic.partitions if p in self.partitions)
|
373 | Train/png/373.png | def put(self, path, payload):
body = json.dumps(payload)
return self._request(path, 'PUT', body)
|
1253 | Train/png/1253.png | def update(self, automation):
self._automation.update(
{k: automation[k] for k in automation if self._automation.get(k)})
|
7709 | Train/png/7709.png | def gen_bsh(src1, src2, dst):
assert src1.size == src2.size
return ReilBuilder.build(ReilMnemonic.BSH, src1, src2, dst)
|
3795 | Train/png/3795.png | def get_model_config_value(self, obj, name):
config = models_config.get_config(obj)
return getattr(config, name)
|
1387 | Train/png/1387.png | def read(self, file):
content = self._read_content(file)
self._validate(content)
self._parse(content)
return self
|
8452 | Train/png/8452.png | def shell(self, *args, **kwargs):
args = ['shell'] + list(args)
return self.run_cmd(*args, **kwargs)
|
8292 | Train/png/8292.png | def add_global(self, globalvalue):
assert globalvalue.name not in self.globals
self.globals[globalvalue.name] = globalvalue
|
4963 | Train/png/4963.png | def rewind(self, count):
if count > self._index: # pragma: no cover
raise ValueError("Can't rewind past beginning!")
self._index -= count
|
6348 | Train/png/6348.png | def add(self, term):
self._value = self.accum_param.addInPlace(self._value, term)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.