common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
1400 | Train/png/1400.png | def string_to_file(path, input):
mkdir_p(os.path.dirname(path))
with codecs.open(path, "w+", "UTF-8") as file:
file.write(input)
|
2662 | Train/png/2662.png | def native_container(self):
if self.__native is None:
self.__native = self._get_container()
return self.__native
|
6862 | Train/png/6862.png | def voice(self):
dbid = self.lldb.dbid
text, lang = self._voiceoverdb.get_text_lang(dbid)
return text, lang
|
5912 | Train/png/5912.png | def set_word_at_rva(self, rva, word):
return self.set_bytes_at_rva(rva, self.get_data_from_word(word))
|
1131 | Train/png/1131.png | def close(self):
if self._local.conn:
self._local.conn.transport.close()
self._local.conn = None
|
8511 | Train/png/8511.png | def reload(self):
if time.time() - self.updated > self.ttl:
self.force_reload()
|
2492 | Train/png/2492.png | def cap(v, l):
s = str(v)
return s if len(s) <= l else s[-l:]
|
8876 | Train/png/8876.png | def get_from_sources(self, index, doc_type, document_id):
return self.sources.get(index, {}).get(doc_type, {}).get(document_id, {})
|
6931 | Train/png/6931.png | def precision_recall(self):
return plot.precision_recall(self.y_true, self.y_score, ax=_gen_ax())
|
1405 | Train/png/1405.png | def runctx(cmd, globals, locals, filename=None, threads=True, verbose=False):
_run(threads, verbose, 'runctx', filename, cmd, globals, locals)
|
6848 | Train/png/6848.png | def cli_run():
options = CLI.parse_args()
run(options.CONFIGURATION, options.log_level,
options.log_target, options.log_journal)
|
4831 | Train/png/4831.png | def handle_scheduled(self, target):
if not isinstance(target, Handler):
return target()
return self._handle_scheduled(target)
|
671 | Train/png/671.png | def tag(path, name):
output, err = cli_syncthing_adapter.tag(path, name)
click.echo("%s" % output, err=err)
|
8914 | Train/png/8914.png | def section_lengths(neurites, neurite_type=NeuriteType.all):
return map_sections(_section_length, neurites, neurite_type=neurite_type)
|
6074 | Train/png/6074.png | def parse_matchdict(self, req, name, field):
return core.get_value(req.matchdict, name, field)
|
7485 | Train/png/7485.png | def _is_ipv6(addr):
try:
socket.inet_pton(socket.AF_INET6, addr)
return True
except socket.error:
return False
|
7673 | Train/png/7673.png | def to_json(self, indent=2):
return json.dumps(self, default=json_encode_for_printing, indent=indent)
|
4317 | Train/png/4317.png | def active(self):
if not os.path.isfile(self._paths['active_file']):
return False
return self._loaded
|
4467 | Train/png/4467.png | def values(self):
values = []
for __, data in self.items():
values.append(data)
return values
|
2122 | Train/png/2122.png | def patch(self):
original = self.__dict__['__original__']
return jsonpatch.make_patch(original, dict(self)).to_string()
|
8799 | Train/png/8799.png | def run_command(self, command_name, varargs):
command_descriptor = self.get_command(command_name)
return command_descriptor.run(*varargs)
|
7377 | Train/png/7377.png | def axes_off(ax):
ax.set_frame_on(False)
ax.axes.get_yaxis().set_visible(False)
ax.axes.get_xaxis().set_visible(False)
|
7984 | Train/png/7984.png | def index(self, strictindex):
return self._select(self._pointer.index(self.ruamelindex(strictindex)))
|
619 | Train/png/619.png | def add_role_to_user(self, user, role):
user.add_role(role)
self.save(user)
events.user_got_role_event.send(user, role=role)
|
1662 | Train/png/1662.png | def get_value(cls, object_version, key):
obj = cls.get(object_version, key)
return obj.value if obj else None
|
5824 | Train/png/5824.png | def debug(ftn, txt):
if debug_p:
sys.stdout.write("{0}.{1}:{2}\n".format(modname, ftn, txt))
sys.stdout.flush()
|
2630 | Train/png/2630.png | def conjugate(self):
return self.__class__.create(
*[arg.conjugate() for arg in reversed(self.args)])
|
9780 | Train/png/9780.png | def set_value(self, value):
return bool(lib.lsl_set_value(self.e, str.encode(value)))
|
10004 | Train/png/10004.png | def _flatten(child, parent):
return parent.is_type(TokenType.expression) and child.node_type == parent.node_type
|
1501 | Train/png/1501.png | def other_ind(self):
return np.full(self.n_min, self.size - 1, dtype=np.int)
|
7949 | Train/png/7949.png | def total_power(self):
power = self.average_current * self.voltage
return round(power, self.sr)
|
8870 | Train/png/8870.png | def is_sequence(obj):
return isinstance(obj, Sequence) and not (
isinstance(obj, str) or BinaryClass.is_valid_type(obj))
|
4510 | Train/png/4510.png | def parameter(self):
D = {}
for source in PARAM_SOURCE_ORDER:
D.update(self.params[source])
return D
|
8142 | Train/png/8142.png | def reload(self, callback=None, errback=None):
return self.load(reload=True, callback=callback, errback=errback)
|
8219 | Train/png/8219.png | def read_file(filename):
with open(join(abspath(dirname(__file__)), filename)) as file:
return file.read()
|
1588 | Train/png/1588.png | def List(self):
print()
for key in list(self.keys()):
print(key, '=', self[key])
print()
|
6527 | Train/png/6527.png | def merge_dicts(d1, d2):
merged = copy.deepcopy(d1)
deep_update(merged, d2, True, [])
return merged
|
2764 | Train/png/2764.png | def closed(self, code, reason=None):
self.emit('socket_closed', code, reason)
self._recover_network_failure()
|
4394 | Train/png/4394.png | def reset(self):
self.start = 1
self.count = None
self.end = None
self.stride = 1
self.format = "%d"
|
2258 | Train/png/2258.png | def get_vm_by_name(content, name, regex=False):
return get_object_by_name(content, vim.VirtualMachine, name, regex)
|
5064 | Train/png/5064.png | def async_set_state(self, data):
field = self._deconz_id + '/recall'
await self._async_set_state_callback(field, data)
|
5865 | Train/png/5865.png | def hexists(self, key, field):
fut = self.execute(b'HEXISTS', key, field)
return wait_convert(fut, bool)
|
5448 | Train/png/5448.png | def get_orphan_nodes(dag):
independent_nodes = get_independent_nodes(dag)
return set([node for node in independent_nodes if not dag[node]])
|
548 | Train/png/548.png | def lrelu_sq(x):
dim = len(x.get_shape()) - 1
return tf.concat(dim, [lrelu(x), tf.minimum(tf.abs(x), tf.square(x))])
|
9433 | Train/png/9433.png | def update_source(ident, data):
source = get_source(ident)
source.modify(**data)
signals.harvest_source_updated.send(source)
return source
|
4200 | Train/png/4200.png | def show_agent(self, agent, **_params):
return self.get(self.agent_path % (agent), params=_params)
|
7896 | Train/png/7896.png | def cleanup(self):
"Remove the directory containin the clone and virtual environment."
log.info('Removing temp dir %s', self._tempdir.name)
self._tempdir.cleanup()
|
9355 | Train/png/9355.png | def uid_exists(uid):
try:
pwd.getpwuid(uid)
uid_exists = True
except KeyError:
uid_exists = False
return uid_exists
|
4275 | Train/png/4275.png | def un_priority(op, val):
"unary expression order-of-operations helper"
if isinstance(val, BinX) and val.op < op:
return bin_priority(val.op, UnX(op, val.left), val.right)
else:
return UnX(op, val)
|
7509 | Train/png/7509.png | def convertDate(date):
d, t = date.split('T')
return decimal_date(d, timeobs=t)
|
1118 | Train/png/1118.png | def rankings(limit=20, offset=0):
click.echo(prettify(napi.get_rankings(limit=limit, offset=offset)))
|
4326 | Train/png/4326.png | def interrupt(self):
self.image = io.BytesIO()
self.renderer.screen.save(self.image, "png")
|
43 | Train/png/43.png | def set_status(self, name, status):
getattr(self.system, name).status = status
return True
|
6419 | Train/png/6419.png | def request_write(self, request: TBWriteRequest) -> None:
"Queues up an asynchronous write request to Tensorboard."
if self.stop_request.isSet():
return
self.queue.put(request)
|
801 | Train/png/801.png | def get_db_name(self, fname):
return self.funcs.db_func(fname, self.outdir, self.exes.format_exe)[1]
|
9076 | Train/png/9076.png | def _getUpcomingEvents(self, request):
home = request.site.root_page
return getAllUpcomingEvents(request, home=home)
|
5092 | Train/png/5092.png | def push(self, buf):
self._src.emit('push-buffer', Gst.Buffer.new_wrapped(buf))
|
9697 | Train/png/9697.png | def display_messages(self, layout):
print(json.dumps(self.messages, indent=4), file=self.out)
|
4102 | Train/png/4102.png | def to_package(self, repo_url):
return Package(name=self.name, url=repo_url + self.name)
|
1717 | Train/png/1717.png | def get_tags(self, md5):
tag_data = self.data_store.get_work_results('tags', md5)
return tag_data['tags'] if tag_data else None
|
3306 | Train/png/3306.png | def _get_arg_names(func):
args, varargs, keywords, defaults = inspect.getargspec(func)
return (tuple(args))
|
8855 | Train/png/8855.png | def stop(self):
log.info('Stopping the zmq listener class')
self.sub.close()
self.ctx.term()
|
10009 | Train/png/10009.png | def save_context(self) -> bool:
self._contexts.append(self._cursor.position)
return True
|
6663 | Train/png/6663.png | def remove(self, value):
ret = libxml2mod.xmlACatalogRemove(self._o, value)
return ret
|
1397 | Train/png/1397.png | def get_registered(self):
doc = self._request(self.ws_prefix + ".getInfo", True)
return _extract(doc, "registered")
|
4227 | Train/png/4227.png | def command(command):
with cd(env.remote_path):
sudo(env.python + ' manage.py %s' % command, user=env.remote_user)
|
6813 | Train/png/6813.png | def vm_info(name, quiet=False):
data = query(quiet=True)
return _find_vm(name, data, quiet)
|
8146 | Train/png/8146.png | def _hline(self):
if not self._hline_string:
self._hline_string = self._build_hline()
return self._hline_string
|
6603 | Train/png/6603.png | def gen_send_stdout_url(ip, port):
return '{0}:{1}{2}{3}/{4}/{5}'.format(BASE_URL.format(ip), port, API_ROOT_URL, STDOUT_API, NNI_EXP_ID, NNI_TRIAL_JOB_ID)
|
9305 | Train/png/9305.png | def get_icon(self, icon_id: str, size: "Gtk.IconSize") -> "Gtk.Image":
return Gtk.Image.new_from_gicon(self.get_gicon(icon_id), size)
|
1706 | Train/png/1706.png | def start(self, ignore_state=False):
self.logger.debug("Start service")
self._toggle_running(True, ignore_state)
|
4036 | Train/png/4036.png | def create():
if not os.path.isdir(options.path):
logger.info('creating working directory: ' + options.path)
os.makedirs(options.path)
|
1472 | Train/png/1472.png | def _compute_ratio(top, bot):
data = np.where(bot.data > 0, top.data / bot.data, 0.)
return HpxMap(data, top.hpx)
|
2720 | Train/png/2720.png | def get_value(self, expression):
self._check_valid()
return super(Result, self).get_value(expression)
|
5971 | Train/png/5971.png | def _create(self):
self._raise_if_none()
if not self._exists:
mkdir_p(self.path)
self._exists = True
|
6973 | Train/png/6973.png | def ynticks(self, nticks, index=1):
self.layout['yaxis' + str(index)]['nticks'] = nticks
return self
|
3034 | Train/png/3034.png | def clean_new(self, value):
value = self.schema_class(value).full_clean()
return self.object_class(**value)
|
1321 | Train/png/1321.png | def chunks(lst, size):
for i in xrange(0, len(lst), size):
yield lst[i:i + size]
|
2208 | Train/png/2208.png | def blksize(self):
self._blksize = self.lib.iperf_get_test_blksize(self._test)
return self._blksize
|
8102 | Train/png/8102.png | def rhochange(self):
self.lu, self.piv = sl.lu_factor(self.Z, self.rho)
self.lu = np.asarray(self.lu, dtype=self.dtype)
|
3455 | Train/png/3455.png | def run(self):
self.main_task.thread.start()
self.main_task.thread.join()
|
8921 | Train/png/8921.png | def _unpack_v1(h5file):
points = np.array(h5file['points'])
groups = np.array(h5file['structure'])
return points, groups
|
434 | Train/png/434.png | def get(self, key):
return self._object_class(json.loads(self._db[key]))
|
6760 | Train/png/6760.png | def set_text(self, text):
text = text.strip()
new_text = self.text() + text
self.setText(new_text)
|
4551 | Train/png/4551.png | def SelfAdjointEig(a):
shape = list(a.shape)
shape[-2] += 1
return np.append(*np.linalg.eig(a)).reshape(*shape),
|
8441 | Train/png/8441.png | def run(self):
self.factory.register(User, self.users_factory)
self.factory(User, 50).create()
|
2425 | Train/png/2425.png | def get_day_name(self) -> str:
weekday = self.value.isoweekday() - 1
return calendar.day_name[weekday]
|
6841 | Train/png/6841.png | def load(self, data):
self.clear()
self.update(data)
self.enhance()
|
792 | Train/png/792.png | def from_string(self, html_string):
self._html_parser._reset().feed(html_string)
return self._html_parser.result
|
3248 | Train/png/3248.png | def to_dict(self):
d = {'id': self.id, 'classes': self.classes}
d.update(self.kvs)
return d
|
7099 | Train/png/7099.png | def clean(ctx, dry_run=False):
basedir = ctx.sphinx.destdir or "build/docs"
cleanup_dirs([basedir], dry_run=dry_run)
|
7037 | Train/png/7037.png | def slistStr(slist):
slist = _fixSlist(slist)
string = ':'.join(['%02d' % x for x in slist[1:]])
return slist[0] + string
|
1562 | Train/png/1562.png | def create_loadfile(entities, f):
with open(f, 'w') as out:
out.write(Entity.create_payload(entities))
|
1950 | Train/png/1950.png | def trace(self):
if self._trace is None:
self._trace = self.load_trace(self.mname)
return self._trace
|
6657 | Train/png/6657.png | def debugDumpNode(self, output, depth):
libxml2mod.xmlDebugDumpNode(output, self._o, depth)
|
7758 | Train/png/7758.png | def squawk(self) -> Set[str]:
return set(self.data.squawk.ffill().bfill())
|
9687 | Train/png/9687.png | def items(self):
r
return ((k, v) for k, v in zip(self.keys(), self.values()))
|
3814 | Train/png/3814.png | def create(self):
self.consul.create_bucket("%s-%s" % (self.stack.name, self.name))
|
5310 | Train/png/5310.png | def lookup(self, mac):
oui = ":".join(mac.split(":")[:3]).upper()
return self[oui]
|
7359 | Train/png/7359.png | def write_int(self, value):
format = '!I'
self.data.append(struct.pack(format, int(value)))
self.size += 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.