common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
2998 | Train/png/2998.png | def auth_as(self, user):
old_user = self._user
self.auth(user)
try:
yield
finally:
self.auth(old_user)
|
8090 | Train/png/8090.png | def bs(s: int) -> str:
return str(s) if s <= 1 else bs(s >> 1) + str(s & 1)
|
5302 | Train/png/5302.png | def _BuildIndex(self):
self._index = {}
for i, k in enumerate(self._keys):
self._index[k] = i
|
3658 | Train/png/3658.png | def timing(self, stat, delta, rate=1):
return self.send(stat, "%d|ms" % delta, rate)
|
6155 | Train/png/6155.png | def data(self, data):
self._data = {det: d.copy() for (det, d) in data.items()}
|
4212 | Train/png/4212.png | def update_flavor(self, flavor, body):
return self.put(self.flavor_path % (flavor), body=body)
|
3869 | Train/png/3869.png | def StartAndWait(self):
self.StartTask()
self.WaitUntilTaskDone(pydaq.DAQmx_Val_WaitInfinitely)
self.ClearTask()
|
6297 | Train/png/6297.png | def codec_desc(self):
info = self.decSpecificInfo
desc = None
if info is not None:
desc = info.description
return desc
|
2129 | Train/png/2129.png | def mad(self, x, axis=None):
return np.median(np.abs(x - np.median(x, axis)), axis)
|
4704 | Train/png/4704.png | def full_path(self):
if self.parent:
return os.path.join(self.parent.full_path, self.name)
return self.name
|
4473 | Train/png/4473.png | def gc(self):
gc = len([base for base in self.seq if base == 'C' or base == 'G'])
return float(gc) / len(self)
|
6913 | Train/png/6913.png | def _read_header(self):
self._header = self.cdmrf.fetch_header()
self.load_from_stream(self._header)
|
5128 | Train/png/5128.png | def validate(self, instance, value):
if not isinstance(value, uuid.UUID):
self.error(instance, value)
return value
|
6827 | Train/png/6827.png | def _expand_one_key_dictionary(_dict):
key = next(six.iterkeys(_dict))
value = _dict[key]
return key, value
|
7891 | Train/png/7891.png | def st_atime(self):
atime = self._st_atime_ns / 1e9
return atime if self.use_float else int(atime)
|
7874 | Train/png/7874.png | def round_figures(x, n):
return round(x, int(n - math.ceil(math.log10(abs(x)))))
|
1931 | Train/png/1931.png | def parsewarn(self, msg, line=None):
if line is None:
line = self.sline
self.dowarn('warning: ' + msg + ' on line {}'.format(line))
|
1716 | Train/png/1716.png | def get_gsod_filenames(self, year=None, with_host=False):
return get_gsod_filenames(self.usaf_id, year, with_host=with_host)
|
7784 | Train/png/7784.png | def is_number(self):
self.number = re.sub(r'[^\d]', '', self.number)
return self.number.isdigit()
|
9688 | Train/png/9688.png | def message(msg, *args):
clear_progress()
text = (msg % args)
sys.stdout.write(text + '\n')
|
9886 | Train/png/9886.png | def add(self, nick):
self.data[nick] = ''
self.workers.add(nick)
|
7653 | Train/png/7653.png | def pylog(self, *args, **kwargs):
printerr(self.name, args, kwargs, traceback.format_exc())
|
1672 | Train/png/1672.png | def add_moving_element(self, element):
element.initialize(self.canvas)
self.elements.append(element)
|
9580 | Train/png/9580.png | def _is_proper_sequence(seq):
return (isinstance(seq, collections.abc.Sequence) and
not isinstance(seq, str))
|
2688 | Train/png/2688.png | def marvcli_user_rm(ctx, username):
app = create_app()
try:
app.um.user_rm(username)
except ValueError as e:
ctx.fail(e.args[0])
|
3212 | Train/png/3212.png | def cols_str(columns):
cols = ""
for c in columns:
cols = cols + wrap(c) + ', '
return cols[:-2]
|
2263 | Train/png/2263.png | def add(self, element):
key = self._transform(element)
if key not in self._elements:
self._elements[key] = element
|
3756 | Train/png/3756.png | def emit(self, arg=None):
for model, name in self.__get_models__():
model.notify_signal_emit(name, arg)
|
716 | Train/png/716.png | def decr(name, value=1, rate=1, tags=None):
client().decr(name, value, rate, tags)
|
6673 | Train/png/6673.png | def _get_str_columns(sf):
return [name for name in sf.column_names() if sf[name].dtype == str]
|
10012 | Train/png/10012.png | def first(self) -> Signature:
k = sorted(self._hsig.keys())
return self._hsig[k[0]]
|
5943 | Train/png/5943.png | def get_options(self):
query = 'SET'
return dict(row[:2] for row in self.con.fetchall(query))
|
9298 | Train/png/9298.png | def sameuuid(a: str, b: str) -> bool:
return a and b and a.lower() == b.lower()
|
5331 | Train/png/5331.png | def get_libs_dir(self, arch):
ensure_dir(join(self.libs_dir, arch))
return join(self.libs_dir, arch)
|
9487 | Train/png/9487.png | def find_actual_effect(self, mechanism, purviews=False):
return self.find_causal_link(Direction.EFFECT, mechanism, purviews)
|
614 | Train/png/614.png | def swipe_down(self, width: int = 1080, length: int = 1920) -> None:
self.swipe(0.5*width, 0.2*length, 0.5*width, 0.8*length)
|
7938 | Train/png/7938.png | def postcmd(self, stop, line):
self.color_prompt()
return Cmd.postcmd(self, stop, line)
|
2551 | Train/png/2551.png | def delta(self, above):
return self.activation.delta(self.incoming, self.outgoing, above)
|
2285 | Train/png/2285.png | def jenkins(self):
job_name = self.format['jenkins_job_name'].format(**self.data)
job = {'name': job_name}
return job
|
8646 | Train/png/8646.png | def do_echo(self, line):
args = self.line_to_args(line)
self.print(*args)
|
6377 | Train/png/6377.png | def label_empty(self, **kwargs):
"Label every item with an `EmptyLabel`."
kwargs['label_cls'] = EmptyLabelList
return self.label_from_func(func=lambda o: 0., **kwargs)
|
9161 | Train/png/9161.png | def read_file(filepath):
with io.open(filepath, "r") as filepointer:
res = filepointer.read()
return res
|
8008 | Train/png/8008.png | def copy(self):
return Poly(self.A.copy(), self.dim, self.shape,
self.dtype)
|
283 | Train/png/283.png | def star(self) -> snug.Query[bool]:
req = snug.PUT(BASE + f'/user/starred/{self.owner}/{self.name}')
return (yield req).status_code == 204
|
8758 | Train/png/8758.png | def set_icon(self, bmp):
_icon = wx.EmptyIcon()
_icon.CopyFromBitmap(bmp)
self.SetIcon(_icon)
|
5932 | Train/png/5932.png | def yvals(self):
return [
val[1] for serie in self.series for val in serie.values
if val[1] is not None
]
|
5692 | Train/png/5692.png | def chat_send(self, message: str):
assert isinstance(message, str)
await self._client.chat_send(message, False)
|
12 | Train/png/12.png | def _text_to_graphiz(self, text):
dot = Source(text, format='svg')
return dot.pipe().decode('utf-8')
|
1362 | Train/png/1362.png | def prox_unity(X, step, axis=0):
return X / np.sum(X, axis=axis, keepdims=True)
|
7444 | Train/png/7444.png | def css(self, css_path, dom=None):
if dom is None:
dom = self.browser
return expect(dom.find_by_css, args=[css_path])
|
2772 | Train/png/2772.png | def marts(self):
if self._marts is None:
self._marts = self._fetch_marts()
return self._marts
|
4287 | Train/png/4287.png | def record_event(self, event):
with open(self._path, 'a') as file_:
file_.write(str(event) + '\n')
|
1965 | Train/png/1965.png | def _handle_userCount(self, data):
self.room.user_count = data
self.conn.enqueue_data("user_count", self.room.user_count)
|
5235 | Train/png/5235.png | def delete(self, item):
uri = "/%s/%s" % (self.uri_base, utils.get_id(item))
return self._delete(uri)
|
9944 | Train/png/9944.png | def publish(self):
return self._publish(self.args, self.server, self.URI)
|
690 | Train/png/690.png | def name_replace(self, to_replace, replacement):
self.name = self.name.replace(to_replace, replacement)
|
5018 | Train/png/5018.png | def accept_lit(char, buf, pos):
if pos >= len(buf) or buf[pos] != char:
return None, pos
return char, pos+1
|
9781 | Train/png/9781.png | def append_child(self, name):
return XMLElement(lib.lsl_append_child(self.e, str.encode(name)))
|
967 | Train/png/967.png | def instance(self, other):
assert '/' not in str(other)
return Key(str(self) + ':' + str(other))
|
8752 | Train/png/8752.png | def clear(self):
self._undos.clear()
self._redos.clear()
self._savepoint = None
self._receiver = self._undos
|
3952 | Train/png/3952.png | def debug(self, message, *args, **kwargs):
self._log(logging.DEBUG, message, *args, **kwargs)
|
975 | Train/png/975.png | def put(self, key, value):
for store in self._stores:
store.put(key, value)
|
9097 | Train/png/9097.png | def application_path(path):
from uliweb import application
return os.path.join(application.project_dir, path)
|
1251 | Train/png/1251.png | def all_edges(self, node):
return set(self.inc_edges(node) + self.out_edges(node))
|
2086 | Train/png/2086.png | def renamed(self, name):
duplicate = copy(self)
duplicate._name = name
return duplicate
|
794 | Train/png/794.png | def siblings(self):
return list(filter(lambda x: id(x) != id(self), self.parent.childs))
|
1924 | Train/png/1924.png | def sorted_by_field(issues, field='closed_at', reverse=False):
return sorted(issues, key=lambda i: i[field], reverse=reverse)
|
7016 | Train/png/7016.png | def get_stats(self, service_id, stat_type=FastlyStatsType.ALL):
content = self._fetch("/service/%s/stats/%s" % (service_id, stat_type))
return content
|
8236 | Train/png/8236.png | def run(self, gates, n_qubits, *args, **kwargs):
return self._run(gates, n_qubits, args, kwargs)
|
8233 | Train/png/8233.png | def warn(msg, *args):
if not args:
sys.stderr.write('WARNING: ' + msg)
else:
sys.stderr.write('WARNING: ' + msg % args)
|
2389 | Train/png/2389.png | def get_for_model(self, model):
return self.filter(content_type=ContentType.objects.get_for_model(model))
|
7579 | Train/png/7579.png | def rumble(self, small=0, big=0):
self._control(small_rumble=small, big_rumble=big)
|
851 | Train/png/851.png | def get_property(self, key):
_key = DJANGO_CONF[key]
return getattr(self, _key, CONF_SPEC[_key])
|
6664 | Train/png/6664.png | def resolve(self, pubID, sysID):
ret = libxml2mod.xmlACatalogResolve(self._o, pubID, sysID)
return ret
|
1935 | Train/png/1935.png | def get_corpus(args):
tokenizer = get_tokenizer(args)
return tacl.Corpus(args.corpus, tokenizer)
|
5914 | Train/png/5914.png | def set_qword_at_offset(self, offset, qword):
return self.set_bytes_at_offset(offset, self.get_data_from_qword(qword))
|
4402 | Train/png/4402.png | def interrupt(self):
if (self.device.read(9) & 0x01):
self.handle_request()
self.device.clear_IR()
|
8534 | Train/png/8534.png | def get_data_hash(data_txt):
h = hashlib.sha256()
h.update(data_txt)
return h.hexdigest()
|
2331 | Train/png/2331.png | def acls(self):
if self._acls is None:
self._acls = InstanceAcls(instance=self)
return self._acls
|
5870 | Train/png/5870.png | def hset(self, key, field, value):
return self.execute(b'HSET', key, field, value)
|
4513 | Train/png/4513.png | def _unpack_body(self):
obj = self._get_body_instance()
obj.unpack(self.body.value)
self.body = obj
|
9787 | Train/png/9787.png | def sll(sig, howMany) -> RtlSignalBase:
"Logical shift left"
width = sig._dtype.bit_length()
return sig[(width - howMany):]._concat(vec(0, howMany))
|
7933 | Train/png/7933.png | def create_directory(self, filename):
path = os.path.join(self.path, filename)
makedirs(path)
return path
|
8674 | Train/png/8674.png | def relabel(self, qubits: Qubits) -> 'Channel':
chan = copy(self)
chan.vec = chan.vec.relabel(qubits)
return chan
|
8873 | Train/png/8873.png | def as_list(self):
return [self.name, self.value, [x.as_list for x in self.children]]
|
3465 | Train/png/3465.png | def addTextOut(self, text):
self._currentColor = self._black
self.addText(text)
|
3062 | Train/png/3062.png | def monthly(date=datetime.date.today()):
return datetime.date(date.year, date.month, 1)
|
3655 | Train/png/3655.png | def path(*components):
_path = os.path.join(*components)
_path = os.path.expanduser(_path)
return _path
|
6340 | Train/png/6340.png | def callMLlibFunc(name, *args):
sc = SparkContext.getOrCreate()
api = getattr(sc._jvm.PythonMLLibAPI(), name)
return callJavaFunc(sc, api, *args)
|
2112 | Train/png/2112.png | def attribute(func):
attr = abc.abstractmethod(func)
attr.__iattribute__ = True
attr = _property(attr)
return attr
|
5830 | Train/png/5830.png | def SplitTag(self, tag):
idx = tag.find(NS_SEP)
if idx >= 0:
return tag[:idx], tag[idx + 1:]
else:
return "", tag
|
3640 | Train/png/3640.png | def generateIndex(self, refresh=0, refresh_index=0):
open(self.index_file, "wt").write(self.renderIndex(
refresh=refresh, refresh_index=refresh_index))
|
9536 | Train/png/9536.png | def run(crawler):
crawler = get_crawler(crawler)
crawler.run()
if is_sync_mode():
TaskRunner.run_sync()
|
8040 | Train/png/8040.png | def extend(self, sequence):
self.__field.validate(sequence)
return list.extend(self, sequence)
|
5650 | Train/png/5650.png | def find_all(query: Query = None) -> List['ApiKey']:
return [ApiKey.from_db(key) for key in db.get_keys(query)]
|
7770 | Train/png/7770.png | def ems(self, value: int) -> 'Gap':
raise_not_number(value)
self.gap = '{}em'.format(value)
return self
|
1210 | Train/png/1210.png | def _all_valid(links):
for k, v in links.items():
for i in v:
yield k, i
|
7670 | Train/png/7670.png | def recent(self, include=None):
return self._query_zendesk(self.endpoint.recent, 'ticket', id=None, include=include)
|
8556 | Train/png/8556.png | def write_close(self, code=None):
return self.write(self.parser.close(code), opcode=0x8, encode=False)
|
832 | Train/png/832.png | def _run_raw(self, *args, **kwargs):
for job in self.jobs:
job._run_raw(*args, **kwargs)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.