common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
9450 | Train/png/9450.png | def connect(self):
return self.loop.create_connection(lambda: self, self.host, self.port)
|
8770 | Train/png/8770.png | def OnContextMenu(self, event):
self.grid.PopupMenu(self.grid.contextmenu)
event.Skip()
|
612 | Train/png/612.png | def swipe_right(self, width: int = 1080, length: int = 1920) -> None:
self.swipe(0.2*width, 0.5*length, 0.8*width, 0.5*length)
|
7265 | Train/png/7265.png | def get_full_dir_name(self):
return os.path.join(self.dir_name.get_text(), self.entry_project_name.get_text())
|
4927 | Train/png/4927.png | def js_classnameify(s):
if not '_' in s:
return s
return ''.join(w[0].upper() + w[1:].lower() for w in s.split('_'))
|
2491 | Train/png/2491.png | def export(self):
data = {}
for key, value in self.items():
data[key] = value
return data
|
2756 | Train/png/2756.png | def stop(self):
self.my_server.stop()
self.http_thread.join()
logging.info("HTTP server: Stopped")
|
6900 | Train/png/6900.png | def aggregate(self, **filters):
url = URL.aggregate.format(**locals())
return self.get_pages(url, **filters)
|
4536 | Train/png/4536.png | def set(self, name, arg=UNSET):
self._set(name, arg, self._lineno)
|
404 | Train/png/404.png | def global_cache_write(key, val, appname='default'):
with GlobalShelfContext(appname) as shelf:
shelf[key] = val
|
3066 | Train/png/3066.png | def run(self):
luigi.LocalTarget(path=self.fixture).copy(self.output().path)
|
9114 | Train/png/9114.png | def disk_free(path):
stats = os.statvfs(path)
return stats.f_bavail * stats.f_frsize
|
8245 | Train/png/8245.png | def tdist_ci(x, df, stderr, level):
q = (1 + level)/2
delta = stats.t.ppf(q, df) * stderr
return x - delta, x + delta
|
9641 | Train/png/9641.png | def qft(circ, q, n):
for j in range(n):
for k in range(j):
circ.cu1(math.pi / float(2**(j - k)), q[j], q[k])
circ.h(q[j])
|
9530 | Train/png/9530.png | def save_text_to_file(content: str, path: str):
with open(path, mode='w') as text_file:
text_file.write(content)
|
6694 | Train/png/6694.png | def setEditorData(self, editor, index):
text = from_qvariant(index.model().data(index, Qt.DisplayRole), str)
editor.setText(text)
|
6410 | Train/png/6410.png | def to_data(b: ItemsList):
"Recursively map lists of items in `b ` to their wrapped data."
if is_listy(b):
return [to_data(o) for o in b]
return b.data if isinstance(b, ItemBase) else b
|
7595 | Train/png/7595.png | def is_readable(filename):
return os.path.isfile(filename) and os.access(filename, os.R_OK)
|
1757 | Train/png/1757.png | def validate_pluginid(value):
valid = string.ascii_letters + string.digits + '.'
return all(c in valid for c in value)
|
4633 | Train/png/4633.png | def remove(gc: GroupControl, slaves):
click.echo("Removing from existing group: %s" % slaves)
click.echo(await gc.remove(slaves))
|
3198 | Train/png/3198.png | def packb(obj, **kwargs):
kwargs.setdefault('use_bin_type', True)
return msgpack.packb(obj, **kwargs)
|
8032 | Train/png/8032.png | def close(self):
" Close pipe fds. "
os.close(self._r)
os.close(self._w)
self._r = None
self._w = None
|
1952 | Train/png/1952.png | def tree_to_html(tree):
ul = etree.Element('ul')
html_listify([tree], ul)
return HTML_WRAPPER.format(etree.tostring(ul))
|
9446 | Train/png/9446.png | def save(file_name, content):
with open(file_name, "w", encoding="utf-8") as output_file:
output_file.write(content)
return output_file.name
|
8352 | Train/png/8352.png | def _check_ip(ip: str) -> bool:
address = ipaddress.IPv4Address(ip)
return address in allowed_ips
|
8879 | Train/png/8879.png | def is_one_of(obj, types):
for type_ in types:
if isinstance(obj, type_):
return True
return False
|
4590 | Train/png/4590.png | def last_name(anon, obj, field, val):
return anon.faker.last_name(field=field)
|
3164 | Train/png/3164.png | def basemz(df):
# returns the
d = np.array(df.columns)[df.values.argmax(axis=1)]
return Trace(d, df.index, name='basemz')
|
3481 | Train/png/3481.png | def segment_file(self, value):
assert os.path.isfile(value), "%s is not a valid file" % value
self._segment_file = value
|
6273 | Train/png/6273.png | def play(self):
print('{0} and {1} are playing {2}'.format(
self.player1, self.player2, self.__class__.__name__.lower()))
|
7631 | Train/png/7631.png | def get_checks(self, position=None):
if position is None:
position = self.position
return self.checkdefs[position][0]
|
4468 | Train/png/4468.png | def as_list(x):
if x is None:
x = []
elif not isinstance(x, Sequence):
x = [x]
return list(x)
|
4263 | Train/png/4263.png | def parse(binary, **params):
encoding = params.get('charset', 'UTF-8')
return json.loads(binary, encoding=encoding)
|
9658 | Train/png/9658.png | def conjugate(self):
return Operator(
np.conj(self.data), self.input_dims(), self.output_dims())
|
9264 | Train/png/9264.png | def task_stop(self, **kw):
id, task = self.get_task(**kw)
self._execute(id, 'stop')
return self.get_task(uuid=task['uuid'])[1]
|
1509 | Train/png/1509.png | def cleanup_storage(*args):
ShardedClusters().cleanup()
ReplicaSets().cleanup()
Servers().cleanup()
sys.exit(0)
|
8124 | Train/png/8124.png | def diagonalSize(self):
szs = [a.diagonalSize() for a in self.actors]
return np.max(szs)
|
8981 | Train/png/8981.png | def classmarkEnquiry():
a = TpPd(pd=0x6)
b = MessageType(mesType=0x13) # 00010011
packet = a / b
return packet
|
5688 | Train/png/5688.png | def new_cast_status(self, status):
self.status = status
if status:
self.status_event.set()
|
3175 | Train/png/3175.png | def teardown(self):
for table_spec in reversed(self._table_specs):
with self._conn:
table_spec.teardown(self._conn)
|
4627 | Train/png/4627.png | def err(msg):
click.echo(click.style(msg, fg="red", bold=True))
|
5030 | Train/png/5030.png | def next_id(self):
msgid = self._id_template.format(self._next_id)
self._next_id += 1
return msgid
|
3007 | Train/png/3007.png | def reset(self):
if os.path.exists(self.index_dir):
rmtree(self.index_dir)
self.index = None
|
3770 | Train/png/3770.png | def mostly(fn):
def wrapped(*args, **kwargs):
if in_percentage(95):
fn(*args, **kwargs)
return wrapped
|
4003 | Train/png/4003.png | def getBinding(self):
wsdl = self.getService().getWSDL()
return wsdl.bindings[self.binding]
|
891 | Train/png/891.png | def close(i, j, tolerance):
return i <= j + tolerance and i >= j - tolerance
|
7911 | Train/png/7911.png | def _pvalues_all(self):
return 2.0 * (1.0 - scs.t.cdf(np.abs(self._tstat_all), self.df_err))
|
824 | Train/png/824.png | def sort(records: Sequence[Record]) -> List[Record]:
"Sort records into a canonical order, suitable for comparison."
return sorted(records, key=_record_key)
|
598 | Train/png/598.png | def history(verbose, range):
alembic_command.history(
config=get_config(),
rev_range=range,
verbose=verbose
)
|
4261 | Train/png/4261.png | def halt(self, message, emitter, *args, **kwargs):
self.process_event((FINISH, self, (), {}))
global_event_queue.clear()
|
3068 | Train/png/3068.png | def stopReceivingBoxes(self, reason):
AMP.stopReceivingBoxes(self, reason)
log.removeObserver(self._emit)
|
2222 | Train/png/2222.png | def saveLogs(self, filename):
f = open(filename, 'wb')
cPickle.dump(self.logs, f)
f.close()
|
7679 | Train/png/7679.png | def ensure_dir_does_not_exist(*args):
path = os.path.join(*args)
if os.path.isdir(path):
shutil.rmtree(path)
|
7467 | Train/png/7467.png | def kill_all(self, kill_signal, kill_shell=False):
for key in self.processes.keys():
self.kill_process(key, kill_signal, kill_shell)
|
2543 | Train/png/2543.png | def erase(self):
with self._at_last_line():
self.stream.write(self._term.clear_eol)
self.stream.flush()
|
8563 | Train/png/8563.png | def get(self):
keys = r_kv.keys()
keys.sort()
return build_response(dict(data=keys, code=200))
|
2076 | Train/png/2076.png | def close(self, wait=False):
self.session.close()
self.pool.shutdown(wait=wait)
|
9675 | Train/png/9675.png | def clear(self):
self.reg = np.zeros((self.m,), dtype=np.int8)
|
7431 | Train/png/7431.png | def conditions(self):
for idx in six.moves.range(1, len(self.children), 2):
yield (self.children[idx - 1], self.children[idx])
|
9475 | Train/png/9475.png | def get_inputs_from_cm(index, cm):
return tuple(i for i in range(cm.shape[0]) if cm[i][index])
|
2002 | Train/png/2002.png | def draw_lines(image, ys, color=(255, 0, 0), line_width=1):
for y in ys:
cv2.line(image, (0, y), (image.shape[1], y), color, line_width)
|
3995 | Train/png/3995.png | def GetSOAPPart(self):
head, part = self.parts[0]
return StringIO.StringIO(part.getvalue())
|
8175 | Train/png/8175.png | def get_bucket_async(self, path, **kwds):
return self.do_request_async(self.api_url + path, 'GET', **kwds)
|
5970 | Train/png/5970.png | def puts_err(s='', newline=True, stream=STDERR):
puts(s, newline, stream)
|
992 | Train/png/992.png | def zoomset_cb(self, setting, value, chviewer, info):
return self.zoomset(chviewer, info.chinfo)
|
5778 | Train/png/5778.png | def get_meta_value_for(snapshot, key, default=None):
metadata = get_snapshot_metadata(snapshot)
return metadata.get(key, default)
|
1305 | Train/png/1305.png | def global_del(self, key):
key = self.pack(key)
return self.sql('global_del', key)
|
8223 | Train/png/8223.png | def connected_socket(address, timeout=3):
sock = socket.create_connection(address, timeout)
yield sock
sock.close()
|
4896 | Train/png/4896.png | def parent(self):
if self.path:
return Category(os.path.dirname(self.path))
return None
|
758 | Train/png/758.png | def _jsonify(x):
if isinstance(x, dict_class):
return json.dumps(x._d, separators=(',', ':'))
return json.dumps(x, separators=(',', ':'))
|
294 | Train/png/294.png | def flush(self):
self.__flushLevel(0)
if self.__lastImport is not None:
self.imports.append(self.__lastImport)
|
3363 | Train/png/3363.png | def get_available_name(self, name):
if self.exists(name):
self.delete(name)
return name
|
6124 | Train/png/6124.png | def visit_attribute(self, node):
return "%s.%s" % (self._precedence_parens(node, node.expr), node.attrname)
|
2124 | Train/png/2124.png | def set_U(self, U):
self.Ubg = np.asarray(U)[np.newaxis, ...]
|
1063 | Train/png/1063.png | def to_text(self):
if self.text == '':
return '::%s' % self.uri
return '::%s [%s]' % (self.text, self.uri)
|
1460 | Train/png/1460.png | def dispatch_job_hook(self, link, key, job_config, logfile, stream=sys.stdout):
raise NotImplementedError("SysInterface.dispatch_job_hook")
|
4944 | Train/png/4944.png | def _set_format(self, msg):
num_points = msg.height * msg.width
self._format = '<' + num_points * 'ffff'
|
1079 | Train/png/1079.png | def many(self):
for i in self.tc_requests.many(self.api_type, None, self.api_entity):
yield i
|
7489 | Train/png/7489.png | def load_window_opener(self, item):
window = Window.from_config(self.pyvlx, item)
self.add(window)
|
9258 | Train/png/9258.png | def find_all(self, string, callback):
for index, output in self.iter(string):
callback(index, output)
|
3339 | Train/png/3339.png | def make_middleware(app=None, *args, **kw):
app = RaptorizeMiddleware(app, *args, **kw)
return app
|
6309 | Train/png/6309.png | def _check_model(obj, models=None):
return isinstance(obj, type) and issubclass(obj, pw.Model) and hasattr(obj, '_meta')
|
4044 | Train/png/4044.png | def generate_chunks(string, num_chars):
for start in range(0, len(string), num_chars):
yield string[start:start+num_chars]
|
5474 | Train/png/5474.png | def _get_example_length(example):
length = tf.maximum(tf.shape(example[0])[0], tf.shape(example[1])[0])
return length
|
2579 | Train/png/2579.png | def send(self, diffTo, diffFrom):
diff = self.toObj.diff(diffTo, diffFrom)
self._open(self.butterStore.send(diff))
|
6307 | Train/png/6307.png | def sql(self, sql, *params):
self.ops.append(self.migrator.sql(sql, *params))
|
7032 | Train/png/7032.png | def build(self, ignore=None):
self._prepare_workspace()
self.install_dependencies()
self.package(ignore)
|
6014 | Train/png/6014.png | def get_artist(self, id_):
endpoint = "artists/{id}".format(id=id_)
return self._make_request(endpoint)
|
4171 | Train/png/4171.png | def show_router(self, router, **_params):
return self.get(self.router_path % (router), params=_params)
|
7438 | Train/png/7438.png | def obj(x):
j = np.arange(1, 6)
tmp1 = np.dot(j, np.cos((j+1)*x[0] + j))
tmp2 = np.dot(j, np.cos((j+1)*x[1] + j))
return tmp1 * tmp2
|
2970 | Train/png/2970.png | def get_group_instance(self, parent):
o = copy.copy(self)
o.init_instance(parent)
return o
|
1973 | Train/png/1973.png | def reraise(self, ex):
self.exception = ex
self.process_queues(forced=True)
|
2336 | Train/png/2336.png | def mods(self, uuid):
def picker(x): return x.get('mods', {})
return self._get(('mods', uuid), picker)
|
2168 | Train/png/2168.png | def wipe_table(self, table: str) -> int:
sql = "DELETE FROM " + self.delimit(table)
return self.db_exec(sql)
|
1888 | Train/png/1888.png | def limit(self, limit):
clone = self._clone()
if isinstance(limit, int):
clone._limit = limit
return clone
|
1850 | Train/png/1850.png | def _mor_to_pobject(self, mo_ref):
kls = classmapper(mo_ref._type)
new_object = kls(mo_ref, self)
return new_object
|
6885 | Train/png/6885.png | def tag_map(self):
tm = dd(list)
for tag in self.__tags:
tm[tag.tagtype].append(tag)
return tm
|
8565 | Train/png/8565.png | def lock(self, seconds=5):
self._current_application().lock(robot.utils.timestr_to_secs(seconds))
|
7826 | Train/png/7826.png | def to_bytes(self, errors='strict'):
return str(self).encode(self.encoding, errors=errors)
|
1061 | Train/png/1061.png | def main(graph):
args = parse_args(graph)
if args.drop:
drop_all(graph)
create_all(graph)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.