common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
4542
|
Train/png/4542.png
|
def Split(axis, a, n):
return tuple(np.split(np.copy(a), n, axis=axis))
|
8033
|
Train/png/8033.png
|
def unescape(self, varname, value):
f = self.unescape_funcs.get(varname)
return f(value) if f else value
|
8803
|
Train/png/8803.png
|
def provide_with_default(self, name, default=None):
return self.provider.instantiate_by_name_with_default(name, default_value=default)
|
573
|
Train/png/573.png
|
def __initLock(self):
self._isLocked = False
self._timer = 0
self._operation = False
|
8353
|
Train/png/8353.png
|
def clean(self):
for key, value in self.values.copy().items():
if value is None:
del self.values[key]
|
20
|
Train/png/20.png
|
def pretty_dict_str(d, indent=2):
b = StringIO()
write_pretty_dict_str(b, d, indent=indent)
return b.getvalue()
|
8273
|
Train/png/8273.png
|
def remove_proxy(self, proxy):
del self.search_flag[proxy.protocol][proxy.addr]
del self.addr_list[proxy.protocol][proxy.addr]
|
4068
|
Train/png/4068.png
|
def _check_for_errors(etree: ET.ElementTree):
if etree.getroot().tag == 'error':
raise APIError(etree.getroot().text)
|
7492
|
Train/png/7492.png
|
def start_timeout(self):
self.timeout_handle = self.pyvlx.connection.loop.call_later(
self.timeout_in_seconds, self.timeout)
|
5237
|
Train/png/5237.png
|
def template(self):
return Template(
self._env, lib.EnvFactDeftemplate(self._env, self._fact))
|
5885
|
Train/png/5885.png
|
def smove(self, sourcekey, destkey, member):
return self.execute(b'SMOVE', sourcekey, destkey, member)
|
1119
|
Train/png/1119.png
|
def submission_filenames(round_num=None, tournament=None):
click.echo(prettify(
napi.get_submission_filenames(tournament, round_num)))
|
1542
|
Train/png/1542.png
|
def on_value_changed(self, text):
d = self.declaration
with self.widget.get_member('text').suppressed(self.widget):
d.text = text
|
4742
|
Train/png/4742.png
|
def setupMovie(self):
if self.state == self.INIT:
self.sendRtspRequest(self.SETUP)
|
8122
|
Train/png/8122.png
|
def pol2cart(theta, rho):
x = rho * np.cos(theta)
y = rho * np.sin(theta)
return x, y
|
8759
|
Train/png/8759.png
|
def OnDependencies(self, event):
dlg = DependencyDialog(self.main_window)
dlg.ShowModal()
dlg.Destroy()
|
1571
|
Train/png/1571.png
|
def dump_emails(part):
print("Sent emails:")
for email in mail.outbox:
print(getattr(email, part))
|
1018
|
Train/png/1018.png
|
def skip_count(self):
return len([i for i, result in enumerate(self.data) if result.skip])
|
1081
|
Train/png/1081.png
|
def sort_by_name(self):
super(JSSObjectList, self).sort(key=lambda k: k.name)
|
5599
|
Train/png/5599.png
|
def declare_vars(self, d):
for k, v in d.items():
self.declare_var(k, v)
|
6543
|
Train/png/6543.png
|
def stn(s, length, encoding, errors):
s = s.encode(encoding, errors)
return s[:length] + (length - len(s)) * NUL
|
3380
|
Train/png/3380.png
|
def previous_day(self):
return HDate(self.gdate + datetime.timedelta(-1), self.diaspora,
self.hebrew)
|
7544
|
Train/png/7544.png
|
def assert_lt(left, right, message=None, extra=None):
assert left < right, _assert_fail_message(
message, left, right, ">=", extra)
|
8793
|
Train/png/8793.png
|
def zero_state(self, batch_size):
return torch.zeros(batch_size, self.state_dim, dtype=torch.float32)
|
8962
|
Train/png/8962.png
|
def update_params(params, updates):
params = params.copy() if isinstance(params, dict) else dict()
params.update(updates)
return params
|
2922
|
Train/png/2922.png
|
def getIndexStripUrl(self, index):
chapter, num = index.split('-')
return self.stripUrl % (chapter, chapter, num)
|
5901
|
Train/png/5901.png
|
def interp(x, xp, *args, **kwargs):
return interpolate_1d(x, xp, *args, **kwargs)
|
3722
|
Train/png/3722.png
|
def getContext(self):
ctx = ClientContextFactory.getContext(self)
ctx.set_options(OP_NO_SSLv3)
return ctx
|
5918
|
Train/png/5918.png
|
def _sim_colour(r1, r2):
return sum([min(a, b) for a, b in zip(r1["hist_c"], r2["hist_c"])])
|
7057
|
Train/png/7057.png
|
def orb(self):
for (mag, orb) in FixedStar._ORBS:
if self.mag < mag:
return orb
return 0.5
|
9127
|
Train/png/9127.png
|
def separator(self, menu=None):
self.gui.get_menu(menu or self.menu).addSeparator()
|
9896
|
Train/png/9896.png
|
def error(self, message):
message = self._remessage_invalid_subparser(message)
raise utils.UsageError(message)
|
5709
|
Train/png/5709.png
|
def noargs(self):
"Returns True if the callable takes no arguments"
noargs = inspect.ArgSpec(args=[], varargs=None,
keywords=None, defaults=None)
return self.argspec == noargs
|
6327
|
Train/png/6327.png
|
def invalidate(self):
" Invalidate the UI for all clients. "
logger.info('Invalidating %s applications', len(self.apps))
for app in self.apps:
app.invalidate()
|
2450
|
Train/png/2450.png
|
def create(self, id):
resp = self.client.accounts.create(id=id)
self.display(resp)
|
1870
|
Train/png/1870.png
|
def load(self):
with open(self.store_file_path, 'r') as fh:
self.store = json.loads(fh.read())
|
2045
|
Train/png/2045.png
|
def connect_input(self, wire):
self._input = wire
wire.sinks.append(self)
|
9513
|
Train/png/9513.png
|
def update_vertices(self, vertices):
vertices = np.array(vertices, dtype=np.float32)
self._vbo_v.set_data(vertices)
|
8523
|
Train/png/8523.png
|
def to(self, unit):
from astropy.units import au
return (self.au * au).to(unit)
|
3316
|
Train/png/3316.png
|
def revision(config, message):
with open(config, 'r'):
main.revision(yaml.load(open(config)), message)
|
6559
|
Train/png/6559.png
|
def last_modified_time(path):
return pd.Timestamp(os.path.getmtime(path), unit='s', tz='UTC')
|
8660
|
Train/png/8660.png
|
def downgrade(directory, sql, tag, x_arg, revision):
_downgrade(directory, revision, sql, tag, x_arg)
|
7101
|
Train/png/7101.png
|
def _is_pattern_match(re_pattern, s):
match = re.match(re_pattern, s, re.I)
return match.group() == s if match else False
|
6635
|
Train/png/6635.png
|
def __get_path(path):
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
return os.path.normpath(path)
|
5469
|
Train/png/5469.png
|
def translate(script):
tree = ast.parse(script)
ZiplineImportVisitor().visit(tree)
return astor.to_source(tree)
|
7376
|
Train/png/7376.png
|
def subdevicenames(self) -> Tuple[str, ...]:
self: NetCDFVariableBase
return tuple(self.sequences.keys())
|
9828
|
Train/png/9828.png
|
def exons(context, build):
LOG.info("Running scout delete exons")
adapter = context.obj['adapter']
adapter.drop_exons(build)
|
4082
|
Train/png/4082.png
|
def printc(cls, txt, color=colors.red):
print(cls.color_txt(txt, color))
|
2182
|
Train/png/2182.png
|
def euclid(a, b):
a = abs(a)
b = abs(b)
if a < b:
a, b = b, a
while b != 0:
a, b = b, a % b
return a
|
5184
|
Train/png/5184.png
|
def translate(patterns, *, flags=0):
flags = _flag_transform(flags)
return _wcparse.translate(_wcparse.split(patterns, flags), flags)
|
5433
|
Train/png/5433.png
|
def paused_partitions(self):
return set(partition for partition in self.assignment
if self.is_paused(partition))
|
8834
|
Train/png/8834.png
|
def use_to_ned(tensor):
return np.array(ROT_NED_USE.T * np.matrix(tensor) * ROT_NED_USE)
|
2017
|
Train/png/2017.png
|
def add_cause(self, error: Exception):
self.add_info(
'Cause error', '{0} - {1}'.format(type(error).__name__, error))
|
8342
|
Train/png/8342.png
|
def convert_bam_to_fastq(in_file, work_dir, data, dirs, config):
return alignprep.prep_fastq_inputs([in_file], data)
|
4047
|
Train/png/4047.png
|
def fromAttr2(start, ang, dist):
sx, sy = start
dx = cos(ang) * dist
dy = sin(ang) * dist
return sx, sy, sx + dx, sy + dy
|
421
|
Train/png/421.png
|
def dict_update_newkeys(dict_, dict2):
for key, val in six.iteritems(dict2):
if key not in dict_:
dict_[key] = val
|
4643
|
Train/png/4643.png
|
def int_dp_g(arr, dp):
return integrate(arr, to_pascal(dp, is_dp=True),
vert_coord_name(dp)) / GRAV_EARTH
|
2419
|
Train/png/2419.png
|
def child(self, fragment):
return os.path.join(self.path, FS(fragment).path)
|
9471
|
Train/png/9471.png
|
def close(self):
if not self._conn:
return
c = await self._execute(self._conn.close)
self._conn = None
return c
|
4997
|
Train/png/4997.png
|
def load_feature(fname, language):
fname = os.path.abspath(fname)
feat = parse_file(fname, language)
return feat
|
4507
|
Train/png/4507.png
|
def format_line(data, linestyle):
return linestyle.begin + linestyle.sep.join(data) + linestyle.end
|
1213
|
Train/png/1213.png
|
def select_db(self, db):
yield self._execute_command(COMMAND.COM_INIT_DB, db)
yield self._read_ok_packet()
|
9840
|
Train/png/9840.png
|
def dict_self(self):
return {k: v for k, v in self.__dict__.items() if k in FSM_ATTRS}
|
5940
|
Train/png/5940.png
|
def columns(self):
result = self.query.result()
return [field.name for field in result.schema]
|
6535
|
Train/png/6535.png
|
def rename(self, target):
if self._closed:
self._raise_closed()
self._accessor.rename(self, target)
|
5214
|
Train/png/5214.png
|
def add_suffix(fullname, suffix):
name, ext = os.path.splitext(fullname)
return name + '_' + suffix + ext
|
4490
|
Train/png/4490.png
|
def sub(v1, v2):
return tuple(a - b for a, b in zip(v1, v2))
|
4885
|
Train/png/4885.png
|
def center_on(self, item):
if not isinstance(item, GraphicsItem):
item = coerce_point(item)
self.proxy.center_on(item)
|
230
|
Train/png/230.png
|
def individual(ind_id):
individual_obj = app.db.individual(ind_id)
return render_template('individual.html', individual=individual_obj)
|
6072
|
Train/png/6072.png
|
def close(self):
if self._writer:
self._writer.transport.close()
self._writer = None
self._reader = None
|
380
|
Train/png/380.png
|
def get(self, zone_id):
path = '/'.join(['zone', zone_id])
return self.rachio.get(path)
|
9662
|
Train/png/9662.png
|
def remove_all_ops_named(self, opname):
for n in self.named_nodes(opname):
self.remove_op_node(n)
|
867
|
Train/png/867.png
|
def Entry(self, name, directory=None, create=1):
return self._create_node(name, self.env.fs.Entry, directory, create)
|
6840
|
Train/png/6840.png
|
def remote(ctx):
with command():
m = RepoManager(ctx.obj['agile'])
click.echo(m.github_repo().repo_path)
|
8104
|
Train/png/8104.png
|
def rhochange(self):
self.Gamma = 1.0 / (1.0 + (self.lmbda/self.rho)*(self.Alpha**2))
|
4741
|
Train/png/4741.png
|
def timestamp(self):
timestamp = self.header[4] << 24 | self.header[5] << 16 | self.header[6] << 8 | self.header[7]
return int(timestamp)
|
8871
|
Train/png/8871.png
|
def _join_names(names):
levels = (str(name) for name in names if name != '')
return '_'.join(levels)
|
9619
|
Train/png/9619.png
|
def refresh(self):
self._ex._cache.flush()
self._frame(fill_cache=True)
|
4773
|
Train/png/4773.png
|
def clean_cache_step(self):
logger.info('Step {}, cleaning cache'.format(self.name))
self.output = None
return self
|
8831
|
Train/png/8831.png
|
def barray(iterlines):
lst = [line.encode('utf-8') for line in iterlines]
arr = numpy.array(lst)
return arr
|
7490
|
Train/png/7490.png
|
def load_roller_shutter(self, item):
rollershutter = RollerShutter.from_config(self.pyvlx, item)
self.add(rollershutter)
|
5124
|
Train/png/5124.png
|
def get_future_days(self):
today = timezone.now().date()
return Day.objects.filter(date__gte=today)
|
5439
|
Train/png/5439.png
|
def feasible_set(self):
for y in itertools.product(*[range(1, k + 1) for k in self.K]):
yield np.array(y)
|
6876
|
Train/png/6876.png
|
def move_to(self, n):
self.term.stream.write(self.term.move_up * n)
|
2146
|
Train/png/2146.png
|
def pole(conic, plane):
v = dot(N.linalg.inv(conic), plane)
return v[:-1]/v[-1]
|
9664
|
Train/png/9664.png
|
def input_state(circ, q, n):
for j in range(n):
circ.h(q[j])
circ.u1(math.pi/float(2**(j)), q[j]).inverse()
|
1194
|
Train/png/1194.png
|
def set_link(self):
try:
self.link = self.soup.find('link').string
except AttributeError:
self.link = None
|
8780
|
Train/png/8780.png
|
def reset(self):
for proxy in list(self.dead):
self.dead.remove(proxy)
self.unchecked.add(proxy)
|
7955
|
Train/png/7955.png
|
def get_objects(self):
return rope.base.oi.soi.get_passed_objects(
self.pyfunction, self.index)
|
7121
|
Train/png/7121.png
|
def get_mac(self, use_cached=True):
device_json = self.get_device_json(use_cached)
return device_json.get("devMac")
|
7086
|
Train/png/7086.png
|
def update(self, fname):
ltfh = FileHandler(fname)
self._log.addHandler(ltfh)
|
7357
|
Train/png/7357.png
|
def add_answer(self, inp, record):
if not record.suppressed_by(inp):
self.add_answer_at_time(record, 0)
|
685
|
Train/png/685.png
|
def clients(self):
clients_response = self.get_request('clients/')
return [Client(self, cjson['client']) for cjson in clients_response]
|
78
|
Train/png/78.png
|
def build(self, recipe):
return self.__app.recipes.build(recipe, self._plugin)
|
2444
|
Train/png/2444.png
|
def visit_Div(self, node: AST, dfltChaining: bool = True) -> str:
return '/' if self.compact else ' / '
|
2301
|
Train/png/2301.png
|
def contains(self, other):
return self._start <= other.start and self._end >= other.end
|
9980
|
Train/png/9980.png
|
def read(self):
with open(self.path) as f:
d = f.read()
return d
|
5896
|
Train/png/5896.png
|
def unpack_from(self, buff, offset=0):
return self._create(super(NamedStruct, self).unpack_from(buff, offset))
|
3039
|
Train/png/3039.png
|
def normalize(x):
x = x.astype(float)
x -= x.mean()
return x / float(x.std())
|
3539
|
Train/png/3539.png
|
def install(cls):
[os.makedirs('{}/{}'.format(cls.home, cls.dirs[d])) for d in cls.dirs]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.