common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
7742 | Train/png/7742.png | def write_and_quit(editor, location, force=False):
write(editor, location, force=force)
editor.application.exit()
|
8544 | Train/png/8544.png | def subnode(self, node):
self.children.append(node)
node.parent = self
node.adjust_interleave(node.interleave)
|
10033 | Train/png/10033.png | def _get_run_sql():
try:
from invenio.dbquery import run_sql
except ImportError:
from invenio.legacy.dbquery import run_sql
return run_sql
|
3181 | Train/png/3181.png | def log_magnitude_spectrum(frames):
return N.log(N.abs(N.fft.rfft(frames)).clip(1e-5, N.inf))
|
4440 | Train/png/4440.png | def standardize(score):
score = asarray_ndim(score, 1)
return (score - np.nanmean(score)) / np.nanstd(score)
|
3993 | Train/png/3993.png | def post_soup(self, *args, **kwargs):
return BeautifulSoup(self.post(*args, **kwargs).text)
|
1182 | Train/png/1182.png | def complete_watch(self, text, *_):
return [t + " " for t in self.engine.cached_descriptions if t.startswith(text)]
|
2272 | Train/png/2272.png | def cmd_create(args):
name = args.get(0)
if name:
penStore.createList(name)
else:
puts("not valid")
|
936 | Train/png/936.png | def send(self, data):
self.writer.write(data)
await self.writer.drain()
|
1249 | Train/png/1249.png | def out_nbrs(self, node):
l = map(self.tail, self.out_edges(node))
# l.sort()
return l
|
8747 | Train/png/8747.png | def get_requires():
requirements = open("requirements.txt", "r").read()
return list(filter(lambda x: x != "", requirements.split()))
|
7597 | Train/png/7597.png | def is_writable_by_others(filename):
mode = os.stat(filename)[stat.ST_MODE]
return mode & stat.S_IWOTH
|
5174 | Train/png/5174.png | def get_all_outgoings(chebi_ids):
all_outgoings = [get_outgoings(chebi_id) for chebi_id in chebi_ids]
return [x for sublist in all_outgoings for x in sublist]
|
6454 | Train/png/6454.png | def _draw_outline(o: Patch, lw: int):
"Outline bounding box onto image `Patch`."
o.set_path_effects([patheffects.Stroke(
linewidth=lw, foreground='black'), patheffects.Normal()])
|
7094 | Train/png/7094.png | def set_file_path(self, path):
self.file_path.delete(0, END)
self.file_path.insert(0, path)
|
2861 | Train/png/2861.png | def insert(self, value):
"Insert value in the keystore. Return the UUID key."
key = str(uuid4())
self.set(key, value)
return key
|
5384 | Train/png/5384.png | def assign_to(self, obj):
obj.x = self.x
obj.y = self.y
|
1745 | Train/png/1745.png | def spl_json(self):
_splj = {}
_splj["type"] = self._type
_splj["value"] = self._value
return _splj
|
1697 | Train/png/1697.png | def format(self, record):
record.hostname = self.hostname
return logging.Formatter.format(self, record)
|
2907 | Train/png/2907.png | def flushall(args):
cluster = Cluster.from_node(ClusterNode.from_uri(args.cluster))
for node in cluster.masters:
node.flushall()
|
4695 | Train/png/4695.png | def dataframe(self):
data = self.data
channel_names = self.get_channel_names()
return pd.DataFrame(data, columns=channel_names)
|
171 | Train/png/171.png | def map_tree(visitor, tree):
newn = [map_tree(visitor, node) for node in tree.nodes]
return visitor(tree, newn)
|
5212 | Train/png/5212.png | def init0(self, dae):
self.p0 = matrix(self.p, (self.n, 1), 'd')
self.q0 = matrix(self.q, (self.n, 1), 'd')
|
4069 | Train/png/4069.png | def characters(self, characters):
self._pad()
self._writer.characters(str(characters))
self._newline()
|
2541 | Train/png/2541.png | def replaceData(self, offset: int, count: int, string: str) -> None:
self._replace_data(offset, count, string)
|
7 | Train/png/7.png | def parallel(processes, threads):
pool = multithread(threads)
pool.map(run_process, processes)
pool.close()
pool.join()
|
7132 | Train/png/7132.png | def tags(self):
return dict([(t, self._catalog.tags.get(t, t)) for t in self._asset.get("tags", [])])
|
1610 | Train/png/1610.png | def reset_dirty_flags(self):
for sm_id, sm in self.state_machines.items():
sm.marked_dirty = False
|
821 | Train/png/821.png | def delete_customer(self, customer_id):
request = self._delete("customers/" + str(customer_id))
return self.responder(request)
|
4634 | Train/png/4634.png | def zoom_to_ligand(self):
self.rc("center #%i & :%s" % (self.model_dict[self.plipname], self.hetid))
|
8509 | Train/png/8509.png | def normalized_distance(self, *sequences):
return float(self.distance(*sequences)) / self.maximum(*sequences)
|
6063 | Train/png/6063.png | def decode_rfc2231(s):
parts = s.split(TICK, 2)
if len(parts) <= 2:
return None, None, s
return parts
|
9048 | Train/png/9048.png | def to_json(self):
roots = []
for r in self.roots:
roots.append(r.to_json())
return {'roots': roots}
|
7493 | Train/png/7493.png | def add(self, scene):
if not isinstance(scene, Scene):
raise TypeError()
self.__scenes.append(scene)
|
7763 | Train/png/7763.png | def pixels(self, value: float) -> 'Size':
raise_not_number(value)
self.maximum = '{}px'.format(value)
return self
|
2403 | Train/png/2403.png | def from_file(file_path) -> dict:
with io.open(file_path, 'r', encoding='utf-8') as json_stream:
return Json.parse(json_stream, True)
|
6945 | Train/png/6945.png | def timing_game(self):
self.ctrl_wg.game_timer.display(self.time)
self.time += 1
|
1908 | Train/png/1908.png | def makeControlModePacket(ID, mode):
pkt = makeWritePacket(ID, xl320.XL320_CONTROL_MODE, le(mode))
return pkt
|
9032 | Train/png/9032.png | def _extract_intensities(image, mask=slice(None)):
return numpy.array(image, copy=True)[mask].ravel()
|
1648 | Train/png/1648.png | def get_delete_security_group_rule_commands(self, sg_id, sg_rule):
return self._get_rule_cmds(sg_id, sg_rule, delete=True)
|
8228 | Train/png/8228.png | def load_boston():
dataset = datasets.load_boston()
return Dataset(load_boston.__doc__, dataset.data, dataset.target, r2_score)
|
3843 | Train/png/3843.png | def find_root(self):
cmd = self
while cmd.parent:
cmd = cmd.parent
return cmd
|
2361 | Train/png/2361.png | def get_plain_text(self):
ret = []
for occ in self.occurrences:
ret.extend(occ.get_plain_text())
return ret
|
5655 | Train/png/5655.png | def fix_w291(self, result):
fixed_line = self.source[result['line'] - 1].rstrip()
self.source[result['line'] - 1] = fixed_line + '\n'
|
2517 | Train/png/2517.png | def show_graph(cn_topo, showintfs=False, showaddrs=False):
__do_draw(cn_topo, showintfs=showintfs, showaddrs=showaddrs)
pyp.show()
|
1684 | Train/png/1684.png | def pngout(ext_args):
args = _PNGOUT_ARGS + [ext_args.old_filename, ext_args.new_filename]
extern.run_ext(args)
return _PNG_FORMAT
|
1817 | Train/png/1817.png | def C_dict2array(C):
return np.hstack([np.asarray(C[k]).ravel() for k in C_keys])
|
8868 | Train/png/8868.png | def get_pid_gain(self, ids, **kwargs):
return tuple([tuple(reversed(t)) for t in self._get_pid_gain(ids, **kwargs)])
|
4520 | Train/png/4520.png | def out(self, l):
if not isinstance(l, list):
l = [l]
self.output.extend([int(i) & 0xFF for i in l])
|
7143 | Train/png/7143.png | def do_step(self, args):
self._do_print_from_last_cmd = True
self._interp.step_into()
return True
|
4644 | Train/png/4644.png | def j_count_plus(self, slug):
output = {'status': 1 if MWiki.view_count_plus(slug) else 0}
return json.dump(output, self)
|
2050 | Train/png/2050.png | def get_metadata_path(name):
return pkg_resources.resource_filename('voobly', os.path.join(METADATA_PATH, '{}.json'.format(name)))
|
9037 | Train/png/9037.png | def progress_indicator(self, fmt=None, interval=100, values=None):
return ProgressIndicator(self.io, fmt, interval, values)
|
9693 | Train/png/9693.png | def cp_handler(self, args):
self.validate('cmd|s3|s3', args)
source = args[1]
target = args[2]
self.s3handler().cp_files(source, target)
|
8115 | Train/png/8115.png | def overlap_correlation(wnd, hop):
return sum(wnd * Stream(wnd).skip(hop)) / sum(el ** 2 for el in wnd)
|
7749 | Train/png/7749.png | def get_model(obj):
p = obj
while hasattr(p, 'parent'):
p = p.parent
return p
|
6909 | Train/png/6909.png | def get_attrs(self):
return FrozenOrderedDict((a, getattr(self.ds, a)) for a in self.ds.ncattrs())
|
7777 | Train/png/7777.png | def iscontinuous(self):
return all(self[i].end == self[i+1].start for i in range(len(self) - 1))
|
5974 | Train/png/5974.png | def cross(self):
self.query.do_join(Join(self.item, JoinType.cross))
return self.query
|
3698 | Train/png/3698.png | def _process(self, name):
if self.token.nature == name:
self.token = self.lexer.next_token()
else:
self._error()
|
2958 | Train/png/2958.png | def cancel(self):
self.event.clear()
if self.__timer is not None:
self.__timer.cancel()
|
6812 | Train/png/6812.png | def _normalize_dir(string_):
return os.path.normpath(salt.utils.stringutils.to_unicode(string_))
|
8473 | Train/png/8473.png | def get_sections_2dnt(self, sec2d_go):
return [(nm, self.get_ntgos_sorted(gos)) for nm, gos in sec2d_go]
|
4240 | Train/png/4240.png | def transform(self, text):
return re.sub(self.regex, self.repl, text)
|
1193 | Train/png/1193.png | def disconnect(self, code):
Subscriber.objects.filter(session_id=self.session_id).delete()
|
6350 | Train/png/6350.png | def hasDefault(self, param):
param = self._resolveParam(param)
return param in self._defaultParamMap
|
1780 | Train/png/1780.png | def settings(self) -> typing.Union[None, SharedCache]:
return self._project.settings if self._project else None
|
4477 | Train/png/4477.png | def apply(self, model):
model.medium = {row.exchange: row.uptake
for row in self.data.itertuples(index=False)}
|
5727 | Train/png/5727.png | def read_file(*path):
with open(os.path.join(*path)) as f:
return f.read().strip()
|
3426 | Train/png/3426.png | def run_container(self, conf, images, **kwargs):
with self._run_container(conf, images, **kwargs):
pass
|
8092 | Train/png/8092.png | def is_public(self):
return isinstance(self._key, Public) and not isinstance(self._key, Private)
|
6879 | Train/png/6879.png | def insert(self, index, value):
self.check(value)
self._user_list.insert(index, value)
|
7529 | Train/png/7529.png | def unregister(self):
self.names.remove(self.uniquename)
super(ConfigurableMeta, self).unregister()
|
1855 | Train/png/1855.png | def _set_format_scope(self, fmt):
self._prev_fmt = QtGui.QTextCharFormat(fmt)
self._prev_fmt_closed = False
|
7521 | Train/png/7521.png | def _has(self, key, exact=0):
if not exact:
key = self.getfullkey(key, new=1)
return key in self.data
|
6252 | Train/png/6252.png | def _p100(part, total, prec=1):
r = float(total)
if r:
r = part * 100.0 / r
return '%.*f%%' % (prec, r)
return 'n/a'
|
7859 | Train/png/7859.png | def hincrby(self, name, key, amount=1):
"Increment the value of ``key`` in hash ``name`` by ``amount``"
return await self.execute_command('HINCRBY', name, key, amount)
|
9266 | Train/png/9266.png | def chunk_count(self):
c = 0
for r in self.iter_regions():
c += r.chunk_count()
return c
|
2763 | Train/png/2763.png | def _debug_log(self, msg):
if not self.debug:
return
sys.stderr.write('{}\n'.format(msg))
|
8735 | Train/png/8735.png | def get(self, name):
if not name in self._vars:
raise AttributeError
setting = self._vars[name]
return setting.value
|
5361 | Train/png/5361.png | def close(self):
self.pool.close()
self.pool.terminate()
self.pool.join()
|
875 | Train/png/875.png | def RDirs(self, pathlist):
cwd = self.cwd or self.fs._cwd
return cwd.Rfindalldirs(pathlist)
|
3292 | Train/png/3292.png | def chunks(data, size):
for i in range(0, len(data), size):
yield data[i:i + size]
|
426 | Train/png/426.png | def t_escaped_CARRIAGE_RETURN_CHAR(self, t):
r'\x72' # 'r'
t.lexer.pop_state()
t.value = unichr(0x000d)
return t
|
3289 | Train/png/3289.png | def stage_all(self):
LOGGER.info('Staging all files')
self.repo.git.add(A=True)
|
7414 | Train/png/7414.png | def _skip_lines(self, n):
for i in range(n):
self.line = next(self.output)
return self.line
|
2237 | Train/png/2237.png | def start(self):
t = threading.Thread(target=self._consume)
t.start()
|
45 | Train/png/45.png | def symbols():
symbols = []
for line in symbols_stream():
symbols.append(line.decode('utf-8').strip())
return symbols
|
6844 | Train/png/6844.png | def _stdin_(p):
_v = sys.version[0]
return input(p) if _v is '3' else raw_input(p)
|
5602 | Train/png/5602.png | def from_file(cls, filepath):
with open(filepath, "rt") as fh:
return cls(**yaml.safe_load(fh))
|
7028 | Train/png/7028.png | def strtime(at=None, fmt=PERFECT_TIME_FORMAT):
if not at:
at = utcnow()
return at.strftime(fmt)
|
1014 | Train/png/1014.png | def get(cls, reactor, source='graphite', **options):
acls = cls.alerts[source]
return acls(reactor, **options)
|
9718 | Train/png/9718.png | def compute_mem_overhead(self):
self.mem_overhead = (self._process.memory_info().rss -
builtins.initial_rss_size)
|
7647 | Train/png/7647.png | def tokenlist(item, sep, suppress=True):
if suppress:
sep = sep.suppress()
return item + ZeroOrMore(sep + item) + Optional(sep)
|
7426 | Train/png/7426.png | def tran3(self, a, b, c, n):
return (((TRAN[(a+n) & 255] ^ TRAN[b]*(n+n+1))+TRAN[(c) ^ TRAN[n]]) & 255)
|
8234 | Train/png/8234.png | def flush(self):
if self.parent != ():
self.parent.flush()
if self.hdf5: # is open
self.hdf5.flush()
|
1402 | Train/png/1402.png | def gather_files(self):
self.all_files = utils.files_in_path(self.paths["role"])
return len(self.all_files)
|
159 | Train/png/159.png | def find(self, node, path):
return node.find(path, namespaces=self.namespaces)
|
6660 | Train/png/6660.png | def xincludeProcessFlags(self, flags):
ret = libxml2mod.xmlXIncludeProcessFlags(self._o, flags)
return ret
|
1399 | Train/png/1399.png | def exit(self):
self.logger.warning("Stopping daemon.")
os.remove(self.pid)
sys.exit(0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.