common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
315
|
Train/png/315.png
|
def submit_by_selector(self, selector):
elem = find_element_by_jquery(world.browser, selector)
elem.submit()
|
4534
|
Train/png/4534.png
|
def write_json_to_file(self, net_type, filename, indent='no-indent'):
export_data.write_json_to_file(self, net_type, filename, indent)
|
9214
|
Train/png/9214.png
|
def run(self, order=None):
for event in self.runner.run(order=order):
self.receive(event)
|
9321
|
Train/png/9321.png
|
def stop(ctx, **kwargs):
update_context(ctx, kwargs)
daemon = mk_daemon(ctx)
daemon.stop()
|
9093
|
Train/png/9093.png
|
def set_up_logging():
tf.logging.set_verbosity(tf.logging.INFO)
logging.getLogger('tensorflow').propagate = False
|
2847
|
Train/png/2847.png
|
def add(cls, name, value):
attr = cls(value)
attr._name = name
setattr(cls, name, attr)
|
5625
|
Train/png/5625.png
|
def volume(self) -> float:
m = self._matrix
return float(abs(dot(np.cross(m[0], m[1]), m[2])))
|
6952
|
Train/png/6952.png
|
def com(self):
return (self.coordinates*self.masses.reshape((-1, 1))).sum(axis=0)/self.mass
|
2078
|
Train/png/2078.png
|
def find(self, string, default=None):
return self.match(string) or self.search(string) or default
|
8147
|
Train/png/8147.png
|
def sign(key, qs):
sig = derive_signature(key, qs)
return "%s&%s" % (qs, urlencode([("sig", sig)]))
|
932
|
Train/png/932.png
|
def Y_dist(self, new_y_distance):
self.parent.value('y_distance', new_y_distance)
self.parent.traces.display()
|
9068
|
Train/png/9068.png
|
def save(self, f):
return pickle.dump((self.perceptron.weights, self.tagdict, self.classes, self.clusters), f, protocol=pickle.HIGHEST_PROTOCOL)
|
2941
|
Train/png/2941.png
|
def title(self, txt):
num = len(txt)
ticks = "=" * num
print(ticks)
print(txt)
print(ticks)
|
9425
|
Train/png/9425.png
|
def get_migration(plugin, filename):
db = get_db()
return db.migrations.find_one({'plugin': plugin, 'filename': filename})
|
5586
|
Train/png/5586.png
|
def pseudo_core_density(self):
mesh, values, attrib = self._parse_radfunc("pseudo_core_density")
return RadialFunction(mesh, values)
|
6282
|
Train/png/6282.png
|
def _lincomb(self, a, x1, b, x2, out):
self.tspace._lincomb(a, x1.tensor, b, x2.tensor, out.tensor)
|
1383
|
Train/png/1383.png
|
def add_callback(self, callback: _Callable, *args, **kwargs) -> None:
self.loop.add_callback(callback, *args, **kwargs)
|
1819
|
Train/png/1819.png
|
def save(yaml_dict, filepath):
yamldict.dump(yaml_dict, open(filepath, 'w'), default_flow_style=False)
|
9960
|
Train/png/9960.png
|
def unload(self):
if self._handle != -1:
lib.UnloadSound(self._handle)
self._handle = -1
|
5213
|
Train/png/5213.png
|
def init1(self, dae):
self.v0 = matrix(dae.y[self.v])
|
1485
|
Train/png/1485.png
|
def deprecate(message):
warnings.simplefilter('default')
warnings.warn(message, category=DeprecationWarning)
warnings.resetwarnings()
|
1012
|
Train/png/1012.png
|
def run(self, *args):
uuid, kwargs = self.__parse_arguments(*args)
code = self.edit_profile(uuid, **kwargs)
return code
|
7204
|
Train/png/7204.png
|
def addCallSetFromName(self, sampleName):
callSet = CallSet(self, sampleName)
self.addCallSet(callSet)
|
9920
|
Train/png/9920.png
|
def subscribe(self, stream, callback, transform=""):
return self.ws.subscribe(stream, callback, transform)
|
1502
|
Train/png/1502.png
|
def data(cls, cube, weighted, prune):
return cls()._data(cube, weighted, prune)
|
2681
|
Train/png/2681.png
|
def hashdict(d):
k = 0
for key, val in d.items():
k ^= hash(key) ^ hash(val)
return k
|
8817
|
Train/png/8817.png
|
def visit_Name(self, node):
return self.add(node, self.result[node.id])
|
5514
|
Train/png/5514.png
|
def ProcessMessage(self, message):
self.ProcessResponse(message.source.Basename(), message.payload)
|
2119
|
Train/png/2119.png
|
def perform_create(self, serializer):
if serializer.instance is None:
serializer.save(user=self.request.user)
|
3742
|
Train/png/3742.png
|
def remove_user(self, name):
user = self.get_user(name)
users = self.get_users()
users.remove(user)
|
9648
|
Train/png/9648.png
|
def _attach(self, instruction, qargs, cargs):
self.append(instruction, qargs, cargs)
|
5258
|
Train/png/5258.png
|
def put_cache(self, minions):
self.cupd_out.send(self.serial.dumps(minions))
|
6048
|
Train/png/6048.png
|
def all():
return [goal for _, goal in sorted(Goal._goal_by_name.items()) if goal.active]
|
6227
|
Train/png/6227.png
|
def get_md5sum(src_file):
with open(src_file, 'rb') as src_data:
src_content = src_data.read()
return hashlib.md5(src_content).hexdigest()
|
8235
|
Train/png/8235.png
|
def plot(self):
import matplotlib.pyplot as plt
plt.plot(self.E)
plt.show()
|
1592
|
Train/png/1592.png
|
def unblock_events(self):
self._widget.blockSignals(False)
self._widget.setUpdatesEnabled(True)
|
8664
|
Train/png/8664.png
|
def sY(qubit: Qubit, coefficient: complex = 1.0) -> Pauli:
return Pauli.sigma(qubit, 'Y', coefficient)
|
8553
|
Train/png/8553.png
|
def kill(self, sig):
if self.is_alive() and self._loop:
self._loop.call_soon_threadsafe(self._loop.stop)
|
9353
|
Train/png/9353.png
|
def msg(self, msg):
hookenv.log('coordinator.{} {}'.format(self._name(), msg),
level=hookenv.INFO)
|
6468
|
Train/png/6468.png
|
def combination(n, r):
if n == r or r == 0:
return 1
else:
return combination(n-1, r-1) + combination(n-1, r)
|
8472
|
Train/png/8472.png
|
def get_date_yyyymmdd(yyyymmdd):
return date(int(yyyymmdd[:4]), int(yyyymmdd[4:6], base=10), int(yyyymmdd[6:], base=10))
|
9997
|
Train/png/9997.png
|
def xpat(self, header, id_range, *pattern):
return [x for x in self.xpat_gen(header, id_range, *pattern)]
|
8366
|
Train/png/8366.png
|
def survival(value=t, lam=lam, f=failure):
return sum(f * log(lam) - lam * value)
|
4013
|
Train/png/4013.png
|
def integerize(self):
self.x = int(round(self.x))
self.y = int(round(self.y))
|
7663
|
Train/png/7663.png
|
def all(self, data={}, **kwargs):
return super(Refund, self).all(data, **kwargs)
|
9004
|
Train/png/9004.png
|
def stopDtmfAcknowledge():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x32) # 00110010
packet = a / b
return packet
|
4017
|
Train/png/4017.png
|
def IsAFault(self):
e = self.body_root
if not e:
return 0
return e.namespaceURI == SOAP.ENV and e.localName == 'Fault'
|
802
|
Train/png/802.png
|
def build_blast_cmd(self, fname, dbname):
return self.funcs.blastn_func(fname, dbname, self.outdir, self.exes.blast_exe)
|
4848
|
Train/png/4848.png
|
def get(cls, parent, url_id):
return cls.query.filter_by(parent=parent, url_id=url_id).one_or_none()
|
5886
|
Train/png/5886.png
|
def srem(self, key, member, *members):
return self.execute(b'SREM', key, member, *members)
|
3999
|
Train/png/3999.png
|
def write(self, *args):
for s in args:
self.out.write(s)
event = ''.join(*args)
|
3409
|
Train/png/3409.png
|
def finalize(self, sched):
super(AddCoro, self).finalize(sched)
return self.result
|
9178
|
Train/png/9178.png
|
def sample_function(self, f, N):
x = self.interpolation_points(N+1)
return f(x)
|
8484
|
Train/png/8484.png
|
def get_chr2idx(self):
return {chr(ascii_int): idx for idx, ascii_int in enumerate(self.all_chrints)}
|
4271
|
Train/png/4271.png
|
def _parse_body(self, body):
if is_python3():
return json.loads(body.decode('UTF-8'))
else:
return json.loads(body)
|
10102
|
Train/png/10102.png
|
def debug_src(src, pm=False, globs=None):
testsrc = script_from_examples(src)
debug_script(testsrc, pm, globs)
|
645
|
Train/png/645.png
|
def cmd(send, _, args):
send("%s! %s" % (args['name'].upper(), random.choice(squirrels)))
|
6397
|
Train/png/6397.png
|
def reset(self):
"Reset the internal memory."
self.hidden = [next(self.parameters()).data.new(0)
for i in range(self.n_layers+1)]
|
246
|
Train/png/246.png
|
def set_params(self, **kwargs):
for key, value in list(kwargs.items()):
setattr(self, key, value)
|
3167
|
Train/png/3167.png
|
def nvlist_to_dict(nvlist):
result = {}
for item in nvlist:
result[item.name] = item.value.value()
return result
|
2043
|
Train/png/2043.png
|
def _perform_write(self, addr, data):
return self._machine_controller.write(addr, data, self._x, self._y, 0)
|
57
|
Train/png/57.png
|
def state_pop(self):
super(Composite, self).state_pop()
for gen in self.generators:
gen.state_pop()
|
7797
|
Train/png/7797.png
|
def access(self, req, ino, mask):
self.reply_err(req, errno.ENOSYS)
|
1148
|
Train/png/1148.png
|
def count_annotations(self) -> int:
return self.session.query(Namespace).filter(Namespace.is_annotation).count()
|
9952
|
Train/png/9952.png
|
def print(self, msg, *args, **kwargs):
if self.verbosity >= 1:
print(msg, *args, **kwargs)
|
5576
|
Train/png/5576.png
|
def deps_status(self):
if not self.deps:
return [self.S_OK]
return [d.status for d in self.deps]
|
1180
|
Train/png/1180.png
|
def complete_opt_format(self, text, *_):
return [t + " " for t in FORMATTERS if t.startswith(text)]
|
2019
|
Train/png/2019.png
|
def new(self, node: Node):
return Property(self.name, self._setter, node)
|
3063
|
Train/png/3063.png
|
def semiyearly(date=datetime.date.today()):
return datetime.date(date.year, 1 if date.month < 7 else 7, 1)
|
6798
|
Train/png/6798.png
|
def _list_keys(user=None, gnupghome=None, secret=False):
gpg = _create_gpg(user, gnupghome)
_keys = gpg.list_keys(secret)
return _keys
|
6460
|
Train/png/6460.png
|
def create_web_element(self, element_id):
return self._web_element_cls(self, element_id, w3c=self.w3c)
|
7894
|
Train/png/7894.png
|
def _join(lst, key, sep=";"):
return sep.join([d[key] for d in lst if d[key]])
|
1340
|
Train/png/1340.png
|
def remove(image):
path = os.path.join(IMG_DIR, image)
if os.path.isfile(path):
os.remove(path)
|
192
|
Train/png/192.png
|
def _create_h(x):
h = np.zeros_like(x)
h[:-1] = x[1:] - x[:-1]
# border
h[-1] = h[-2]
return h
|
5661
|
Train/png/5661.png
|
def get_X_gradients(self, X):
return X.mean.gradient, X.variance.gradient, X.binary_prob.gradient
|
7104
|
Train/png/7104.png
|
def _clean(c):
if isdir(c.sphinx.target):
rmtree(c.sphinx.target)
|
3569
|
Train/png/3569.png
|
def warning(self, message, *args, **kwargs):
self.system.warning(message, *args, **kwargs)
|
7705
|
Train/png/7705.png
|
def gen_sub(src1, src2, dst):
assert src1.size == src2.size
return ReilBuilder.build(ReilMnemonic.SUB, src1, src2, dst)
|
2735
|
Train/png/2735.png
|
def to_snake_case(s):
return re.sub('([^_A-Z])([A-Z])', lambda m: m.group(1) + '_' + m.group(2).lower(), s)
|
4093
|
Train/png/4093.png
|
def reset(self):
self.metadata.drop_all(self.engine)
self.metadata.create_all(self.engine)
|
5529
|
Train/png/5529.png
|
def ExtendAnomalies(self, other):
for o in other:
if o is not None:
self.anomaly.Extend(list(o.anomaly))
|
1471
|
Train/png/1471.png
|
def _compute_mean(map1, map2):
data = (map1.data + map2.data) / 2.
return HpxMap(data, map1.hpx)
|
8384
|
Train/png/8384.png
|
def rnoncentral_t(mu, lam, nu, size=None):
tau = rgamma(nu / 2., nu / (2. * lam), size)
return rnormal(mu, tau)
|
6847
|
Train/png/6847.png
|
def _request_devices(self, url, _type):
res = self._request(url)
return res.get(_type) if res else {}
|
7220
|
Train/png/7220.png
|
def all(self, query=None, **kwargs):
return super(OrganizationsProxy, self).all(query=query)
|
6239
|
Train/png/6239.png
|
def is_dental(c, lang):
o = get_offset(c, lang)
return (o >= DENTAL_RANGE[0] and o <= DENTAL_RANGE[1])
|
3251
|
Train/png/3251.png
|
def warning(msg, *args, **kwargs):
msg = '{0} {1}'.format(yellow(WARNING), msg)
echo(msg, *args, **kwargs)
|
6125
|
Train/png/6125.png
|
def visit_list(self, node):
return "[%s]" % ", ".join(child.accept(self) for child in node.elts)
|
3745
|
Train/png/3745.png
|
def can_undo(self):
return bool(self._undo) or bool(self._open and self._open[0])
|
845
|
Train/png/845.png
|
def bin(self, s):
return str(s) if s <= 1 else bin(s >> 1) + str(s & 1)
|
4075
|
Train/png/4075.png
|
def value_to_string(self, obj):
value = getattr(obj, self.attname)
return self.get_prep_value(value)
|
3572
|
Train/png/3572.png
|
def wrap(self, value):
self.validate_wrap(value)
return self.type.wrap(value)
|
8682
|
Train/png/8682.png
|
def kill_job(self, job_id):
self._loop.call_soon_threadsafe(
asyncio.ensure_future, self._simple_send(ClientKillJob(job_id)))
|
9638
|
Train/png/9638.png
|
def u_base(self, theta, phi, lam, q):
return self.append(UBase(theta, phi, lam), [q], [])
|
859
|
Train/png/859.png
|
def repeat(self, repeat):
shuffle = self.shuffle
self.play_mode = PLAY_MODE_BY_MEANING[(shuffle, repeat)]
|
8893
|
Train/png/8893.png
|
def cli(env, account_id, origin_id):
manager = SoftLayer.CDNManager(env.client)
manager.remove_origin(account_id, origin_id)
|
4889
|
Train/png/4889.png
|
def reset(self):
self.prevframe = None
self.wasmoving = False
self.t0 = 0
self.ismoving = False
|
4993
|
Train/png/4993.png
|
def create_add_on(self, add_on):
url = urljoin(self._url, '/add_ons')
return add_on.post(url)
|
725
|
Train/png/725.png
|
def set_nr_track(self, nr_track):
self._set_attr(TRCK(encoding=3, text=str(nr_track)))
|
4246
|
Train/png/4246.png
|
def generate_dumper(self, mapfile, names):
return self.build_template(mapfile, names, self._dumpdata_template)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.