common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
9758
|
Train/png/9758.png
|
def load_data(self):
for embed_type in self.ids.keys():
self.load_instances(embed_type, self.ids[embed_type])
|
1616
|
Train/png/1616.png
|
def _to_binary(val):
if isinstance(val, text_type):
return val.encode('utf-8')
assert isinstance(val, binary_type)
return val
|
5641
|
Train/png/5641.png
|
def _set_feature(self, name, status):
setattr(self, self._feature_attrname(name), status)
|
8998
|
Train/png/8998.png
|
def recall():
a = TpPd(pd=0x3)
b = MessageType(mesType=0xb) # 00001011
c = RecallType()
d = Facility()
packet = a / b / c / d
return packet
|
7873
|
Train/png/7873.png
|
def checkin(self):
self._query_instance.checkin(self.place_id,
self._query_instance.sensor)
|
7943
|
Train/png/7943.png
|
def get_hit_status(self, hitid):
hitdata = self.get_hit(hitid)
if not hitdata:
return False
return hitdata['HITStatus']
|
5850
|
Train/png/5850.png
|
def evalsha(self, digest, keys=[], args=[]):
return self.execute(b'EVALSHA', digest, len(keys), *(keys + args))
|
9656
|
Train/png/9656.png
|
def q_if(self, *qregs):
self.data = [gate.q_if(qregs) for gate in self.data]
return self
|
7130
|
Train/png/7130.png
|
def get_class(context, field, obj=None):
view = context['view']
return view.lookup_field_class(field, obj, "field_" + field)
|
7995
|
Train/png/7995.png
|
def url(self, host):
path = '/'.join(str(v) for v in self._path)
return 'coaps://{}:5684/{}'.format(host, path)
|
1564
|
Train/png/1564.png
|
def is_equal(self, string1, string2):
return string1.lower().strip() == string2.lower().strip()
|
6267
|
Train/png/6267.png
|
def cli(ctx, project_dir):
exit_code = SCons(project_dir).verify()
ctx.exit(exit_code)
|
1171
|
Train/png/1171.png
|
def next_index(self) -> int:
return bisect.bisect_right(self.totals, random.random() * self.total)
|
4233
|
Train/png/4233.png
|
def get_ram(self, format_="nl"):
ram = [self.ram.read(i) for i in range(self.ram.size)]
return self._format_mem(ram, format_)
|
8167
|
Train/png/8167.png
|
def check(self, request):
if callable(self.check_func):
self.visible = self.check_func(request)
|
4508
|
Train/png/4508.png
|
def top(n, width=WIDTH, style=STYLE):
return hrule(n, width, linestyle=STYLES[style].top)
|
5669
|
Train/png/5669.png
|
def get_zip_file(url):
with requests.get(url, stream=True) as f:
z = zipfile.ZipFile(io.BytesIO(f.content))
return z
|
552
|
Train/png/552.png
|
def interm_size(self) -> Sequence[Shape]:
return self._sizes(self._compiler.rddl.interm_size)
|
9890
|
Train/png/9890.png
|
def get_card(self, id, name=None):
return self.create_card(dict(id=id, name=name))
|
9629
|
Train/png/9629.png
|
def from_astropy_table(table):
import vaex.file.other
return vaex.file.other.DatasetAstropyTable(table=table)
|
8749
|
Train/png/8749.png
|
def OnBGColor(self, event):
color = event.GetValue().GetRGB()
post_command_event(self, self.BackgroundColorMsg, color=color)
|
7743
|
Train/png/7743.png
|
def clear_lock(self, key):
lock_path = self._get_lock_path(key)
os.remove(lock_path)
|
6305
|
Train/png/6305.png
|
def str2int(num, radix=10, alphabet=BASE85):
return NumConv(radix, alphabet).str2int(num)
|
4291
|
Train/png/4291.png
|
def reset_params(self):
self.__params = dict([p, None] for p in self.param_names)
self.set_params(self.param_defaults)
|
604
|
Train/png/604.png
|
def websafe(s):
s = s.replace("<", "<").replace(">", ">")
s = s.replace(r'\x', r' \x')
s = s.replace("\n", "<br>")
return s
|
1035
|
Train/png/1035.png
|
def decode(self, litmap):
return Or(*[And(*[litmap[idx] for idx in clause])
for clause in self.clauses])
|
1632
|
Train/png/1632.png
|
def set_tiepoints(self, lon, lat):
self.lon_tiepoint = lon
self.lat_tiepoint = lat
|
6626
|
Train/png/6626.png
|
def _snake_to_camel_case(value):
words = value.split("_")
return words[0] + "".join(map(str.capitalize, words[1:]))
|
5567
|
Train/png/5567.png
|
def nonzeros(m, row):
for index in range(m.indptr[row], m.indptr[row+1]):
yield m.indices[index], m.data[index]
|
2456
|
Train/png/2456.png
|
def parse(some_text, **kwargs):
ap = parser.AddressParser(**kwargs)
return ap.parse(some_text)
|
6450
|
Train/png/6450.png
|
def rand_zoom(scale: uniform = 1.0, p: float = 1.):
"Randomized version of `zoom`."
return zoom(scale=scale, **rand_pos, p=p)
|
9073
|
Train/png/9073.png
|
def strip_querystring(url):
p = six.moves.urllib.parse.urlparse(url)
return p.scheme + "://" + p.netloc + p.path
|
8795
|
Train/png/8795.png
|
def rollout(self, batch_info: BatchInfo, model: Model, number_of_steps: int) -> Rollout:
raise NotImplementedError
|
1556
|
Train/png/1556.png
|
def write(self, more):
if more:
self.output += str(more).upper()
self.output += '\n'
|
2647
|
Train/png/2647.png
|
def kdists(matrix, k=7, ix=None):
ix = ix or kindex(matrix, k)
return matrix[ix][np.newaxis].T
|
6733
|
Train/png/6733.png
|
def show_std_icons():
app = qapplication()
dialog = ShowStdIcons(None)
dialog.show()
sys.exit(app.exec_())
|
2020
|
Train/png/2020.png
|
def from_context(cls, context):
return cls(id=context.id, context=context.to_dict())
|
5827
|
Train/png/5827.png
|
def set_attribute(self, name, value):
self.attribute_name = name
self.attribute = value
|
6467
|
Train/png/6467.png
|
def print_intervals(intervals):
res = []
for i in intervals:
res.append(repr(i))
print("".join(res))
|
7088
|
Train/png/7088.png
|
def add(self, quantity):
newvalue = self._value + quantity
self.set(newvalue.deg)
|
766
|
Train/png/766.png
|
def prompt(*args, **kwargs):
try:
return click.prompt(*args, **kwargs)
except click.Abort:
return False
|
7252
|
Train/png/7252.png
|
def loop_misc(self):
self.check_keepalive()
if self.last_retry_check + 1 < time.time():
pass
return NC.ERR_SUCCESS
|
7497
|
Train/png/7497.png
|
def lambda_max(self):
return ((const.b_wien.value / self.temperature) * u.m).to(u.AA).value
|
3232
|
Train/png/3232.png
|
def reset(self):
self.__matrix = np.array([])
self.__networks = np.array([])
|
3015
|
Train/png/3015.png
|
def get_product(id=None, name=None):
content = get_product_raw(id, name)
if content:
return utils.format_json(content)
|
8661
|
Train/png/8661.png
|
def astensor(array: TensorLike) -> BKTensor:
tensor = tf.convert_to_tensor(value=array, dtype=CTYPE)
return tensor
|
7305
|
Train/png/7305.png
|
def dumped(text, level, indent=2):
return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n"
|
7630
|
Train/png/7630.png
|
def f_string_check(self, original, loc, tokens):
return self.check_py("36", "format string", original, loc, tokens)
|
1740
|
Train/png/1740.png
|
def list_(ctx):
plugins = plugins_registry.get_plugins()
click.echo("\n".join(
["%s (%s)" % p for p in plugins.items()]
))
|
2376
|
Train/png/2376.png
|
def process(self, event):
logger.info(f"{self}: put {event.src_path}")
self.queue.put(os.path.basename(event.src_path))
|
5887
|
Train/png/5887.png
|
def sunionstore(self, destkey, key, *keys):
return self.execute(b'SUNIONSTORE', destkey, key, *keys)
|
1311
|
Train/png/1311.png
|
def select_name(self, name, *args):
self.boxl.select_node(self._name2i[name])
|
843
|
Train/png/843.png
|
def resetSession(self, username=None, password=None, verify=True):
self.disconnectSession()
self.session = AikidoSession(username, password, verify)
|
93
|
Train/png/93.png
|
def __begin_of_list(self, ast_token):
self.list_level += 1
if self.list_level == 1:
self.final_ast_tokens.append(ast_token)
|
2194
|
Train/png/2194.png
|
def is_dict_like(obj, attr=('keys', 'items')):
for a in attr:
if not hasattr(obj, a):
return False
return True
|
3859
|
Train/png/3859.png
|
def get_scaled_v2(self, amount):
return Vec2(self.x * amount, self.y * amount)
|
8319
|
Train/png/8319.png
|
def remove_legend(self):
if hasattr(self, 'legend'):
self.remove_actor(self.legend, reset_camera=False)
self._render()
|
6128
|
Train/png/6128.png
|
def REGEX(pattern, flags=0):
return P(lambda x: re.match(pattern, x, flags=flags))
|
5139
|
Train/png/5139.png
|
def schema_root(self) -> "SchemaTreeNode":
sn = self
while sn.parent:
sn = sn.parent
return sn
|
297
|
Train/png/297.png
|
def _onArgument(self, name, annotation):
self.objectsStack[-1].arguments.append(Argument(name, annotation))
|
5762
|
Train/png/5762.png
|
def in_same_table(self):
if self._tc.tbl is self._other_tc.tbl:
return True
return False
|
5275
|
Train/png/5275.png
|
def operations(self):
return [op for block in self.blocks for op in block.vex.operations]
|
5848
|
Train/png/5848.png
|
def channels(self):
return types.MappingProxyType({
ch.name: ch for ch in self._refs.values()
if not ch.is_pattern})
|
7098
|
Train/png/7098.png
|
def delete(self):
url = self._imgur._base_url + "/3/message/{0}".format(self.id)
return self._imgur._send_request(url, method='DELETE')
|
3534
|
Train/png/3534.png
|
def close_connection(self):
self._logger.info('Closing connection')
self._closing = True
self._connection.close()
|
5468
|
Train/png/5468.png
|
def _load_corpus(name, data_home=None):
info = DATASETS[name]
return Corpus(name, data_home=data_home, **info)
|
2732
|
Train/png/2732.png
|
def chunk_list(l, n):
return [l[i:i + n] for i in range(0, len(l), n)]
|
7886
|
Train/png/7886.png
|
def credit_card_account_query(self, number, date):
return self.authenticated_query(self._ccreq(number, date))
|
9990
|
Train/png/9990.png
|
def request_receiver(self, pn_link):
rl = ReceiverLink(self._connection, pn_link)
self._links.add(rl)
return rl
|
7561
|
Train/png/7561.png
|
def pv_count(self):
self.open()
count = lvm_vg_get_pv_count(self.handle)
self.close()
return count
|
9434
|
Train/png/9434.png
|
def from_zone(zone):
validity = zone.validity.start if zone.validity else None
return build(zone.level, zone.code, validity)
|
3477
|
Train/png/3477.png
|
def find_if_expression_as_statement(node):
return (
isinstance(node, ast.Expr)
and isinstance(node.value, ast.IfExp)
)
|
5908
|
Train/png/5908.png
|
def recurse(self, factory_meta, extras):
return self.__class__(factory_meta, extras, strategy=self.strategy)
|
3192
|
Train/png/3192.png
|
def get_upload_form(self):
return self.form_class(self.request.POST, self.request.FILES)
|
9347
|
Train/png/9347.png
|
def dfs_do_func_on_graph(node, func, *args, **kwargs):
for _node in node.tree_iterator():
func(_node, *args, **kwargs)
|
4728
|
Train/png/4728.png
|
def unwrap(self, val):
if val.getID() != self.id:
self._update(val)
return self._unwrap(val)
|
9006
|
Train/png/9006.png
|
def detachAcceptMsTerminated():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x6) # 00000110
packet = a / b
return packet
|
6529
|
Train/png/6529.png
|
def Pad(self, n):
for i in range_func(n):
self.Place(0, N.Uint8Flags)
|
4505
|
Train/png/4505.png
|
def software_fibonacci(n):
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return a
|
4951
|
Train/png/4951.png
|
def table(self):
if self._table is None:
self._table = list(self._iter_rows())
return self._table
|
8263
|
Train/png/8263.png
|
def _iter_keys(key):
for i in range(winreg.QueryInfoKey(key)[0]):
yield winreg.OpenKey(key, winreg.EnumKey(key, i))
|
6222
|
Train/png/6222.png
|
def get_sparse_matrix_keys(session, key_table):
return session.query(key_table).order_by(key_table.name).all()
|
9861
|
Train/png/9861.png
|
def get_refer(self, sym: sym.Symbol) -> Optional[Var]:
return self.refers.entry(sym, None)
|
5260
|
Train/png/5260.png
|
def _is_text_file(filename):
type_of_file = os.popen('file -bi {0}'.format(filename), 'r').read()
return type_of_file.startswith('text')
|
8931
|
Train/png/8931.png
|
def delete(self, **kwargs):
self.inflate()
for model in self._models:
model.delete(**kwargs)
return
|
8729
|
Train/png/8729.png
|
def raise_msg_to_str(msg):
if not is_string_like(msg):
msg = '\n'.join(map(str, msg))
return msg
|
2895
|
Train/png/2895.png
|
def copy(self):
new_vec = Vector2()
new_vec.X = self.X
new_vec.Y = self.Y
return new_vec
|
4632
|
Train/png/4632.png
|
def add(gc: GroupControl, slaves):
click.echo("Adding to existing group: %s" % slaves)
click.echo(await gc.add(slaves))
|
219
|
Train/png/219.png
|
def scopes(self, **kwargs):
return self._client.scopes(team=self.id, **kwargs)
|
10094
|
Train/png/10094.png
|
def transform_cell(self, cell):
self.reset()
self.push(cell)
return self.source_reset()
|
6472
|
Train/png/6472.png
|
def teardown_tempdir(dir):
r
if ssh_conn:
delete_tree(dir)
assert_valid_dir(dir)
shutil.rmtree(dir)
|
8306
|
Train/png/8306.png
|
def disable(self):
self.post("disable")
if self.service.restart_required:
self.service.restart(120)
return self
|
2278
|
Train/png/2278.png
|
def sort(self, attr):
self.entries = Sorter(self.entries, self.category, attr).sort_entries()
return self
|
8645
|
Train/png/8645.png
|
def close(self):
if self.pyb and self.pyb.serial:
self.pyb.serial.close()
self.pyb = None
|
8399
|
Train/png/8399.png
|
def send_backspace(self, count):
for i in range(count):
self.interface.send_key(Key.BACKSPACE)
|
3348
|
Train/png/3348.png
|
def jx_type(column):
if column.es_column.endswith(EXISTS_TYPE):
return EXISTS
return es_type_to_json_type[column.es_type]
|
5057
|
Train/png/5057.png
|
def unzip_file_to_dir(path_to_zip, output_directory):
z = ZipFile(path_to_zip, 'r')
z.extractall(output_directory)
z.close()
|
3086
|
Train/png/3086.png
|
def set_type(self, type):
self.add_var_opt('type', str(type))
self.__type = str(type)
self.__set_output()
|
2039
|
Train/png/2039.png
|
def update_mt_arg(self, metatabfile):
o = MetapackCliMemo(self.args)
o.set_mt_arg(metatabfile)
return o
|
3612
|
Train/png/3612.png
|
def _dict_of_funcs(self, funcs: list) -> pd.Series:
return {func.__name__: func for func in funcs}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.