common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
1614 | Train/png/1614.png | def get_flags():
flags = unitdata.kv().getrange('reactive.states.', strip=True) or {}
return sorted(flags.keys())
|
1123 | Train/png/1123.png | def add_date_facet(self, *args, **kwargs):
self.facets.append(DateHistogramFacet(*args, **kwargs))
|
216 | Train/png/216.png | def cancel(self):
with self.selenium.context(self.selenium.CONTEXT_CHROME):
self.find_secondary_button().click()
|
3888 | Train/png/3888.png | def is_valid_file(path):
return os.path.exists(path) and os.path.isfile(path)
|
4642 | Train/png/4642.png | def integrate(arr, ddim, dim=False, is_pressure=False):
if is_pressure:
dim = vert_coord_name(ddim)
return (arr*ddim).sum(dim=dim)
|
8485 | Train/png/8485.png | def get_relations_cnt(self):
return cx.Counter([e.relation for es in self.exts for e in es])
|
3922 | Train/png/3922.png | def save(self, commit=True):
db.session.add(self)
if commit:
db.session.commit()
return self
|
82 | Train/png/82.png | def extract_col(self, col):
new_col = [row[col] for row in self.grid]
return new_col
|
8430 | Train/png/8430.png | def _printed_len(some_string):
return len([x for x in ANSI_ESC_RE.sub('', some_string)
if x in string.printable])
|
5936 | Train/png/5936.png | def date_to_datetime(x):
if not isinstance(x, datetime) and isinstance(x, date):
return datetime.combine(x, time())
return x
|
4809 | Train/png/4809.png | def supported_operations(self):
return tuple(op for op in backend.FILE_OPS if self._operations & op)
|
3662 | Train/png/3662.png | def included_length(self):
return sum([shot.length for shot in self.shots if shot.is_included])
|
7877 | Train/png/7877.png | def setCell(self, x, y, v):
self.cells[y][x] = v
|
139 | Train/png/139.png | def a_stays_connected(ctx):
ctx.ctrl.connected = True
ctx.device.connected = False
return True
|
5772 | Train/png/5772.png | def candidates(word):
"Generate possible spelling corrections for word."
return (known([word]) or known(edits1(word)) or known(edits2(word)) or [word])
|
4959 | Train/png/4959.png | def create_route(self, item, routes):
for route in routes:
self._routes.setdefault(route, set()).add(item)
return item
|
9445 | Train/png/9445.png | def dequeue(self, block=True):
return self.queue.get(block, self.queue_get_timeout)
|
2332 | Train/png/2332.png | def all(self):
return self._instance._client.acls.all(self._instance.name)
|
3898 | Train/png/3898.png | def expect_all(a, b):
assert all(_a == _b for _a, _b in zip_longest(a, b))
|
8073 | Train/png/8073.png | def _expire(self):
del self.map.addr[self.name]
self.map.notify("addrmap_expired", *[self.name], **{})
|
1951 | Train/png/1951.png | def get_frame(self, idx):
cont = self.data[idx]
frame = int(cont.strip().split(" ", 1)[0])
return frame
|
9394 | Train/png/9394.png | def name(self):
return self.TYPES.get(self._type, self.TYPES[idaapi.o_idpspec0])
|
9227 | Train/png/9227.png | def items(self):
return [(k, unidecode.unidecode(v))
for k, v in self.identity_dict.items()]
|
519 | Train/png/519.png | def add_global(self, **values):
with self._lock:
self._ensure_global()
self._gpayload.update(**values)
|
1110 | Train/png/1110.png | def set_windows_kms_host(cls, host: typing.Optional[str]):
await cls.set_config("windows_kms_host", "" if host is None else host)
|
6129 | Train/png/6129.png | def ILIKE(pattern):
return P(lambda x: fnmatch.fnmatch(x.lower(), pattern.lower()))
|
5675 | Train/png/5675.png | def start(self, interval):
if self._thread:
self.cancel()
self._event.clear()
self._thread = hub.spawn(self._timer, interval)
|
8367 | Train/png/8367.png | def get_node(self, node_name):
for node in self.nodes:
if node.__name__ == node_name:
return node
|
9147 | Train/png/9147.png | def _get_row(self, id):
return {name: d['func'](id) for (name, d) in self._columns.items()}
|
7989 | Train/png/7989.png | def delete(self):
resp = self.r_session.delete(self.database_url)
resp.raise_for_status()
|
3464 | Train/png/3464.png | def getlinks(url):
page = Linkfetcher(url)
await page.linkfetch()
for i, url in enumerate(page):
return (i, url)
|
9206 | Train/png/9206.png | def dir_cmd(argv):
env = parse_envname(argv, lambda: sys.exit(
'You must provide a valid virtualenv to target'))
print(workon_home / env)
|
4498 | Train/png/4498.png | def get_inputs(self):
self.request(EP_GET_INPUTS)
return {} if self.last_response is None else self.last_response.get('payload').get('devices')
|
8425 | Train/png/8425.png | def increment(self):
self.value += self.increment_size
return self.value - self.increment_size
|
8108 | Train/png/8108.png | def accumulate(iterable):
" Return series of accumulated sums. "
iterator = iter(iterable)
sum_data = next(iterator)
yield sum_data
for el in iterator:
sum_data += el
yield sum_data
|
8755 | Train/png/8755.png | def pyspread(S=None):
# Initialize main application
app = MainApplication(S=S, redirect=False)
app.MainLoop()
|
1933 | Train/png/1933.png | def strip_files(args, parser):
stripper = tacl.Stripper(args.input, args.output)
stripper.strip_files()
|
2550 | Train/png/2550.png | def safeunicode(arg, *args, **kwargs):
return arg if isinstance(arg, unicode) else unicode(arg, *args, **kwargs)
|
9984 | Train/png/9984.png | def read(self, filename):
with open(self.path_to(str(filename))) as f:
d = f.read()
return d
|
6285 | Train/png/6285.png | def is_numeric_dtype(dtype):
dtype = np.dtype(dtype)
return np.issubsctype(getattr(dtype, 'base', None), np.number)
|
452 | Train/png/452.png | def clear(self, red=0.0, green=0.0, blue=0.0, alpha=0.0) -> None:
self.wnd.clear(red, green, blue, alpha)
|
8767 | Train/png/8767.png | def _execute_cell_code(self, row, col, grid):
key = row, col, grid.current_table
grid.code_array[key]
grid.ForceRefresh()
|
5628 | Train/png/5628.png | def roll_die(qvm, number_of_sides):
die_compiled = qvm.compile(die_program(number_of_sides))
return process_results(qvm.run(die_compiled))
|
6502 | Train/png/6502.png | def close(self):
if not self.is_open:
return
super(IndexCreator, self).close()
self.fidx.close()
|
8543 | Train/png/8543.png | def choice(cls, parent=None, occur=0):
node = cls("choice", parent)
node.occur = occur
node.default_case = None
return node
|
3109 | Train/png/3109.png | def rm_docs(self):
for filename in self.created:
if os.path.exists(filename):
os.unlink(filename)
|
4209 | Train/png/4209.png | def update_qos_policy(self, qos_policy, body=None):
return self.put(self.qos_policy_path % qos_policy,
body=body)
|
6426 | Train/png/6426.png | def dummy_eval(m: nn.Module, size: tuple = (64, 64)):
"Pass a `dummy_batch` in evaluation mode in `m` with `size`."
return m.eval()(dummy_batch(m, size))
|
7279 | Train/png/7279.png | def ask_dir(self):
args['directory'] = askdirectory(**self.dir_opt)
self.dir_text.set(args['directory'])
|
2107 | Train/png/2107.png | def signals():
signalbus = current_app.extensions['signalbus']
for signal_model in signalbus.get_signal_models():
click.echo(signal_model.__name__)
|
5637 | Train/png/5637.png | def translate_list(cls, val):
escaped = ', '.join([cls.translate(v) for v in val])
return 'Seq({})'.format(escaped)
|
1200 | Train/png/1200.png | def dumps(self):
io = six.StringIO()
self.dump(io)
io.seek(0)
return io.read()
|
679 | Train/png/679.png | def is_pending(self):
return self.status == Status.published and self.timestamp >= arrow.now()
|
2339 | Train/png/2339.png | def _parse_data(self, data, charset):
return self._decode_data(data, charset) if data else u''
|
4523 | Train/png/4523.png | def _paramf16(ins):
output = _f16_oper(ins.quad[1])
output.append('push de')
output.append('push hl')
return output
|
6861 | Train/png/6861.png | def _delay(self) -> int:
try:
return int(self.journey.MainStop.BasicStop.Dep.Delay.text)
except AttributeError:
return 0
|
1203 | Train/png/1203.png | def distance(self, point):
return sqrt((self.x-point.x)**2+(self.y-point.y)**2)
|
1062 | Train/png/1062.png | def enable_busy_cursor(self):
QgsApplication.instance().setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor)
)
|
9684 | Train/png/9684.png | def repo(self):
path = urijoin(self.base_url, 'repos', self.owner, self.repository)
r = self.fetch(path)
repo = r.text
return repo
|
9172 | Train/png/9172.png | def user_path(self, team, user):
return os.path.join(self.team_path(team), user)
|
9723 | Train/png/9723.png | def from_client(cls, client, *args, **kwargs):
return cls(client.http.client_id, *args, **kwargs)
|
4653 | Train/png/4653.png | def distance_to(self, other):
return np.linalg.norm(self.position-other.position)
|
150 | Train/png/150.png | def get_version(self):
return mgz.const.VERSIONS[self._header.version], str(self._header.sub_version)[:5]
|
8927 | Train/png/8927.png | def info(message, domain):
if domain in Logger._ignored_domains:
return
Logger._log(None, message, INFO, domain)
|
9452 | Train/png/9452.png | def read_uint(data, start, length):
return int.from_bytes(data[start:start+length], byteorder='big')
|
7855 | Train/png/7855.png | def should_execute(self):
return self.args.apply and (self.args.no_confirm or self.confirm_execution())
|
7408 | Train/png/7408.png | def signal_handler(signal_name, frame):
sys.stdout.flush()
print("\nSIGINT in frame signal received. Quitting...")
sys.stdout.flush()
sys.exit(0)
|
9955 | Train/png/9955.png | def _add_body(self):
if self.body:
b = MIMEText("text", "plain")
b.set_payload(self.body)
self.message.attach(b)
|
8540 | Train/png/8540.png | def prefix_list(self, prefix, values):
return list(map(lambda value: prefix + " " + value, values))
|
7072 | Train/png/7072.png | def write_data(path, obj):
with open_file_for_writing(path) as db:
db.write(encode(obj))
return obj
|
5052 | Train/png/5052.png | def indent_iterable(elems: Sequence[str], num: int = 2) -> List[str]:
return [" " * num + l for l in elems]
|
8761 | Train/png/8761.png | def OnPadIntCtrl(self, event):
self.attrs["pad"] = event.GetValue()
post_command_event(self, self.DrawChartMsg)
|
7603 | Train/png/7603.png | def timed(log=sys.stderr, limit=2.0):
return lambda func: timeit(func, log, limit)
|
5495 | Train/png/5495.png | def failed_hosts(self):
return {h: r for h, r in self.items() if r.failed}
|
5209 | Train/png/5209.png | def disconnect(self):
if self._connected:
self._connected = False
self._conn.disconnect()
|
7111 | Train/png/7111.png | def hash_text(text):
md5 = hashlib.md5()
md5.update(text)
return md5.hexdigest()
|
9247 | Train/png/9247.png | def is_running(self):
self.__update_status()
return self.status == Status.UP or self.status == Status.DECOMMISSIONED
|
4650 | Train/png/4650.png | def read_busiest_week(path: str) -> Dict[datetime.date, FrozenSet[str]]:
feed = load_raw_feed(path)
return _busiest_week(feed)
|
8042 | Train/png/8042.png | def getWindows(input):
with rasterio.open(input) as src:
return [[window, ij] for ij, window in src.block_windows()]
|
80 | Train/png/80.png | def percentile(self, percentile):
return self.bin_centers[np.argmin(np.abs(self.cumulative_density * 100 - percentile))]
|
8331 | Train/png/8331.png | def accel_zoom_out(self, *args):
for term in self.get_notebook().iter_terminals():
term.decrease_font_size()
return True
|
3427 | Train/png/3427.png | def is_stopped(self, *args, **kwargs):
kwargs["waiting"] = False
return self.wait_till_stopped(*args, **kwargs)
|
107 | Train/png/107.png | def fetch_order(self, order_id: str) -> Order:
return self._fetch(f'order id={order_id}', exc=OrderNotFound)(self._order)(order_id)
|
4659 | Train/png/4659.png | def touch(self, job: Job) -> None:
self._send_cmd(b'touch %d' % job.id, b'TOUCHED')
|
514 | Train/png/514.png | def auction(self, symbol='btcusd'):
url = self.base_url + '/v1/auction/' + symbol
return requests.get(url)
|
4862 | Train/png/4862.png | def overall(self, node):
return sum([self.value(value, node) for value in self.children(node)])
|
102 | Train/png/102.png | def fetch_ticker(self) -> Ticker:
return self._fetch('ticker', self.market.code)(self._ticker)()
|
1281 | Train/png/1281.png | def ranges(self):
ranges = self._target.getRanges()
return map(SheetAddress._from_uno, ranges)
|
5844 | Train/png/5844.png | def client_setname(self, name):
fut = self.execute(b'CLIENT', b'SETNAME', name)
return wait_ok(fut)
|
428 | Train/png/428.png | def t_escaped_TAB_CHAR(self, t):
r'\x74' # 't'
t.lexer.pop_state()
t.value = unichr(0x0009)
return t
|
6801 | Train/png/6801.png | def _ordereddict2dict(input_ordered_dict):
return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict))
|
9566 | Train/png/9566.png | def end_task(self):
self.progress(self.task_stack[-1].size)
self.task_stack.pop()
|
5960 | Train/png/5960.png | def workers_status(self):
return [self._workers_status[identifier]
for identifier in sorted(self._workers_status.keys())]
|
9996 | Train/png/9996.png | def Compute(self):
err = _Compute(self.transit, self.limbdark, self.settings, self.arrays)
if err != _ERR_NONE:
RaiseError(err)
|
4519 | Train/png/4519.png | def is_const(*p):
return is_SYMBOL('VAR', *p) and all(x.class_ == CLASS.const for x in p)
|
5837 | Train/png/5837.png | def monitor(self, name, ip, port, quorum):
fut = self.execute(b'MONITOR', name, ip, port, quorum)
return wait_ok(fut)
|
2886 | Train/png/2886.png | def plot_data(self):
self.plt.plot(*self.fit.data, **self.options['data'])
|
4253 | Train/png/4253.png | def getMaskIndices(mask):
return [
list(mask).index(True), len(mask) - 1 - list(mask)[::-1].index(True)
]
|
8052 | Train/png/8052.png | def mime_type(self, path):
name, ext = os.path.splitext(path)
return MIME_TYPES[ext]
|
3187 | Train/png/3187.png | def ins_packages():
count = 0
for pkg in os.listdir(pkg_path):
if not pkg.startswith("."):
count += 1
return count
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.