common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
6629
|
Train/png/6629.png
|
def get(self, key, transaction=None):
return self._client.get(key, transaction=transaction)
|
8930
|
Train/png/8930.png
|
def update(self, **kwargs):
self.inflate()
for model in self._models:
model.update(**kwargs)
return self
|
2871
|
Train/png/2871.png
|
def update_internal(self, value):
self.block()
self.set_widget_value(value)
self.unblock()
|
7659
|
Train/png/7659.png
|
def set_replay(self, sess, replay):
sess.run(self._set_replay, {self._set_replay_ph: replay})
|
3207
|
Train/png/3207.png
|
def flushIndexes(cls):
"drops all indexes for a class"
con = RabaConnection(cls._raba_namespace)
for idx in cls.getIndexes():
con.dropIndexByName(idx[1])
|
3552
|
Train/png/3552.png
|
def or_(self, first_qe, *qes):
self.__query_obj.or_(first_qe, *qes)
return self
|
4134
|
Train/png/4134.png
|
def update(self, *args, **kwargs):
for system in self.systems:
system.update(self, *args, **kwargs)
|
5108
|
Train/png/5108.png
|
def rcompose(*fs: Any) -> Callable:
return foldl1(lambda f, g: lambda *x: g(f(*x)), fs)
|
6782
|
Train/png/6782.png
|
def update_bundle(data_bundle_path, locale):
import rqalpha.utils.bundle_helper
rqalpha.utils.bundle_helper.update_bundle(data_bundle_path, locale)
|
6924
|
Train/png/6924.png
|
def find(cls, *args, **kwargs):
return list(cls.collection.find(*args, **kwargs))
|
5728
|
Train/png/5728.png
|
def remove(self, id):
p = Pool.get(int(id))
p.remove()
redirect(url(controller='pool', action='list'))
|
2812
|
Train/png/2812.png
|
def delete(self):
method = 'flickr.photosets.delete'
_dopost(method, auth=True, photoset_id=self.id)
return True
|
9219
|
Train/png/9219.png
|
def sendline(sock, msg, confidential=False):
log.debug('<- %r', ('<snip>' if confidential else msg))
sock.sendall(msg + b'\n')
|
3203
|
Train/png/3203.png
|
def render(self, form=None, **kwargs):
context = self.get_context(**kwargs)
return self.render_to_response(context)
|
248
|
Train/png/248.png
|
def get_free_params(self):
return odict([(key, param.value) for key, param in self.params.items() if param.free])
|
6951
|
Train/png/6951.png
|
def parents(self):
q = self.__parent__.parents()
q.put(self)
return q
|
6046
|
Train/png/6046.png
|
def remote_root(self):
return os.path.relpath(self.address.spec_path, self.target_base)
|
340
|
Train/png/340.png
|
def hour(self):
self.magnification = 3600
self._update(self.baseNumber, self.magnification)
return self
|
2099
|
Train/png/2099.png
|
def iflatten(L):
for sublist in L:
if hasattr(sublist, '__iter__'):
for item in iflatten(sublist):
yield item
else:
yield sublist
|
6109
|
Train/png/6109.png
|
def stderr_handler(self, line):
await self.queue.put(self.clean_bytes(b'[stderr] ' + line))
|
1037
|
Train/png/1037.png
|
def _volume(shape):
prod = 1
for start, stop in shape:
prod *= stop - start
return prod
|
4350
|
Train/png/4350.png
|
def delete(cls, id):
client = cls._new_api_client()
return client.make_request(cls, 'delete', url_params={'id': id})
|
8188
|
Train/png/8188.png
|
def verbosedump(value, fn, compress=None):
print('Saving "%s"... (%s)' % (fn, type(value)))
dump(value, fn, compress=compress)
|
3373
|
Train/png/3373.png
|
def sam_parse_reply(line):
parts = line.split(' ')
opts = {k: v for (k, v) in split_kv(parts[2:])}
return SAMReply(parts[0], opts)
|
8013
|
Train/png/8013.png
|
def shell(source=None, vars=None, server=None, port=None):
Wdb.get(server=server, port=port).shell(source=source, vars=vars)
|
8663
|
Train/png/8663.png
|
def sX(qubit: Qubit, coefficient: complex = 1.0) -> Pauli:
return Pauli.sigma(qubit, 'X', coefficient)
|
3979
|
Train/png/3979.png
|
def tar(self):
if not self.generated:
for data in self.generate():
pass
return self._tar_buffer.getvalue()
|
873
|
Train/png/873.png
|
def copy(self):
return _TimeAnchor(self.reading_id, self.uptime, self.utc, self.is_break, self.exact)
|
5517
|
Train/png/5517.png
|
def StringFinish(self, **_):
if self.state == "ARG":
return self.InsertArg(string=self.string)
|
3584
|
Train/png/3584.png
|
def viewport_to_screen_space(framebuffer_size: vec2, point: vec4) -> vec2:
return (framebuffer_size * point.xy) / point.w
|
291
|
Train/png/291.png
|
def _in(self, *lst):
self.terms.append('in (%s)' % ', '.join(['"%s"' % x for x in lst]))
return self
|
9913
|
Train/png/9913.png
|
def decodeMessage(self, data):
message = proto_pb2.Msg()
message.ParseFromString(data)
return message
|
8310
|
Train/png/8310.png
|
def key_to_metric(self, key):
return ''.join(l if l in string.letters else '_' for l in key)
|
4219
|
Train/png/4219.png
|
def remove_tag_all(self, resource_type, resource_id, **_params):
return self.delete(self.tags_path % (resource_type, resource_id))
|
451
|
Train/png/451.png
|
def available_streams():
sds = kp.db.StreamDS()
print("Available streams: ")
print(', '.join(sorted(sds.streams)))
|
1574
|
Train/png/1574.png
|
def ping(self):
msg = StandardSend(self._address, COMMAND_PING_0X0F_0X00)
self._send_msg(msg)
|
5351
|
Train/png/5351.png
|
def _to_key(d):
as_str = json.dumps(d, sort_keys=True)
return as_str.replace('"{{', '{{').replace('}}"', '}}')
|
1304
|
Train/png/1304.png
|
def graph_type(self, graph):
graph = self.pack(graph)
return self.sql('graph_type', graph).fetchone()[0]
|
5877
|
Train/png/5877.png
|
def xinfo_stream(self, stream):
fut = self.execute(b'XINFO', b'STREAM', stream)
return wait_make_dict(fut)
|
3714
|
Train/png/3714.png
|
def status(self):
if all(os.path.exists(p.path) for p in self.parts):
return 'splitted'
return False
|
1302
|
Train/png/1302.png
|
def have_graph(self, graph):
graph = self.pack(graph)
return bool(self.sql('graphs_named', graph).fetchone()[0])
|
9817
|
Train/png/9817.png
|
def min_max_normalize(F, floor=0.001):
F += -F.min() + floor
F = F / F.max(axis=0)
return F
|
542
|
Train/png/542.png
|
def verify_month(self, now):
return self.month == "*" or str(now.month) in self.month.split(" ")
|
887
|
Train/png/887.png
|
def generate(env):
for t in SCons.Tool.tool_list(env['PLATFORM'], env):
SCons.Tool.Tool(t)(env)
|
6260
|
Train/png/6260.png
|
def set_x(self, x):
"Set x position"
if (x >= 0):
self.x = x
else:
self.x = self.w+x
|
4138
|
Train/png/4138.png
|
def prepare_request(self, *args, **kw):
self.http_request = self.request_class(self.path, *args, **kw)
|
737
|
Train/png/737.png
|
def mouseReleaseEvent(self, event):
super(AbstractDragView, self).mouseReleaseEvent(event)
self.dragStartPosition = None
|
5164
|
Train/png/5164.png
|
def attach(self):
s = self._sensor
self.update(s, s.read())
self._sensor.attach(self)
|
7731
|
Train/png/7731.png
|
def reset(self):
self.L4.reset()
for module in self.L6aModules:
module.reset()
|
2909
|
Train/png/2909.png
|
def _hline_bokeh_(self, col):
c = hv.HLine(self.df[col].mean())
return c
|
5283
|
Train/png/5283.png
|
def serve_forever(self):
loop = True
while loop:
loop = self.__serve_forever()
self.end()
|
185
|
Train/png/185.png
|
def damping(self):
try:
value = self._damping.value
except AttributeError:
value = self._damping
return value
|
3134
|
Train/png/3134.png
|
def param_dict_to_list(dict, skeys=None):
# sort keys
RV = SP.concatenate([dict[key].flatten() for key in skeys])
return RV
pass
|
7560
|
Train/png/7560.png
|
def uuid(self):
self.open()
uuid = lvm_vg_get_uuid(self.handle)
self.close()
return uuid
|
6126
|
Train/png/6126.png
|
def visit_set(self, node):
return "{%s}" % ", ".join(child.accept(self) for child in node.elts)
|
5750
|
Train/png/5750.png
|
def dupstack(newtask):
stack = s_task.varget('provstack')
s_task.varset('provstack', stack.copy(), newtask)
|
2559
|
Train/png/2559.png
|
def add_text(self, text, x, y, **kws):
self.panel.add_text(text, x, y, **kws)
|
9043
|
Train/png/9043.png
|
def getNumberTLD():
total = 0
for typeTld in TLD.keys():
total += len(TLD[typeTld])
return total
|
2036
|
Train/png/2036.png
|
def _uriPrefix(element):
i = element.tag.find('}')
if i < 0:
return ""
return element.tag[:i+1]
|
6366
|
Train/png/6366.png
|
def shape(self):
return tuple(len(self._get_axis(a)) for a in self._AXIS_ORDERS)
|
8992
|
Train/png/8992.png
|
def connectAcknowledge():
a = TpPd(pd=0x3)
b = MessageType(mesType=0xf) # 00001111
packet = a / b
return packet
|
9318
|
Train/png/9318.png
|
def version():
from topydo.lib.Version import VERSION, LICENSE
print("topydo {}\n".format(VERSION))
print(LICENSE)
sys.exit(0)
|
1226
|
Train/png/1226.png
|
def unique(iterable):
seen = set()
for item in iterable:
if item not in seen:
seen.add(item)
yield item
|
6117
|
Train/png/6117.png
|
def visit_arg(self, node, parent):
return self.visit_assignname(node, parent, node.arg)
|
4656
|
Train/png/4656.png
|
def allocate(n, dtype=numpy.float32):
return drv.pagelocked_empty(int(n), dtype, order='C', mem_flags=drv.host_alloc_flags.PORTABLE)
|
7081
|
Train/png/7081.png
|
def debug(self, msg, indent=0, **kwargs):
return self.logger.debug(self._indent(msg, indent), **kwargs)
|
4624
|
Train/png/4624.png
|
def delete_group_memory(self, memory_id):
act = self.service.action("X_DeleteGroupMemory")
res = await act.async_call(MemoryID=memory_id)
|
4055
|
Train/png/4055.png
|
def e(msg, *args, **kwargs):
return logging.log(ERROR, msg, *args, **kwargs)
|
2386
|
Train/png/2386.png
|
def standardize():
def f(G, bim):
G_out = standardize_snps(G)
return G_out, bim
return f
|
2571
|
Train/png/2571.png
|
def join(self, glue=" "):
j = glue.join([str(x) for x in self.obj])
return self._wrap(j)
|
3096
|
Train/png/3096.png
|
def rm(self, index):
if self.model.exists(index):
self.model.remove(index)
|
9993
|
Train/png/9993.png
|
def _put_stream(self, stream):
self._out('stream')
self._out(stream)
self._out('endstream')
|
8813
|
Train/png/8813.png
|
def visit_BoolOp(self, node):
return sum((self.visit(value) for value in node.values), [])
|
1636
|
Train/png/1636.png
|
def as_percent(self, value):
new_vec = self.copy()
new_vec.length = value * self.length
return new_vec
|
2016
|
Train/png/2016.png
|
def render_children(node: Node, **child_args):
for xml_node in node.xml_node.children:
child = render(xml_node, **child_args)
node.add_child(child)
|
6832
|
Train/png/6832.png
|
def unpackage(package_):
return salt.utils.msgpack.loads(package_, use_list=True,
_msgpack_module=msgpack)
|
4328
|
Train/png/4328.png
|
def _basic_field_data(field, obj):
value = field.value_from_object(obj)
return {Field.TYPE: FieldType.VAL, Field.VALUE: value}
|
6226
|
Train/png/6226.png
|
def glr_path_static():
return os.path.abspath(os.path.join(os.path.dirname(__file__), '_static'))
|
2711
|
Train/png/2711.png
|
def _get_enabled():
providers = Provider.objects.all()
return [p for p in providers if p.enabled()]
|
7897
|
Train/png/7897.png
|
def find(im_source, im_search):
r = find_all(im_source, im_search, maxcnt=1)
return r[0] if r else None
|
7612
|
Train/png/7612.png
|
def dump(env, form):
for var, value in env.items():
log(env, var+"="+value)
for key in form:
log(env, str(formvalue(form, key)))
|
4174
|
Train/png/4174.png
|
def show_floatingip(self, floatingip, **_params):
return self.get(self.floatingip_path % (floatingip), params=_params)
|
4341
|
Train/png/4341.png
|
def transform_specialfield(jsonify, f, v):
"helper for serialize_row"
raw = f.ser(v) if is_serdes(f) else v
return ujson.dumps(raw) if not isinstance(f, basestring) and jsonify else raw
|
389
|
Train/png/389.png
|
def deleteWebhook(self, hook_id):
path = '/'.join(['notification', 'webhook', hook_id])
return self.rachio.delete(path)
|
3161
|
Train/png/3161.png
|
def encode(self, value):
value = self.serialize(value)
if self.encoding:
value = value.encode(self.encoding)
return value
|
10024
|
Train/png/10024.png
|
def param_num(self, param, n):
param.pair = (int(self.value(n)), int)
return True
|
4561
|
Train/png/4561.png
|
def SegmentProd(a, ids):
def func(idxs): return reduce(np.multiply, a[idxs])
return seg_map(func, a, ids),
|
4257
|
Train/png/4257.png
|
def remove(self, line):
nb = 0
for block in self.blocks:
nb += block.remove(line)
return nb
|
7711
|
Train/png/7711.png
|
def gen_or(src1, src2, dst):
assert src1.size == src2.size
return ReilBuilder.build(ReilMnemonic.OR, src1, src2, dst)
|
9241
|
Train/png/9241.png
|
def safe_pow(base, exp):
if exp > MAX_EXPONENT:
raise RuntimeError(
"Invalid exponent, max exponent is {}".format(MAX_EXPONENT))
return base ** exp
|
7546
|
Train/png/7546.png
|
def assert_in(obj, seq, message=None, extra=None):
assert obj in seq, _assert_fail_message(
message, obj, seq, "is not in", extra)
|
4295
|
Train/png/4295.png
|
def cascade_delete(self, name):
"this fails under diamond inheritance"
for child in self[name].child_tables:
self.cascade_delete(child.name)
del self[name]
|
9748
|
Train/png/9748.png
|
def num_extra_bytes(self):
return sum(np.dtype(extra_dim[1]).itemsize for extra_dim in self.extra_dims)
|
7725
|
Train/png/7725.png
|
def contains(self, location):
return self.almostEqual(
sum([coord ** 2 for coord in location]), self.radius ** 2
)
|
8217
|
Train/png/8217.png
|
def cli(ctx):
utils.check_update(ctx, forced=True)
click.secho("Keep is at its latest version v{}".format(
about.__version__), fg='green')
|
1361
|
Train/png/1361.png
|
def prox_zero(X, step):
return np.zeros(X.shape, dtype=X.dtype)
|
8971
|
Train/png/8971.png
|
def new():
dir_path = os.path.dirname(os.path.realpath(__file__))
cookiecutter(os.path.join(dir_path, 'historical-cookiecutter/'))
|
8639
|
Train/png/8639.png
|
def get_item(self, sequence_id, position):
return self.from_record(self.get_record(sequence_id, position))
|
1544
|
Train/png/1544.png
|
def DataPath():
return os.path.abspath('%s/data' % (os.path.dirname(
os.path.realpath(__file__))))
|
5535
|
Train/png/5535.png
|
def Escape(self, string="", **_):
# Translate special escapes:
self.stack[-1] += self.STRING_ESCAPES.get(string, string)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.