common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
2478 | Train/png/2478.png | def nlmsg_type(self, value):
self.bytearray[self._get_slicers(1)] = bytearray(c_uint16(value or 0))
|
3042 | Train/png/3042.png | def get_check(self, check):
data = self._request('GET', '/checks/{}'.format(check))
return data.json()
|
7227 | Train/png/7227.png | def find(self, upload_id, **kwargs):
return super(UploadsProxy, self).find(upload_id, file_upload=True)
|
6251 | Train/png/6251.png | def _isdictclass(obj):
c = getattr(obj, '__class__', None)
return c and c.__name__ in _dict_classes.get(c.__module__, ())
|
9167 | Train/png/9167.png | def _cache_eta(self):
self._calc_eta()
self._cached_output += ' | ETA: ' + self._get_time(self.eta)
|
3851 | Train/png/3851.png | def get(self, prefix, year, week):
filename = self._format_filename(prefix, year, week)
return RawEvents(filename, prefix, year, week)
|
4053 | Train/png/4053.png | def i(msg, *args, **kwargs):
return logging.log(INFO, msg, *args, **kwargs)
|
1140 | Train/png/1140.png | def get_node_by_hash(self, node_hash: str) -> Optional[Node]:
return self.session.query(Node).filter(Node.sha512 == node_hash).one_or_none()
|
5874 | Train/png/5874.png | def xgroup_destroy(self, stream, group_name):
fut = self.execute(b'XGROUP', b'DESTROY', stream, group_name)
return wait_ok(fut)
|
5545 | Train/png/5545.png | def _ClientPathToString(client_path, prefix=""):
return os.path.join(prefix, client_path.client_id, client_path.vfs_path)
|
10025 | Train/png/10025.png | def param_str(self, param, s):
param.pair = (self.value(s).strip('"'), str)
return True
|
9236 | Train/png/9236.png | def on_module(self, node): # ():('body',)
out = None
for tnode in node.body:
out = self.run(tnode)
return out
|
2919 | Train/png/2919.png | def opts(self, dictobj):
for k in dictobj:
self.chart_opts[k] = dictobj[k]
|
9782 | Train/png/9782.png | def prepend_child(self, name):
return XMLElement(lib.lsl_prepend_child(self.e, str.encode(name)))
|
8237 | Train/png/8237.png | def max_n(self):
return max(term.max_n() for term in self.terms if term.ops)
|
4530 | Train/png/4530.png | def make_func_call(id_, lineno, params):
return symbols.FUNCCALL.make_node(id_, params, lineno)
|
876 | Train/png/876.png | def Dir(self, name, create=True):
return self.fs.Dir(name, self, create)
|
6591 | Train/png/6591.png | def render_string(self, path: str, **kwargs: Any) -> bytes:
return self.handler.render_string(path, **kwargs)
|
6932 | Train/png/6932.png | def close(self):
"Stop the output stream, but further download will still perform"
if self.stream:
self.stream.close(self.scheduler)
self.stream = None
|
6123 | Train/png/6123.png | def visit_extslice(self, node):
return ", ".join(dim.accept(self) for dim in node.dims)
|
3125 | Train/png/3125.png | def clone_repo(pkg, dest, repo, repo_dest, branch):
git(['clone', '--recursive', '-b', branch, repo, repo_dest])
|
1754 | Train/png/1754.png | def clean_dict(dct):
return dict((key, val) for key, val in dct.items() if val is not None)
|
7316 | Train/png/7316.png | def get_dialog(self):
dialog = self.parent()
while not isinstance(dialog, QDialog):
dialog = dialog.parent()
return dialog
|
6759 | Train/png/6759.png | def setText(self, sequence):
self.setToolTip(sequence)
super(ShortcutLineEdit, self).setText(sequence)
|
3092 | Train/png/3092.png | def init_db():
db.drop_all()
db.configure_mappers()
db.create_all()
db.session.commit()
|
1435 | Train/png/1435.png | def clear(self):
if lib.EnvDeleteActivation(self._env, ffi.NULL) != 1:
raise CLIPSError(self._env)
|
1548 | Train/png/1548.png | def fail(message, exception_data=None):
print(message, file=sys.stderr)
if exception_data:
print(repr(exception_data))
sys.exit(1)
|
4267 | Train/png/4267.png | def get_local_user(username):
try:
_ = getpwnam(username)
luser = username
except KeyError:
luser = getuser()
return luser
|
3981 | Train/png/3981.png | def assert_type_equivalent(o1, o2):
assert o1 == o2
assert o2 == o1
assert type(o1) is type(o2)
|
7956 | Train/png/7956.png | def resource_moved(self, resource, new_resource):
if self.moved is not None:
self.moved(resource, new_resource)
|
233 | Train/png/233.png | def cast_datetime(ts, fmt=None):
dt = datetime.datetime.fromtimestamp(ts)
if fmt:
return dt.strftime(fmt)
return dt
|
5823 | Train/png/5823.png | def covars_(self):
return fill_covars(self._covars_, self.covariance_type,
self.n_components, self.n_features)
|
7073 | Train/png/7073.png | def put(self, job, result):
"Perform a job by a member in the pool and return the result."
self.job.put(job)
r = result.get()
return r
|
3969 | Train/png/3969.png | def initialize(self):
self.logger = logging.getLogger(self.__class__.__name__)
self.client = None
|
3796 | Train/png/3796.png | def updateAllKeys(self):
for kf, key in zip(self.kf_list, self.sorted_key_list()):
kf.update(key, self.dct[key])
|
1085 | Train/png/1085.png | def _rapRperiAxiEq(R, E, L, pot):
return E-potentialAxi(R, pot)-L**2./2./R**2.
|
8035 | Train/png/8035.png | def signal_handler(sign, frame):
LOG.info('%s => %s', sign, frame)
click.echo('Bye')
sys.exit(0)
|
1775 | Train/png/1775.png | def recurring(self, offset=0, count=25):
return self.client('jobs', 'recurring', self.name, offset, count)
|
6444 | Train/png/6444.png | def V(x, requires_grad=False, volatile=False):
return map_over(x, lambda o: V_(o, requires_grad, volatile))
|
8157 | Train/png/8157.png | def __timestamp():
today = time.time()
ret = struct.pack(b'=L', int(today))
return ret
|
308 | Train/png/308.png | def _path_exists(path):
return os.path.exists(path) or os.path.islink(path)
|
3052 | Train/png/3052.png | def get_subtree(self, tree, xpath_str):
return tree.xpath(xpath_str, namespaces=self.namespaces)
|
1059 | Train/png/1059.png | def to_prj(self, filename):
with open(filename, "w") as fp:
fp.write(self.prj)
|
5670 | Train/png/5670.png | def clear(self):
with self.lock:
self.relations.clear()
self.schemas.clear()
|
1703 | Train/png/1703.png | def for_entity(obj, check_commentable=False):
if check_commentable and not is_commentable(obj):
return []
return getattr(obj, ATTRIBUTE)
|
3892 | Train/png/3892.png | def delete(self):
if not self.id:
return
self.collection.remove({'_id': self._id})
self.on_delete(self)
|
7907 | Train/png/7907.png | def C00_(self):
self._check_estimated()
return self._rc.cov_XX(bessel=self.bessel)
|
4143 | Train/png/4143.png | def put(self, item, block=True, timeout=None):
return self._queue.put(item, block, timeout)
|
3779 | Train/png/3779.png | def hours(self, local=False):
delta = self.delta(local)
return delta.total_seconds()/3600
|
8152 | Train/png/8152.png | def fire_update_event(self, *args, **kwargs):
for _handler in self._on_update:
_handler(*args, **kwargs)
|
6781 | Train/png/6781.png | def _create_id(self):
cursor = self._db.cursor()
cursor.execute('INSERT INTO Ids DEFAULT VALUES')
return cursor.lastrowid
|
8576 | Train/png/8576.png | def pipe_value(self, message):
'Send a new value into the ws pipe'
jmsg = json.dumps(message)
self.send(jmsg)
|
3706 | Train/png/3706.png | def error(self, msgid, error):
self.requests[msgid].errback(error)
del self.requests[msgid]
|
830 | Train/png/830.png | def _with_env(self, env):
res = self._browse(env, self._ids)
return res
|
5085 | Train/png/5085.png | def mac():
from uuid import getnode as get_mac
return ':'.join(("%012x" % get_mac())[i:i+2] for i in range(0, 12, 2))
|
5678 | Train/png/5678.png | def _calc_d(aod700, p):
p0 = 101325.
dp = 1/(18 + 152*aod700)
d = -0.337*aod700**2 + 0.63*aod700 + 0.116 + dp*np.log(p/p0)
return d
|
753 | Train/png/753.png | def getKey(self, key):
data = self.getDictionary()
if key in data:
return data[key]
else:
return None
|
478 | Train/png/478.png | def preloop(self):
lines = textwrap.dedent(self.banner).split("\n")
for line in lines:
Console._print("BLUE", "", line)
|
1411 | Train/png/1411.png | def set(self, name, value=True):
"set a feature value"
setattr(self, name.lower(), value)
|
7235 | Train/png/7235.png | def move_left(self):
self.at(ardrone.at.pcmd, True, -self.speed, 0, 0, 0)
|
3775 | Train/png/3775.png | def mount(directory, lower_dir, upper_dir, mount_table=None):
return OverlayFS.mount(directory, lower_dir, upper_dir,
mount_table=mount_table)
|
2062 | Train/png/2062.png | def _or(ctx, *logical):
for arg in logical:
if conversions.to_boolean(arg, ctx):
return True
return False
|
8343 | Train/png/8343.png | def name_to_absolute(x):
for c in ["-", "*", ":"]:
x = x.replace(c, "_")
x = x.lower()
return x
|
7200 | Train/png/7200.png | def fibonacci(n):
if n <= 1:
raise ndb.Return(n)
a, b = yield fibonacci(n - 1), fibonacci(n - 2)
raise ndb.Return(a + b)
|
7418 | Train/png/7418.png | def in_feed(self, feed):
kwargs = {self.model._rel_to_feed: feed}
return self.filter(**kwargs)
|
2701 | Train/png/2701.png | def find_by_b64id(self, _id, **kwargs):
return self.find_one({"_id": ObjectId(base64.b64decode(_id))}, **kwargs)
|
176 | Train/png/176.png | def bind_end(self, stream, future):
if not isinstance(stream, Stream):
future.set_result(None)
else:
stream.pipe(TaskEndTransformer(future))
|
7688 | Train/png/7688.png | def close(self):
self._geometry.lid_status = self._module.close()
self._ctx.deck.recalculate_high_z()
return self._geometry.lid_status
|
8162 | Train/png/8162.png | def user(self):
return self.users.get(self.contexts[self.current_context].get("user", ""), {})
|
7833 | Train/png/7833.png | def add_camera_make_model(self, make, model):
self._ef['0th'][piexif.ImageIFD.Make] = make
self._ef['0th'][piexif.ImageIFD.Model] = model
|
4322 | Train/png/4322.png | def UpdateDNS(self, domain, environment):
self.dns_set_conf(domain, self.dns.config,
environment, self.dns.token)
|
1665 | Train/png/1665.png | def echo(bot, update):
message = update.get_effective_message()
bot.reply(update, message)
|
6993 | Train/png/6993.png | def resolved(value):
p = Promise()
p._state = 'resolved'
p.value = value
return p
|
8166 | Train/png/8166.png | def detect_html(text):
pattern = re.compile('\\s*<(!doctype|html)', re.IGNORECASE)
return bool(pattern.match(text))
|
771 | Train/png/771.png | def _is_rna(pe):
val = isinstance(pe, _bp('Rna')) or isinstance(pe, _bpimpl('Rna'))
return val
|
6704 | Train/png/6704.png | def show_plain_text(self, text):
self.switch_to_plugin()
self.switch_to_plain_text()
self.set_plain_text(text, is_code=False)
|
4640 | Train/png/4640.png | def pfull_from_ps(bk, pk, ps, pfull_coord):
return to_pfull_from_phalf(phalf_from_ps(bk, pk, ps), pfull_coord)
|
7039 | Train/png/7039.png | def getObject(ID, date, pos):
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
return Object.fromDict(obj)
|
9725 | Train/png/9725.png | def _split_comma_separated(string):
return set(text.strip() for text in string.split(',') if text.strip())
|
2564 | Train/png/2564.png | def SetAction(self, action, **kws):
"set callback action"
if hasattr(action, '__call__'):
self.__action = Closure(action, **kws)
|
7049 | Train/png/7049.png | def sunRelation(self):
sun = self.chart.getObject(const.SUN)
return sunRelation(self.obj, sun)
|
9375 | Train/png/9375.png | def referer_url(self, value):
if self._referer_url != value:
self._token = None
self._referer_url = value
|
2729 | Train/png/2729.png | def send(self, cmd):
self._bridge.send(cmd, wait=self.wait, reps=self.reps)
|
253 | Train/png/253.png | def show(self, block=False):
try:
plt.show(block=block)
except ValueError:
plt.show()
|
3079 | Train/png/3079.png | def clear_session_value(self, name):
self.redis().hdel(self._session_key, name)
self._update_session_expiration()
|
9306 | Train/png/9306.png | def get_gicon(self, icon_id: str) -> "Gio.Icon":
return Gio.ThemedIcon.new_from_names(self._icon_names[icon_id])
|
1447 | Train/png/1447.png | def update_line(self, resource_id, data):
return OrderLines(self.client).on(self).update(resource_id, data)
|
3925 | Train/png/3925.png | def _support_directory():
from os.path import join, dirname, abspath
return join(dirname(abspath(__file__)), 'support_files')
|
3726 | Train/png/3726.png | def get_last_row(dbconn, tablename, n=1, uuid=None):
return fetch(dbconn, tablename, n, uuid, end=True)
|
9255 | Train/png/9255.png | def SendToExecSocket(self, code, tid=None):
response = self._SendToExecSocketRaw(json.dumps(code), tid)
return json.loads(response)
|
8499 | Train/png/8499.png | def newPage(doc, pno=-1, width=595, height=842):
doc._newPage(pno, width=width, height=height)
return doc[pno]
|
4531 | Train/png/4531.png | def add_alias(self, entry):
assert isinstance(entry, SymbolVAR)
self.aliased_by.append(entry)
|
7898 | Train/png/7898.png | def write_line(self, message):
self.out.write(message + "\n")
self.out.flush()
|
941 | Train/png/941.png | def disconnect(self, client):
self.clients.remove(client)
del self.connect_args[client]
client.disconnect()
|
8242 | Train/png/8242.png | def on_close(self):
self._stop_update_flag = True
for ws in self.websockets:
ws.close()
|
5977 | Train/png/5977.png | def simplify(self) -> None:
self.raw = cast(T, z3.simplify(self.raw))
|
8505 | Train/png/8505.png | def get(self):
return {k: v for k, v in list(self.options.items()) if k in self._allowed_axes}
|
1127 | Train/png/1127.png | def none(self):
return EmptyQuerySet(model=self.model, using=self._using, connection=self._connection)
|
7010 | Train/png/7010.png | def list_services(self):
content = self._fetch("/service")
return map(lambda x: FastlyService(self, x), content)
|
5930 | Train/png/5930.png | def render_pyquery(self, **kwargs):
from pyquery import PyQuery as pq
return pq(self.render(**kwargs), parser='html')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.