common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
9395
|
Train/png/9395.png
|
def has_reg(self, reg_name):
return any(operand.has_reg(reg_name) for operand in self.operands)
|
62
|
Train/png/62.png
|
def load(s, **kwargs):
try:
return loads(s, **kwargs)
except TypeError:
return loads(s.read(), **kwargs)
|
9844
|
Train/png/9844.png
|
def _width_is_big_enough(image, width):
if width > image.size[0]:
raise ImageSizeError(image.size[0], width)
|
5781
|
Train/png/5781.png
|
def get_container_data(self):
for obj in self.get_containers():
info = self.get_base_info(obj)
yield info
|
2881
|
Train/png/2881.png
|
def save(self, fname=''):
if fname is '':
self.case.save()
else:
self.case.SaveAs(self.path+os.sep+fname)
|
6049
|
Train/png/6049.png
|
def tagged(self, tag):
return Scm(self.connection, self.developer_connection, self.url, tag=tag)
|
6170
|
Train/png/6170.png
|
def log_warn(message, args):
get_logger(DEFAULT_LOGGER, log_creation=False).log(
logging.WARNING, message, *args)
|
9486
|
Train/png/9486.png
|
def find_actual_cause(self, mechanism, purviews=False):
return self.find_causal_link(Direction.CAUSE, mechanism, purviews)
|
1430
|
Train/png/1430.png
|
def delete(self):
if lib.EnvDeleteInstance(self._env, self._ist) != 1:
raise CLIPSError(self._env)
|
3452
|
Train/png/3452.png
|
def deprecated(operation=None):
def inner(o):
o.deprecated = True
return o
return inner(operation) if operation else inner
|
5277
|
Train/png/5277.png
|
def end(self):
if not self.args.disable_autodiscover:
self.autodiscover_client.close()
self.server.end()
|
8968
|
Train/png/8968.png
|
def _one_contains_other(s1, s2):
return min(len(s1), len(s2)) == len(s1 & s2)
|
2869
|
Train/png/2869.png
|
def handle_abort(self, reason):
self._welcome_queue.put(reason)
self.close()
self.disconnect()
|
1944
|
Train/png/1944.png
|
def assets(self) -> List[Asset]:
return list(filter(is_element(Asset), self.content))
|
1885
|
Train/png/1885.png
|
def clone(self):
clone_copy = copy.deepcopy(self)
clone_copy.state_ = EntityState()
return clone_copy
|
196
|
Train/png/196.png
|
def frombits(cls, bits):
return cls.frombitsets(map(cls.BitSet.frombits, bits))
|
8877
|
Train/png/8877.png
|
def clean_up(self):
self.action_buffer = []
self.sources = {}
self.doc_to_get = {}
self.doc_to_update = []
|
6719
|
Train/png/6719.png
|
def add_path_to_sys_path(self):
for path in reversed(self.get_spyder_pythonpath()):
sys.path.insert(1, path)
|
1137
|
Train/png/1137.png
|
def dumps(self, sort_keys: bool = True, **kwargs) -> str:
return json.dumps(self.to_json(), sort_keys=sort_keys, **kwargs)
|
3036
|
Train/png/3036.png
|
def genes(self):
return [ExpGene.from_series(g)
for i, g in self.reset_index().iterrows()]
|
5413
|
Train/png/5413.png
|
def lset(self, name, index, value):
"Set ``position`` of list ``name`` to ``value``"
return self.execute_command('LSET', name, index, value)
|
6895
|
Train/png/6895.png
|
def publish(self, tag, message):
payload = self.build_payload(tag, message)
self.socket.send(payload)
|
3311
|
Train/png/3311.png
|
def display_list(prefix, l, color):
for itm in l:
print(colored(prefix + itm['path'], color))
|
2566
|
Train/png/2566.png
|
def toggle_grid(self, evt=None, show=None):
"toggle grid display"
if show is None:
show = not self.conf.show_grid
self.conf.enable_grid(show)
|
4756
|
Train/png/4756.png
|
def select(select, tag, namespaces=None, limit=0, flags=0, **kwargs):
return compile(select, namespaces, flags, **kwargs).select(tag, limit)
|
6337
|
Train/png/6337.png
|
def items(self):
if not self.pdata and not self.spills:
return iter(self.data.items())
return self._external_items()
|
9692
|
Train/png/9692.png
|
def cat_handler(self, args):
self.validate('cmd|s3', args)
source = args[1]
self.s3handler().print_files(source)
|
4864
|
Train/png/4864.png
|
def _track_modify(self, cls, name, detail, keep, trace):
self._observers[cls].modify(name, detail, keep, trace)
|
8061
|
Train/png/8061.png
|
def order(self):
return [x.val for theclass in self.classes for x in theclass.items]
|
5250
|
Train/png/5250.png
|
def _zip_flatten(x, ys):
return itertools.chain.from_iterable(
zip(itertools.repeat(x), ys))
|
897
|
Train/png/897.png
|
def register(self, cmd: Type[Command]) -> None:
self.commands[cmd.command] = cmd
|
8017
|
Train/png/8017.png
|
def value(self):
return self._ads.read(self._pin_setting, is_differential=self.is_differential)
|
3523
|
Train/png/3523.png
|
def _record(self, value, rank, delta, successor):
self._observations += 1
self._items += 1
return _Sample(value, rank, delta, successor)
|
209
|
Train/png/209.png
|
def log_configs(self):
for sec in self.config.sections():
LOG.debug(' %s: %s', sec, self.config.options(sec))
|
3176
|
Train/png/3176.png
|
def duration(self):
return max([x.comp_location + x.duration
for x in self.segments])
|
4841
|
Train/png/4841.png
|
def stop(self):
self.__stop = True
self._queue.stop()
self._zk.stop()
|
5759
|
Train/png/5759.png
|
def mosaic_info(name, pretty):
cl = clientv1()
echo_json_response(call_and_wrap(cl.get_mosaic_by_name, name), pretty)
|
8083
|
Train/png/8083.png
|
def load(self, filename):
f = open(filename, "rb")
d = pickle.load(f)
f.close()
self.__dict__.update(d)
|
4071
|
Train/png/4071.png
|
def node_mkdir(self, path=''):
'Does not raise any errors if dir already exists.'
return self(path, data=dict(kind='directory'), encode='json', method='put')
|
1901
|
Train/png/1901.png
|
def pool(self):
self._pool = self._pool or eventlet.GreenPool(size=self.pool_size)
return self._pool
|
7460
|
Train/png/7460.png
|
def identify(self, data):
return self.send(constants.IDENTIFY, json.dumps(data))
|
676
|
Train/png/676.png
|
def stop():
output, err = cli_syncthing_adapter.sys(exit=True)
click.echo("%s" % output, err=err)
|
4537
|
Train/png/4537.png
|
def LinSpace(start, stop, num):
return np.linspace(start, stop, num=num, dtype=np.float32),
|
4623
|
Train/png/4623.png
|
def get_play_info(self) -> PlayInfo:
info = await self.services["avContent"]["getPlayingContentInfo"]({})
return PlayInfo.make(**info.pop())
|
1102
|
Train/png/1102.png
|
def validate_file(parser, arg):
if not os.path.isfile(arg):
parser.error("%s is not a file." % arg)
return arg
|
698
|
Train/png/698.png
|
def df2unstack(df, coln='columns', idxn='index', col='value'):
return dmap2lin(df, idxn=idxn, coln=coln, colvalue_name=col)
|
8671
|
Train/png/8671.png
|
def flatten(self) -> bk.BKTensor:
N = self.qubit_nb
R = self.rank
return bk.reshape(self.tensor, [2**N]*R)
|
4388
|
Train/png/4388.png
|
def handle_job_and_work_save(self, sender, instance, **kwargs):
self.handle_save(instance.project.__class__, instance.project)
|
6643
|
Train/png/6643.png
|
def end(self):
for depth in xrange(len(self.names) - 1, -1, -1):
self.out_f.write('{0}}}\n'.format(self.prefix(depth)))
|
3457
|
Train/png/3457.png
|
def getfield(f):
if isinstance(f, list):
return [getfield(x) for x in f]
else:
return f.value
|
1582
|
Train/png/1582.png
|
def off(self, group):
asyncio.ensure_future(self._send_led_on_off_request(group, 0),
loop=self._loop)
|
9466
|
Train/png/9466.png
|
def commitWorkingCopy(self, configFile):
fn = self.function_table.commitWorkingCopy
result = fn(configFile)
return result
|
1872
|
Train/png/1872.png
|
def _dump(f, mesh):
dae = mesh_to_collada(mesh)
dae.write(f.name)
|
366
|
Train/png/366.png
|
def list(ctx):
wva = get_wva(ctx)
for subscription in wva.get_subscriptions():
print(subscription.short_name)
|
696
|
Train/png/696.png
|
def entropy(s):
return -sum(
p*np.log(p) for i in range(len(s)) for p in [prop(s[i], s)]
)
|
5804
|
Train/png/5804.png
|
def _set_scroll(self, *args):
self._canvas_scroll.xview(*args)
self._canvas_ticks.xview(*args)
|
628
|
Train/png/628.png
|
def get_due(self, estimated):
due = 0
due = round((estimated - datetime.utcnow()).seconds / 60)
return due
|
6789
|
Train/png/6789.png
|
def _set_line_eol(src, line):
line_ending = _get_eol(src) or os.linesep
return line.rstrip() + line_ending
|
785
|
Train/png/785.png
|
def _to_chimera(M, N, L, q):
"Converts a qubit's linear index to chimera coordinates."
return (q // N // L // 2, (q // L // 2) % N, (q // L) % 2, q % L)
|
584
|
Train/png/584.png
|
def password_link_expired(self, now=None):
if not now:
now = datetime.datetime.utcnow()
return self.password_link_expires < now
|
9620
|
Train/png/9620.png
|
def slice_is_normalized(s):
return (s.start is not None and s.stop is not None and s.step is not None and s.start <= s.stop)
|
1109
|
Train/png/1109.png
|
def set_kernel_options(cls, options: typing.Optional[str]):
await cls.set_config("kernel_opts", "" if options is None else options)
|
7661
|
Train/png/7661.png
|
def flatten(self):
ls = [self.output]
ls.extend(self.state)
return ls
|
6700
|
Train/png/6700.png
|
def set_data(self, data):
if data != self.editor.model.get_data():
self.editor.set_data(data)
self.editor.adjust_columns()
|
9778
|
Train/png/9778.png
|
def child(self, name):
return XMLElement(lib.lsl_child(self.e, str.encode(name)))
|
5219
|
Train/png/5219.png
|
def H12(self):
"Information measure of correlation 1."
maxima = np.vstack((self.hx, self.hy)).max(0)
return (self.H9() - self.hxy1) / maxima
|
2837
|
Train/png/2837.png
|
def lazily(self, name, callable, args):
self._lazy[name] = callable, args
self._all.add(name)
|
841
|
Train/png/841.png
|
def is_power_of_2(num):
log = math.log2(num)
return int(log) == float(log)
|
4876
|
Train/png/4876.png
|
def apply(self):
self._old_config = {k: v for k, v in _config.items()}
self._apply()
|
7832
|
Train/png/7832.png
|
def add_image_history(self, data):
self._ef['0th'][piexif.ImageIFD.ImageHistory] = json.dumps(data)
|
9929
|
Train/png/9929.png
|
def bind(self):
HTTPServer.__init__(self, (self.host, self.port), HTTPRequestHandler)
self.port = self.server_port
|
5671
|
Train/png/5671.png
|
def dependency(self, node1, node2):
"indicate that node1 depends on node2"
self.graph.add_node(node1)
self.graph.add_node(node2)
self.graph.add_edge(node2, node1)
|
9967
|
Train/png/9967.png
|
def stats_per100(self, kind='R', summary=False):
return self._get_stats_table('per_poss', kind=kind, summary=summary)
|
6903
|
Train/png/6903.png
|
def start(self):
if self._send_greenlet is None:
self._send_greenlet = gevent.spawn(self._send_loop)
|
1700
|
Train/png/1700.png
|
def names(self) -> [str]:
return sorted([name for name in self.axes_by_sname.keys() if name is not ''])
|
6095
|
Train/png/6095.png
|
def age(self):
if self.exists:
return datetime.utcnow() - datetime.utcfromtimestamp(os.path.getmtime(self.name))
return timedelta()
|
3107
|
Train/png/3107.png
|
def validate_url(cls, url: str) -> Optional[Match[str]]:
match = re.match(cls._VALID_URL, url)
return match
|
8999
|
Train/png/8999.png
|
def retrieve():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x1c) # 00011100
packet = a / b
return packet
|
3750
|
Train/png/3750.png
|
def chunks(iterable, chunk):
for i in range(0, len(iterable), chunk):
yield iterable[i:i + chunk]
|
6243
|
Train/png/6243.png
|
def to_int16(y1, y2):
x = (y1) | (y2 << 8)
if x >= 32768:
x = -(65536 - x)
return x
|
7310
|
Train/png/7310.png
|
def iter_leaf_names(self, is_leaf_fn=None):
for n in self.iter_leaves(is_leaf_fn=is_leaf_fn):
yield n.name
|
1743
|
Train/png/1743.png
|
def _submit(primitive, port_index, tuple_):
args = (_get_opc(primitive), port_index, tuple_)
_ec._submit(args)
|
9340
|
Train/png/9340.png
|
def var(self):
return self._constructor(self.values.var(axis=0, keepdims=True))
|
7071
|
Train/png/7071.png
|
def getHourTable(date, pos):
table = hourTable(date, pos)
return HourTable(table, date)
|
8411
|
Train/png/8411.png
|
def get_view_name(namespace, view):
name = ""
if namespace != "":
name = namespace + "_"
return sanitize(name + view.name)
|
977
|
Train/png/977.png
|
def put(self, key, value):
self.shardDatastore(key).put(key, value)
|
2206
|
Train/png/2206.png
|
def omit(self):
self._omit = self.lib.iperf_get_test_omit(self._test)
return self._omit
|
2481
|
Train/png/2481.png
|
def version(self, value):
self.bytearray[self._get_slicers(1)] = bytearray(c_uint8(value or 0))
|
1735
|
Train/png/1735.png
|
def match(self, context, line):
return line.kind == 'code' and line.partitioned[0] in self._both
|
3947
|
Train/png/3947.png
|
def shell(cmd, **kwargs):
logger.debug("$ %s", cmd)
return subprocess.check_output(cmd, shell=True, **kwargs)
|
1183
|
Train/png/1183.png
|
def do_file(self, filename):
with open(filename, "r") as infile:
self._run_cmd(infile.read())
|
8827
|
Train/png/8827.png
|
def del_label(self, name):
labels_tag = self.root[0]
labels_tag.remove(self._find_label(name))
|
5745
|
Train/png/5745.png
|
def _storeAppt(self, appt):
await self._hivedict.set(appt.iden, appt.pack())
|
4972
|
Train/png/4972.png
|
def finditer(self, string, *args, **kwargs):
return self._pattern.finditer(string, *args, **kwargs)
|
4277
|
Train/png/4277.png
|
def clean_query_Dict(cls, query_Dict):
return {k: v for k, v in query_Dict.items() if v}
|
711
|
Train/png/711.png
|
def toggleSelection(self, index, comp):
self.model.toggleSelection(index.row(), comp)
|
9128
|
Train/png/9128.png
|
def remove(self, name):
self.gui.removeAction(self._actions_dict[name].qaction)
del self._actions_dict[name]
delattr(self, name)
|
1970
|
Train/png/1970.png
|
def overlap(intv1, intv2):
return max(0, min(intv1[1], intv2[1]) - max(intv1[0], intv2[0]))
|
3441
|
Train/png/3441.png
|
def __send_command(self, command, args=[]):
self.ws.send(json.dumps({"op": command, "args": args}))
|
1838
|
Train/png/1838.png
|
def add_templatetype(templatetype, **kwargs):
type_i = _update_templatetype(templatetype)
db.DBSession.flush()
return type_i
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.