common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
1025
|
Train/png/1025.png
|
def _bdd(node):
try:
bdd = _BDDS[node]
except KeyError:
bdd = _BDDS[node] = BinaryDecisionDiagram(node)
return bdd
|
2873
|
Train/png/2873.png
|
def delete(args):
m = TemplateManager(args.hosts)
m.delete(args.name)
|
7419
|
Train/png/7419.png
|
def read_string(buff, byteorder='big'):
length = read_numeric(USHORT, buff, byteorder)
return buff.read(length).decode('utf-8')
|
5261
|
Train/png/5261.png
|
def suspend(self, instance_id):
nt_ks = self.compute_conn
response = nt_ks.servers.suspend(instance_id)
return True
|
5505
|
Train/png/5505.png
|
def Flush(self):
while self._age:
node = self._age.PopLeft()
self.KillObject(node.data)
self._hash = dict()
|
8400
|
Train/png/8400.png
|
def xyzlabel(labelx, labely, labelz):
xlabel(labelx)
ylabel(labely)
zlabel(labelz)
|
5958
|
Train/png/5958.png
|
def BinaryOperator(self, string=None, **unused_kwargs):
self.stack.append(self.binary_expression_cls(string))
|
1960
|
Train/png/1960.png
|
def all(self, msg, *args, **kwargs):
self.multi(ALL, msg, args, **kwargs)
|
4430
|
Train/png/4430.png
|
def sdiff(self, keys, *args):
def func(left, right): return left.difference(right)
return self._apply_to_sets(func, "SDIFF", keys, *args)
|
6103
|
Train/png/6103.png
|
def close(self):
if self.device:
usb.util.dispose_resources(self.device)
self.device = None
|
5015
|
Train/png/5015.png
|
def MakeProbs(self):
for hypo, odds in self.Items():
self.Set(hypo, Probability(odds))
|
8599
|
Train/png/8599.png
|
def copy(self):
other = Version(None)
other.tokens = self.tokens[:]
other.seps = self.seps[:]
return other
|
3780
|
Train/png/3780.png
|
def get(obj: JsonObj, item: str, default: JsonObjTypes = None) -> JsonObjTypes:
return obj._get(item, default)
|
7367
|
Train/png/7367.png
|
def pass_q_v1(self):
sta = self.sequences.states.fastaccess
out = self.sequences.outlets.fastaccess
out.q[0] += sta.qa
|
2416
|
Train/png/2416.png
|
def schedule(self, job, when):
pjob = pickle.dumps(job)
self._redis.zadd('ss:scheduled', when, pjob)
|
804
|
Train/png/804.png
|
def header_footer_exists(filepath):
with open(filepath) as f:
return re.search(Utils.exp, f.read())
|
2230
|
Train/png/2230.png
|
def check(ctx, repository, config):
ctx.obj = Repo(repository=repository, config=config)
|
6506
|
Train/png/6506.png
|
def forward(self, is_train=False):
for texec in self.train_execs:
texec.forward(is_train=is_train)
|
7883
|
Train/png/7883.png
|
def SVD(stream_list, full=False):
warnings.warn('Depreciated, use svd instead.')
return svd(stream_list=stream_list, full=full)
|
8326
|
Train/png/8326.png
|
def points_to_double(self):
if self.points.dtype != np.double:
self.points = self.points.astype(np.double)
|
8156
|
Train/png/8156.png
|
def constant_time_cmp(a, b):
result = True
for x, y in zip(a, b):
result &= (x == y)
return result
|
2843
|
Train/png/2843.png
|
def device_uuid(self):
if self._device:
return self._device
return GEN_ID_FORMAT.format(self.src_ip)
|
4062
|
Train/png/4062.png
|
def _value_from_label(self, label):
unser_val = (label.rel_strength.value, label.meta)
return cbor.dumps(unser_val)
|
8728
|
Train/png/8728.png
|
def complete_serial_ports(self, text):
ports = mavutil.auto_detect_serial(preferred_list=preferred_ports)
return [p.device for p in ports]
|
3479
|
Train/png/3479.png
|
def convert(self, layer=2, split_sign='_', *args, **kwargs):
return series2df(self.series, *args, **kwargs)
|
9472
|
Train/png/9472.png
|
def reset(self):
_eval_script(self._client, RESET, self._name, self._signal)
self._delete_signal()
|
327
|
Train/png/327.png
|
def p_debug(self, message):
"Format and print debug messages"
print("{}{} `{}`".format(self._debug_indent * " ",
message, repr(self.p_suffix(10))))
|
8625
|
Train/png/8625.png
|
def _stab_log_data(self, timestamp, data, logconf):
print('[%d][%s]: %s' % (timestamp, logconf.name, data))
|
8479
|
Train/png/8479.png
|
def write_dag(self, out=sys.stdout):
for rec in sorted(self.values()):
print(rec, file=out)
|
7292
|
Train/png/7292.png
|
def reset(self):
from samplerate.lowlevel import src_reset
if self._state is None:
self._create()
src_reset(self._state)
|
1154
|
Train/png/1154.png
|
def get_edge_evidence(self, u: BaseEntity, v: BaseEntity, key: str) -> Optional[str]:
return self._get_edge_attr(u, v, key, EVIDENCE)
|
6057
|
Train/png/6057.png
|
def open_http(self, url, data=None):
return self._open_generic_http(http_client.HTTPConnection, url, data)
|
4755
|
Train/png/4755.png
|
def filter(select, iterable, namespaces=None, flags=0, **kwargs): # noqa: A001
return compile(select, namespaces, flags, **kwargs).filter(iterable)
|
8130
|
Train/png/8130.png
|
def unmatch(self):
key = '%s/unmatch' % self.key
return self._server.query(key, method=self._server._session.put)
|
8516
|
Train/png/8516.png
|
def clean(self, *args, **kwargs):
for key in list(self.store.keys()):
self.unset(key)
|
1669
|
Train/png/1669.png
|
def compute(self):
self.smooth_result, self.cross_validated_residual = run_friedman_smooth(
self.x, self.y, self._span
)
|
9145
|
Train/png/9145.png
|
def add_to_js(self, name, var):
frame = self.page().mainFrame()
frame.addToJavaScriptWindowObject(name, var)
|
4310
|
Train/png/4310.png
|
def mutations(self, nbr, strength):
for i in range(nbr):
self.mutation(strength)
|
328
|
Train/png/328.png
|
def bulk_delete(handler, request):
ids = request.GET.getall('ids')
Message.delete().where(Message.id << ids).execute()
raise muffin.HTTPFound(handler.url)
|
7650
|
Train/png/7650.png
|
def writefile(openedfile, newcontents):
openedfile.seek(0)
openedfile.truncate()
openedfile.write(newcontents)
|
9047
|
Train/png/9047.png
|
def get_content(self, offset, size):
return _bfd.section_get_content(self.bfd, self._ptr, offset, size)
|
109
|
Train/png/109.png
|
def fetch_closed_orders(self, limit: int) -> List[Order]:
return self._fetch_orders_limit(self._closed_orders, limit)
|
4596
|
Train/png/4596.png
|
def lorem(anon, obj, field, val):
return ' '.join(anon.faker.sentences(field=field))
|
2667
|
Train/png/2667.png
|
def is_snv(self):
return len(self.REF) == 1 and all(a.type == "SNV" for a in self.ALT)
|
5995
|
Train/png/5995.png
|
def dispatch(self, *args, **kwargs):
return super(EntryTrackback, self).dispatch(*args, **kwargs)
|
1027
|
Train/png/1027.png
|
def _names(lexer):
first = _expect_token(lexer, {NameToken}).value
rest = _zom_name(lexer)
rnames = (first, ) + rest
return rnames[::-1]
|
3861
|
Train/png/3861.png
|
def publishToMyself(self, roomId, name, data):
self.publishToRoom(roomId, name, data, [self])
|
5192
|
Train/png/5192.png
|
def match(self, pattern):
m = pattern.match(self._string, self._index)
if m:
self._index = m.end()
return m
|
7906
|
Train/png/7906.png
|
def step(self, x):
r
return x - self.coeff_A * self.gradient(x) \
+ self.coeff_B * np.random.normal(size=self.dim)
|
4557
|
Train/png/4557.png
|
def Mean(a, axis, keep_dims):
return np.mean(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis),
keepdims=keep_dims),
|
5925
|
Train/png/5925.png
|
def to_dict(self):
as_dict = dict(self.payload or ())
as_dict['message'] = self.message
return as_dict
|
9899
|
Train/png/9899.png
|
def get_subclasses(c):
subclasses = c.__subclasses__()
for d in list(subclasses):
subclasses.extend(get_subclasses(d))
return subclasses
|
7888
|
Train/png/7888.png
|
def inode(self):
if self._inode is None:
self.stat(follow_symlinks=False)
return self._inode
|
4340
|
Train/png/4340.png
|
def redirect(self, url):
url = '{}/view'.format(url)
return self.request.response.redirect(url)
|
5282
|
Train/png/5282.png
|
def history_json(self, nb=0):
return [(i[0].isoformat(), i[1]) for i in self._history[-nb:]]
|
921
|
Train/png/921.png
|
def version():
import pkg_resources
version = pkg_resources.require(PROJECT_NAME)[0].version
floyd_logger.info(version)
|
4106
|
Train/png/4106.png
|
def add_keyup(self, actions, **kwargs):
return self.add_handler(pygame.KEYUP, actions, **kwargs)
|
2775
|
Train/png/2775.png
|
def set_oauth_client(self, consumer_key, consumer_secret):
self.oauth_client = oauth1.Client(consumer_key, consumer_secret)
|
65
|
Train/png/65.png
|
def reload(self):
self._source = self._fetch_secrets(
self._vault_url, self._path, self._token)
|
1165
|
Train/png/1165.png
|
def post(graph: BELGraph, host: str):
resp = to_web(graph, host=host)
resp.raise_for_status()
|
6893
|
Train/png/6893.png
|
def issuperset(self, other):
self._binary_sanity_check(other)
return set.issuperset(self, other)
|
1655
|
Train/png/1655.png
|
def update_iscsi_settings(self, iscsi_data):
self._conn.patch(self.path, data=iscsi_data)
|
3811
|
Train/png/3811.png
|
def append_value(dictionary, key, item):
items = dictionary.get(key, [])
items.append(item)
dictionary[key] = items
|
2816
|
Train/png/2816.png
|
def xread(file, length):
"Read exactly length bytes from file; raise EOFError if file ends sooner."
data = file.read(length)
if len(data) != length:
raise EOFError
return data
|
9571
|
Train/png/9571.png
|
def can_share_folder(self, user, folder):
return folder.parent_id is None and folder.author_id == user.id
|
2565
|
Train/png/2565.png
|
def __SetMark(self, mark=None):
"set mark for later"
if mark is None:
mark = self.__mark
self.SetSelection(mark, mark)
|
7684
|
Train/png/7684.png
|
def probe(self, axis: str, distance: float) -> Dict[str, float]:
return self._smoothie_driver.probe_axis(axis, distance)
|
6890
|
Train/png/6890.png
|
def visit_Str(self, node: ast.Str) -> str:
result = node.s
self.recomputed_values[node] = result
return result
|
8101
|
Train/png/8101.png
|
def eval_Rf(self, Vf):
return sl.inner(self.Df, Vf, axis=self.cri.axisM) - self.Sf
|
8247
|
Train/png/8247.png
|
def train(self, x, drop=False, na_rm=False):
self.range = scale_discrete.train(x, self.range, drop, na_rm=na_rm)
|
5365
|
Train/png/5365.png
|
def dict(self):
return {k: getattr(self, k) for k in self.__class__.defaults}
|
9288
|
Train/png/9288.png
|
def from_fqdn(cls, fqdn):
result = cls.list({'fqdn': fqdn})
if len(result) > 0:
return result[0]['id']
|
2195
|
Train/png/2195.png
|
def read_bytes(self):
with ZipFile(self.path, mode='r') as archive:
return archive.read(self.filename)
|
5831
|
Train/png/5831.png
|
def click(self, x, y):
return self.server.jsonrpc.click(x, y)
|
3978
|
Train/png/3978.png
|
def text_in_color(self, message, color_code):
return self.term.color(color_code) + message + self.term.normal
|
507
|
Train/png/507.png
|
def H_acceptor_count(mol):
mol.require("Valence")
return sum(1 for _, a in mol.atoms_iter() if a.H_acceptor)
|
349
|
Train/png/349.png
|
def setSignalName(self, name: str):
self.isHook = False
self.messengerName = name
|
5140
|
Train/png/5140.png
|
def content_type(self) -> ContentType:
return self._ctype if self._ctype else self.parent.content_type()
|
437
|
Train/png/437.png
|
def write(self, filename):
with open(filename, 'w') as f:
f.write(self.ascii)
self.print("Detector file saved as '{0}'".format(filename))
|
376
|
Train/png/376.png
|
def register(self, receiver_id, receiver):
assert receiver_id not in self.receivers
self.receivers[receiver_id] = receiver(receiver_id)
|
4173
|
Train/png/4173.png
|
def update_address_scope(self, address_scope, body=None):
return self.put(self.address_scope_path % (address_scope), body=body)
|
3847
|
Train/png/3847.png
|
def delete(self):
self.close()
if self.does_file_exist():
os.remove(self.path)
|
3902
|
Train/png/3902.png
|
def records(self):
if self._records == None:
self._records = self._get_records()
return self._records
|
9838
|
Train/png/9838.png
|
def f_lock_parameters(self):
for par in self._parameters.values():
if not par.f_is_empty():
par.f_lock()
|
8037
|
Train/png/8037.png
|
def song(netease, name, id):
if name:
netease.download_song_by_search(name)
if id:
netease.download_song_by_id(id, 'song'+str(id))
|
8095
|
Train/png/8095.png
|
def to_json(self, skip_nulls=True):
return json.dumps(self.to_dict(skip_nulls=skip_nulls))
|
4000
|
Train/png/4000.png
|
def end_namespace(self, prefix):
del self._ns[prefix]
self._g.endPrefixMapping(prefix)
|
3930
|
Train/png/3930.png
|
def send_file_message(self, filename):
data = self._readFile(filename)
self.print_debug_message(data)
self.socket.send(data)
|
8889
|
Train/png/8889.png
|
def input(self, prompt, default=None, show_default=True):
return click.prompt(prompt, default=default, show_default=show_default)
|
9426
|
Train/png/9426.png
|
def record_migration(plugin, filename, script, **kwargs):
db = get_db()
db.eval(RECORD_WRAPPER, plugin, filename, script)
return True
|
4933
|
Train/png/4933.png
|
def _get_default_mr_params(cls):
cfg = cls(_lenient=True)
mr_params = cfg._get_mr_params()
mr_params["api_version"] = 0
return mr_params
|
7937
|
Train/png/7937.png
|
def onecmd_plus_hooks(self, line):
if not line:
return self.emptyline()
return Cmd.onecmd_plus_hooks(self, line)
|
6184
|
Train/png/6184.png
|
def _get_column_by_db_name(cls, name):
return cls._columns.get(cls._db_map.get(name, name))
|
5180
|
Train/png/5180.png
|
def ignore_stops_before_now(self):
self._sentinel_stop = object()
self._q.put(self._sentinel_stop)
|
10039
|
Train/png/10039.png
|
def _add_ones_dim(arr):
"Adds a dimensions with ones to array."
arr = arr[..., np.newaxis]
return np.concatenate((arr, np.ones_like(arr)), axis=-1)
|
6476
|
Train/png/6476.png
|
def _get_lr_tensor(self):
lr = tf.squared_difference(1.0, tf.sqrt(self._mu)) / self._h_min
return lr
|
8046
|
Train/png/8046.png
|
def set_focus(self, pos):
"Set the focus in the underlying body widget."
logging.debug('setting focus to %s ', pos)
self.body.set_focus(pos)
|
839
|
Train/png/839.png
|
def infohash(self):
self.validate()
info = self.convert()[b'info']
return sha1(bencode(info)).hexdigest()
|
9319
|
Train/png/9319.png
|
def replace(self, p_todos):
self.erase()
self.add_todos(p_todos)
self.dirty = True
|
309
|
Train/png/309.png
|
def isatty(self):
"return whether the file is connected to a tty or not"
try:
return os.isatty(self._fileno)
except OSError as e:
raise IOError(*e.args)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.