common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
7500
|
Train/png/7500.png
|
def copy(self):
return self.__class__(self, key=self._keyfn, precedes=self._precedes)
|
2049
|
Train/png/2049.png
|
def sample_counters(mc, system_info):
return {
(x, y): mc.get_router_diagnostics(x, y) for (x, y) in system_info
}
|
9501
|
Train/png/9501.png
|
def abspath(self):
"Absolute path to the local storage"
return Path(os.path.abspath(os.path.expanduser(str(self.path))))
|
2710
|
Train/png/2710.png
|
def codes_match_any(self, codes):
for selector in self.code_selectors:
if selector.code in codes:
return True
return False
|
3870
|
Train/png/3870.png
|
def isDone(self):
done = pydaq.bool32()
self.IsTaskDone(ctypes.byref(done))
return done.value
|
6158
|
Train/png/6158.png
|
def dump(self, filename):
f = open(filename, 'w')
cPickle.dump(self, f)
|
4478
|
Train/png/4478.png
|
def render_html(self):
return self._template.safe_substitute(
report_type=self._report_type,
results=self.render_json()
)
|
3326
|
Train/png/3326.png
|
def delete(bad_entry):
entries = read()
kept_entries = [x for x in entries if x.rstrip() != bad_entry]
write(kept_entries)
|
1492
|
Train/png/1492.png
|
def _create_child(self, tag):
return etree.SubElement(self._root, self._get_namespace_tag(tag))
|
8757
|
Train/png/8757.png
|
def OnResizeGrid(self, event):
shape = min(event.shape[2], 2**30)
self.SetItemCount(shape)
event.Skip()
|
3643
|
Train/png/3643.png
|
def hide_errors(cls):
cls.select_el.style.border = "0"
cls.input_el.style.border = "0"
|
279
|
Train/png/279.png
|
def submit_tag_batch(self, batch):
url = '%s/api/v5/batch/tags' % self.base_url
self._submit_batch(url, batch)
|
7097
|
Train/png/7097.png
|
def resize(self, size):
return Image(self.pil_image.resize(size, PIL.Image.ANTIALIAS))
|
3262
|
Train/png/3262.png
|
def rulefor(self, addr):
return self.rule.subgraph.node[self.rule.makeaddress(addr)][
'target_obj']
|
4214
|
Train/png/4214.png
|
def show_bgp_peer(self, peer_id, **_params):
return self.get(self.bgp_peer_path % peer_id,
params=_params)
|
7766
|
Train/png/7766.png
|
def min_ems(self, value: float) -> 'Size':
raise_not_number(value)
self.minimum = '{}em'.format(value)
return self
|
1347
|
Train/png/1347.png
|
def earth_orientation(date):
x_p, y_p, s_prime = np.deg2rad(_earth_orientation(date))
return rot3(-s_prime) @ rot2(x_p) @ rot1(y_p)
|
4431
|
Train/png/4431.png
|
def sdiffstore(self, dest, keys, *args):
result = self.sdiff(keys, *args)
self.redis[self._encode(dest)] = result
return len(result)
|
2025
|
Train/png/2025.png
|
def on_change(self, value):
self._modifier(self.inst, self.prop, value)
|
5687
|
Train/png/5687.png
|
def deregister_listener(self, member_uuid, listener):
self._casts[str(member_uuid)]['listeners'].remove(listener)
|
8826
|
Train/png/8826.png
|
def get_label(self, name):
label_tag = self._find_label(name)
return _Label(label_tag.get('id'), label_tag.get('color'), label_tag.text)
|
7558
|
Train/png/7558.png
|
def mda_count(self):
self.open()
mda = lvm_pv_get_mda_count(self.handle)
self.close()
return mda
|
8350
|
Train/png/8350.png
|
def _get_movielens_path():
return os.path.join(os.path.dirname(os.path.abspath(__file__)),
'movielens.zip')
|
4123
|
Train/png/4123.png
|
def set(self, option, value):
if self.config is None:
self.config = {}
self.config[option] = value
|
2531
|
Train/png/2531.png
|
def contains(self, token: str) -> bool:
self._validate_token(token)
return token in self
|
4912
|
Train/png/4912.png
|
def SetValue(self, row, col, value):
self.dataframe.iloc[row, col] = value
|
6649
|
Train/png/6649.png
|
def newCatalog(sgml):
ret = libxml2mod.xmlNewCatalog(sgml)
if ret is None:
raise treeError('xmlNewCatalog() failed')
return catalog(_obj=ret)
|
3990
|
Train/png/3990.png
|
def register_event(self, event_name, event_level, message):
self.events[event_name] = (event_level, message)
|
3169
|
Train/png/3169.png
|
def sbesselh2(x, N):
"Spherical Hankel of the second kind"
jn = sbesselj(x, N)
yn = sbessely(x, N)
return jn - 1j * yn
|
368
|
Train/png/368.png
|
def query(self, query, inplace=True):
# TODO: add to queue
result = self.data.query(query, inplace=inplace)
return result
|
9182
|
Train/png/9182.png
|
def open(cls, blob, username, password):
return cls(blob, blob.encryption_key(username, password))
|
331
|
Train/png/331.png
|
def cli(ctx, report, semantic, rcfile):
ctx.obj = {
'report': report,
'semantic': semantic,
'rcfile': rcfile,
}
|
4512
|
Train/png/4512.png
|
def to_bytes(val):
if val is NoResponse:
return val
val = val.replace('\\r', '\r').replace('\\n', '\n')
return val.encode()
|
1570
|
Train/png/1570.png
|
def _serialize_json(obj, fp):
json.dump(obj, fp, indent=4, default=serialize)
|
2254
|
Train/png/2254.png
|
def z(self):
"Day of the year; i.e. '0' to '365'"
doy = self.year_days[self.data.month] + self.data.day
if self.L() and self.data.month > 2:
doy += 1
return doy
|
562
|
Train/png/562.png
|
def _render_reward(self, r: np.float32) -> None:
print("reward = {:.4f}".format(float(r)))
print()
|
4429
|
Train/png/4429.png
|
def hincrbyfloat(self, hashkey, attribute, increment=1.0):
return self._hincrby(hashkey, attribute, 'HINCRBYFLOAT', float, increment)
|
169
|
Train/png/169.png
|
def GetSyncMoConfigFilePath():
return os.path.join(os.path.join(os.path.dirname(__file__), "resources"), "SyncMoConfig.xml")
|
6790
|
Train/png/6790.png
|
def _to_list(obj):
ret = {}
for attr in __attrs:
if hasattr(obj, attr):
ret[attr] = getattr(obj, attr)
return ret
|
5329
|
Train/png/5329.png
|
def next(self):
rv = self.current
self.pos = (self.pos + 1) % len(self.items)
return rv
|
550
|
Train/png/550.png
|
def state_size(self) -> Sequence[Shape]:
return self._sizes(self._compiler.rddl.state_size)
|
143
|
Train/png/143.png
|
def add(self, modpath, name, origin):
self.map.setdefault(modpath, {}).setdefault(name, set()).add(origin)
|
868
|
Train/png/868.png
|
def File(self, name, directory=None, create=1):
return self._create_node(name, self.env.fs.File, directory, create)
|
1475
|
Train/png/1475.png
|
def hpx_to_axes(h, npix):
x = h.ebins
z = np.arange(npix[-1] + 1)
return x, z
|
4221
|
Train/png/4221.png
|
def color_reducer(c1, c2):
return tuple(v1 + v2 for v1, v2 in itertools.izip(c1, c2))
|
7311
|
Train/png/7311.png
|
def get_tree_root(self):
root = self
while root.up is not None:
root = root.up
return root
|
2836
|
Train/png/2836.png
|
def get_data(self):
return self.x, self.y, self.w, self.h
|
2133
|
Train/png/2133.png
|
def clean_with_zeros(self, x):
x[~np.any(np.isnan(x) | np.isinf(x), axis=1)] = 0
return x
|
3434
|
Train/png/3434.png
|
def is_header(line):
if re.match('^@', line):
f = line.rstrip().split("\t")
if (len(f) > 9):
return False
return True
return False
|
77
|
Train/png/77.png
|
def insert(self, index, value):
return super(Collection, self).insert(
index, self._ensure_value_is_valid(value))
|
5198
|
Train/png/5198.png
|
def load_schema(path):
with open(path) as json_data:
schema = json.load(json_data)
return schema
|
4302
|
Train/png/4302.png
|
def _saveState(self, path):
self.addSession() # next session
self._save(str(self.n_sessions), path)
|
1581
|
Train/png/1581.png
|
def on(self, group):
asyncio.ensure_future(self._send_led_on_off_request(group, 1),
loop=self._loop)
|
1011
|
Train/png/1011.png
|
def run(self, *args):
params = self.parser.parse_args(args)
code = self.show(params.uuid, params.term)
return code
|
8835
|
Train/png/8835.png
|
def ned_to_use(tensor):
return np.array(ROT_NED_USE * np.matrix(tensor) * ROT_NED_USE.T)
|
4217
|
Train/png/4217.png
|
def replace_tag(self, resource_type, resource_id, body, **_params):
return self.put(self.tags_path % (resource_type, resource_id), body)
|
6947
|
Train/png/6947.png
|
def _bond_length_low(r, deriv):
r = Vector3(3, deriv, r, (0, 1, 2))
d = r.norm()
return d.results()
|
7773
|
Train/png/7773.png
|
def length(self, t0=0, t1=1, error=None, min_depth=None):
return abs(self.end - self.start)*(t1-t0)
|
3222
|
Train/png/3222.png
|
def save(self, *module_names):
for modname in module_names:
self._saved[modname] = sys.modules.get(modname, None)
|
2105
|
Train/png/2105.png
|
def pprint(self, ind):
pp = pprint.PrettyPrinter(indent=ind)
pp.pprint(self.tree)
|
8128
|
Train/png/8128.png
|
def url(self, part):
return self._server.url(part, includeToken=True) if part else None
|
9599
|
Train/png/9599.png
|
def _log_vector_matrix(vs, ms):
return tf.reduce_logsumexp(input_tensor=vs[..., tf.newaxis] + ms, axis=-2)
|
2574
|
Train/png/2574.png
|
def open(self):
self.startTime = datetime.datetime.now()
self.offset = 0
return self
|
4894
|
Train/png/4894.png
|
def subseq(start_offset=0, end_offset=None):
def _(sequence):
return sequence.subseq(start_offset, end_offset)
return _
|
9756
|
Train/png/9756.png
|
def create_user(db_url, user):
PostgresCheckpoints(
db_url=db_url,
user_id=user,
create_user_on_startup=True,
)
|
2502
|
Train/png/2502.png
|
def remove_dot(self):
if os.path.isfile("{0}.dot".format(self.image)):
os.remove("{0}.dot".format(self.image))
|
8624
|
Train/png/8624.png
|
def connect(self):
print('Connecting to %s' % self._link_uri)
self._cf.open_link(self._link_uri)
|
8842
|
Train/png/8842.png
|
def iterparse(source, events=('end',), remove_comments=True, **kw):
return ElementTree.iterparse(source, events, SourceLineParser(), **kw)
|
3622
|
Train/png/3622.png
|
def remove(text, what, count=None, strip=False):
return replace(text, what, '', count=count, strip=strip)
|
6508
|
Train/png/6508.png
|
def _check_shape(s1, s2):
if s1 and s2 and s1 != s2:
raise ValueError("Shape mismatch detected. " +
str(s1) + " v.s. " + str(s2))
|
6323
|
Train/png/6323.png
|
def focus_left(pymux):
" Move focus to the left. "
_move_focus(pymux,
lambda wp: wp.xpos - 2, # 2 in order to skip over the border.
lambda wp: wp.ypos)
|
9162
|
Train/png/9162.png
|
def add_to(self, parent, name=None, index=None):
parent.add_child(self, name=name, index=index)
return self
|
7127
|
Train/png/7127.png
|
def config_list(ctx):
ingest_config_obj(ctx, silent=False)
click.echo(json.dumps(ctx.obj['config'].to_dict(), indent=4))
|
3589
|
Train/png/3589.png
|
def refresh_token(self, pattern=KEY_PATTERN):
self.token = generate_token(pattern)
self.save()
|
6
|
Train/png/6.png
|
def licenses(self):
return {self._acronym_lic(l): l for l in self.resp_text.split('\n')
if l.startswith(self.prefix_lic)}
|
8900
|
Train/png/8900.png
|
def toUnicode(s):
if isinstance(s, six.binary_type):
s = s.decode('utf-8')
return s
|
6795
|
Train/png/6795.png
|
def _cert_file(name, cert_type):
return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))
|
2114
|
Train/png/2114.png
|
def process_request(self):
self.response = self.request_handler.process_request(
self.method, self.request_data)
|
6139
|
Train/png/6139.png
|
def rex(expr):
r = re.compile(expr)
return lambda key: isinstance(key, six.string_types) and r.match(key)
|
1169
|
Train/png/1169.png
|
def dump(self, file: TextIO, **kwargs) -> None:
return json.dump(self.to_json(), file, **kwargs)
|
3067
|
Train/png/3067.png
|
def get_listeners(self, name):
return list(map(lambda listener: listener[0], self.listeners[name]))
|
9096
|
Train/png/9096.png
|
def camel_to_(s):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', s)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
8829
|
Train/png/8829.png
|
def msjd(theta):
s = 0.
for p in theta.dtype.names:
s += np.sum(np.diff(theta[p], axis=0) ** 2)
return s
|
2267
|
Train/png/2267.png
|
def err_exit(msg, rc=1):
print(msg, file=sys.stderr)
sys.exit(rc)
|
4247
|
Train/png/4247.png
|
def generate_loader(self, mapfile, names):
return self.build_template(mapfile, names, self._loaddata_template)
|
4158
|
Train/png/4158.png
|
def show_ext(self, path, id, **_params):
return self.get(path % id, params=_params)
|
5683
|
Train/png/5683.png
|
def bash(filename):
sys.stdout.flush()
subprocess.call("bash {}".format(filename), shell=True)
|
207
|
Train/png/207.png
|
def s2b(s):
ret = []
for c in s:
ret.append(bin(ord(c))[2:].zfill(8))
return "".join(ret)
|
5618
|
Train/png/5618.png
|
def register_dde_task(self, *args, **kwargs):
kwargs["task_class"] = DdeTask
return self.register_task(*args, **kwargs)
|
9126
|
Train/png/9126.png
|
def stop(self):
if self._timer:
self._timer.stop()
self._timer.deleteLater()
|
6295
|
Train/png/6295.png
|
def align(self):
bits = self._bits
self._buffer = 0
self._bits = 0
return bits
|
9764
|
Train/png/9764.png
|
def size(self):
return sum(q.qsize() for q in self._connections.values()) + len(self._fairies)
|
8693
|
Train/png/8693.png
|
def find_time_base(self, gps):
t = gps.GPSTime * 1.0e-6
self.timebase = t - self.px4_timebase
|
2657
|
Train/png/2657.png
|
def iter_sources(self):
for src_id in xrange(self.get_source_count()):
yield src_id, self.get_source_name(src_id)
|
2268
|
Train/png/2268.png
|
def publish_file(self, infile, outfile, styles=''):
rest = self.read_file(infile)
return self.publish_string(rest, outfile, styles)
|
503
|
Train/png/503.png
|
def assignQuery(self):
self.uiRecordTREE.setQuery(self._queryWidget.query(), autoRefresh=True)
|
7589
|
Train/png/7589.png
|
def strtime(t, func=time.localtime):
return time.strftime("%Y-%m-%d %H:%M:%S", func(t)) + strtimezone()
|
831
|
Train/png/831.png
|
def run_with_output(self, *args, **kwargs):
for job in self.jobs:
job.run_with_output(*args, **kwargs)
|
5440
|
Train/png/5440.png
|
def write(self):
with open(self.log_path, "w") as f:
json.dump(self.log_dict, f, indent=1)
|
453
|
Train/png/453.png
|
def windowed(self, size) -> None:
width, height = size
self.wnd.windowed(width, height)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.