common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
2626
|
Train/png/2626.png
|
def free_symbols(self):
return set.union(
self.S.free_symbols, self.L.free_symbols, self.H.free_symbols)
|
4303
|
Train/png/4303.png
|
def get_fortunes_path():
app_config = apps.get_app_config("fortune")
return Path(os.sep.join([app_config.path, "fortunes"]))
|
5898
|
Train/png/5898.png
|
def set_mark(self):
self._bookmarks.append(self._offset)
return len(self._bookmarks) - 1
|
5047
|
Train/png/5047.png
|
def cio_close(cio):
OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(CioType)]
OPENJPEG.opj_cio_close(cio)
|
5541
|
Train/png/5541.png
|
def File(self, path):
return vfs.FileRef(
client_id=self.client_id, path=path, context=self._context)
|
1625
|
Train/png/1625.png
|
def isdisjoint(self, other):
return not bool(self.db.sinter([self.key, other.key]))
|
2212
|
Train/png/2212.png
|
def newLine(self):
l = CSVEntry(self)
if self.keepInMemory:
self.lines.append(l)
return l
|
9391
|
Train/png/9391.png
|
def submit_action(self, ddata):
self._controller.post(ddata,
url=HOME_ENDPOINT,
referer=HOME_ENDPOINT)
|
829
|
Train/png/829.png
|
def timeout(self, timeout):
self._proxy_json._timeout = timeout
self._proxy_http._timeout = timeout
|
7717
|
Train/png/7717.png
|
def gen_jcc(src, dst):
return ReilBuilder.build(ReilMnemonic.JCC, src, ReilEmptyOperand(), dst)
|
3
|
Train/png/3.png
|
def _route(self, attr, args, kwargs, **fkwargs):
return self.cluster.hosts.keys()
|
827
|
Train/png/827.png
|
def objectives(self, rank):
self._check_rank(rank)
return [result.obj for result in self.results[rank]]
|
1921
|
Train/png/1921.png
|
def plot_line(axes, fname, ltype):
x = np.genfromtxt(fname, unpack=True)
axes.plot(x[0], x[1], ltype)
|
275
|
Train/png/275.png
|
def getblock(self, hash: str) -> dict:
return cast(dict, self.api_fetch('getblock?hash=' + hash))
|
694
|
Train/png/694.png
|
def normalize(pw):
pw_lower = pw.lower()
return ''.join(helper.L33T.get(c, c) for c in pw_lower)
|
7025
|
Train/png/7025.png
|
def date(objet):
if objet:
return "{}/{}/{}".format(objet.day, objet.month, objet.year)
return ""
|
7234
|
Train/png/7234.png
|
def match(self, version):
return all(spec.match(version) for spec in self.specs)
|
5777
|
Train/png/5777.png
|
def folderitems(self):
items = super(AddAnalysesView, self).folderitems(classic=False)
return items
|
9399
|
Train/png/9399.png
|
def _print_version(ctx, _, value):
if not value or ctx.resilient_parsing:
return
click.echo(analyzer_version)
ctx.exit()
|
2540
|
Train/png/2540.png
|
def deleteData(self, offset: int, count: int) -> None:
self._delete_data(offset, count)
|
5540
|
Train/png/5540.png
|
def Publish(self, event_name, msg, delay=0):
events_lib.Events.PublishEvent(event_name, msg, delay=delay)
|
4130
|
Train/png/4130.png
|
def uniqify(list_):
"inefficient on long lists; short lists only. preserves order."
a = []
for x in list_:
if x not in a:
a.append(x)
return a
|
1080
|
Train/png/1080.png
|
def sort(self):
super(JSSObjectList, self).sort(key=lambda k: k.id)
|
1407
|
Train/png/1407.png
|
def _build_rhs(p, q, deriv):
b = [0 for _ in range(p+q+1)]
b[deriv] = math.factorial(deriv)
return np.array(b)
|
8882
|
Train/png/8882.png
|
def vline(self, x, y, height, color):
self.rect(x, y, 1, height, color, fill=True)
|
6545
|
Train/png/6545.png
|
def _dbg(self, level, msg):
if level <= self.debug:
print(msg, file=sys.stderr)
|
4243
|
Train/png/4243.png
|
def read_text(self, encoding='utf-8') -> str:
with self.open('r', encoding=encoding) as fp:
return fp.read()
|
4863
|
Train/png/4863.png
|
def children_sum(self, children, node):
return sum([self.value(value, node) for value in children])
|
420
|
Train/png/420.png
|
def free(self):
if self._ptr is None:
return
Gauged.map_free(self.ptr)
SparseMap.ALLOCATIONS -= 1
self._ptr = None
|
4973
|
Train/png/4973.png
|
def sub(self, repl, string, *args, **kwargs):
return self._pattern.sub(self._auto_compile(repl), string, *args, **kwargs)
|
6770
|
Train/png/6770.png
|
def clear_canvas(self):
self.fig = None
self.fmt = None
self._qpix_buffer = []
self.repaint()
|
187
|
Train/png/187.png
|
def pipes(stream, *transformers):
for transformer in transformers:
stream = stream.pipe(transformer)
return stream
|
8987
|
Train/png/8987.png
|
def cmServicePrompt():
a = TpPd(pd=0x5)
b = MessageType(mesType=0x25) # 00100101
c = PdAndSapi()
packet = a / b / c
return packet
|
7473
|
Train/png/7473.png
|
def get_tags(self):
res = self.get_request('/tag')
return [Tag(cloud_manager=self, **tag) for tag in res['tags']['tag']]
|
5620
|
Train/png/5620.png
|
def register_bec_task(self, *args, **kwargs):
kwargs["task_class"] = BecTask
return self.register_task(*args, **kwargs)
|
2912
|
Train/png/2912.png
|
def dim_lower_extent_dict(self):
return {d.name: d.lower_extent for d in self._dims.itervalues()}
|
10058
|
Train/png/10058.png
|
def random_color(_min=MIN_COLOR, _max=MAX_COLOR):
return color(random.randint(_min, _max))
|
5828
|
Train/png/5828.png
|
def arithmetic_mnemonic(self, op_name, op_type):
return self.OPERATIONS[op_name] + self.OPSIGNS[op_type]
|
9953
|
Train/png/9953.png
|
def remove_leaf_names(self):
self.visit(lambda n: setattr(n, 'name', None), lambda n: n.is_leaf)
|
8915
|
Train/png/8915.png
|
def section_areas(neurites, neurite_type=NeuriteType.all):
return map_sections(sectionfunc.section_area, neurites, neurite_type=neurite_type)
|
838
|
Train/png/838.png
|
def from_file(cls, path, environ):
instance = cls()
instance.read(path, environ)
return instance
|
5922
|
Train/png/5922.png
|
def send(self, msg):
self._router.broker.defer(self._send, msg)
|
1359
|
Train/png/1359.png
|
def generateAmplitudes(k):
res = np.array([np.random.random() for i in range(k)])
return res/res.sum()
|
6157
|
Train/png/6157.png
|
def _return(self, ary):
if isinstance(ary, Array):
return ary
return Array(ary, copy=False)
|
7368
|
Train/png/7368.png
|
def thresholds(self):
return numpy.array(
sorted(self._key2float(key) for key in self._coefs), dtype=float)
|
4111
|
Train/png/4111.png
|
def set_radians(self, angle):
self.x, self.y = math.cos(angle), math.sin(angle)
|
6188
|
Train/png/6188.png
|
def find_user_by_username(self, username):
return self.db_adapter.ifind_first_object(self.UserClass, username=username)
|
8840
|
Train/png/8840.png
|
def reduce(self, agg=operator.add, acc=None):
return self.submit_all().reduce(agg, acc)
|
1269
|
Train/png/1269.png
|
def _ensure_directory_exists(self, directory):
if not os.path.lexists(directory):
os.makedirs(directory)
return directory
|
1598
|
Train/png/1598.png
|
def update_image(self):
if self._image:
self._image.set_cmap(self.get_cmap())
_pylab.draw()
|
5973
|
Train/png/5973.png
|
def schunk(string, size):
return [string[i:i+size] for i in range(0, len(string), size)]
|
5123
|
Train/png/5123.png
|
def is_this_year(self):
return is_current_year(datetime.datetime.combine(self.date, datetime.time()))
|
7635
|
Train/png/7635.png
|
def add_def(self, def_item):
self.defs.append(def_item)
for other in self.others:
other.add_def(def_item)
|
5450
|
Train/png/5450.png
|
def _parse_scram_response(response):
return dict(item.split(b"=", 1) for item in response.split(b","))
|
957
|
Train/png/957.png
|
def getheader(self, name, default=None):
return self.aiohttp_response.headers.get(name, default)
|
1157
|
Train/png/1157.png
|
def set_node_description(self, node: BaseEntity, description: str) -> None:
self._set_node_attr(node, DESCRIPTION, description)
|
3717
|
Train/png/3717.png
|
def _connected(self, watcher, events):
self.connected = True
self._finish()
self.deferred.callback(self.sock)
|
7029
|
Train/png/7029.png
|
def _update(self):
self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(
len(self.collection), len(self.header)))
|
5680
|
Train/png/5680.png
|
def close(self):
if self._wavep:
self._wavep.close()
self._fp.close()
|
3905
|
Train/png/3905.png
|
def generate_uuid():
r_uuid = base64.urlsafe_b64encode(uuid.uuid4().bytes)
return r_uuid.decode().replace('=', '')
|
4546
|
Train/png/4546.png
|
def ReverseV2(a, axes):
idxs = tuple(slice(None, None, 2 * int(i not in axes) - 1)
for i in range(len(a.shape)))
return np.copy(a[idxs]),
|
153
|
Train/png/153.png
|
def cookies(self):
c = Cookie.SimpleCookie(self.getheader('set-cookie'))
return dict((i.key, i.value) for i in c.values())
|
5984
|
Train/png/5984.png
|
def get_nonoauth_parameters(self):
return dict([(k, v) for k, v in self.items()
if not k.startswith('oauth_')])
|
5954
|
Train/png/5954.png
|
def active_plan_summary(self):
return self.active().values("plan").order_by().annotate(count=models.Count("plan"))
|
481
|
Train/png/481.png
|
def use_size(self):
"Return the total used size, including children."
if self._nodes is None:
return self._use_size
return sum(i.use_size() for i in self._nodes)
|
5408
|
Train/png/5408.png
|
def _pick_attrs(attrs, keys):
return dict((k, v) for k, v in attrs.items() if k in keys)
|
2388
|
Train/png/2388.png
|
def read_proxy(fl):
outcore = ProxyRecord(data=pd.read_csv(
fl, sep=r'\s*\,\s*', index_col=None, engine='python'))
return outcore
|
9063
|
Train/png/9063.png
|
def get_names(cs):
records = []
for c in cs:
records.extend(c.get('names', []))
return records
|
6052
|
Train/png/6052.png
|
def set_head(self, node):
for head in self.head:
head.next.add(node)
self.head[:] = []
self.head.append(node)
|
1395
|
Train/png/1395.png
|
def get_duration(self):
doc = self._request(self.ws_prefix + ".getInfo", True)
return _number(_extract(doc, "duration"))
|
72
|
Train/png/72.png
|
def dump_string(writer, val):
await dump_varint(writer, len(val))
await writer.awrite(val)
|
3049
|
Train/png/3049.png
|
def _query(self, cmd, *datas):
cmd = Command(query=cmd)
return cmd.query(self._transport, self._protocol, *datas)
|
4405
|
Train/png/4405.png
|
def items(self):
l = []
for e in self.data:
l += e.items()
return l
|
8271
|
Train/png/8271.png
|
def log_if(level, msg, condition, *args):
if condition:
log(level, msg, *args)
|
9187
|
Train/png/9187.png
|
def _draw_text(self, pos, text, font, **kw):
self.drawables.append((pos, text, font, kw))
|
4224
|
Train/png/4224.png
|
def rm(self, typ, id):
return self._load(self._request(typ, id=id, method='DELETE'))
|
9800
|
Train/png/9800.png
|
def read_record(self, n):
self.file.seek(n * K - K)
return self.file.read(K)
|
7165
|
Train/png/7165.png
|
def _on_set_auth(self, sock, token):
self.log.info(f"Token received: {token}")
sock.setAuthtoken(token)
|
4464
|
Train/png/4464.png
|
def load(self, name, code):
source = "\n".join(code)
self._objects[name] = source
|
4635
|
Train/png/4635.png
|
def getcoordinates(self, tree, location):
return tuple(float(x) for x in tree.xpath('.//%s/*/text()' % location))
|
6341
|
Train/png/6341.png
|
def call(self, name, *a):
return callJavaFunc(self._sc, getattr(self._java_model, name), *a)
|
3508
|
Train/png/3508.png
|
def _post(self, url, params, uploads=None):
self._call(self.POST, url, params, uploads)
|
9432
|
Train/png/9432.png
|
def context(name):
def wrapper(func):
g.theme.context_processors[name] = func
return func
return wrapper
|
6570
|
Train/png/6570.png
|
def get_file_name(url):
return os.path.basename(urllib.parse.urlparse(url).path) or 'unknown_name'
|
7528
|
Train/png/7528.png
|
def rec(self):
try:
self._snapshot()
except Exception as e:
self.log("Timer error: ", e, type(e), lvl=error)
|
3893
|
Train/png/3893.png
|
def count(cls, name):
counter = cls.collection.find_one({'name': name}) or {}
return counter.get('seq', 0)
|
8365
|
Train/png/8365.png
|
def GetPattern(self):
stoptimes = self.GetStopTimes()
return tuple(st.stop for st in stoptimes)
|
3646
|
Train/png/3646.png
|
def append_scope(self):
self.stack.current.append(Scope(self.stack.current.current))
|
6620
|
Train/png/6620.png
|
def resume(self):
with self._wake:
self._paused = False
self._wake.notifyAll()
|
6250
|
Train/png/6250.png
|
def _bse_cli_lookup_by_role(args):
return api.lookup_basis_by_role(args.basis, args.role, args.data_dir)
|
4822
|
Train/png/4822.png
|
def RMSError(self):
tss = self.TSSError()
return math.sqrt(tss / self.size)
|
7409
|
Train/png/7409.png
|
def _get_cache_plus_key(self):
key = getattr(self, '_cache_key', self.key_from_query())
return self._cache.cache, key
|
8895
|
Train/png/8895.png
|
def set(self, block, name, value):
self._kvs.set(self._key(block, name), value)
|
8307
|
Train/png/8307.png
|
def close(self):
if self._connection:
self._connection.close()
self._response.close()
|
4992
|
Train/png/4992.png
|
def subscribe(self, subscription):
url = urljoin(self._url, '/subscriptions')
return subscription.post(url)
|
6670
|
Train/png/6670.png
|
def xpatherror(self, file, line, no):
libxml2mod.xmlXPatherror(self._o, file, line, no)
|
1532
|
Train/png/1532.png
|
def alloc_vlan(self, net_id):
vlan_id = self.service_vlans.allocate_segmentation_id(
net_id, source=fw_const.FW_CONST)
return vlan_id
|
7091
|
Train/png/7091.png
|
def referenced(word, article=INDEFINITE, gender=MALE, role=SUBJECT):
return "%s %s" % (_article(word, article, gender, role), word)
|
2833
|
Train/png/2833.png
|
def get_magnitude(self):
return math.sqrt(self.x*self.x + self.y*self.y)
|
1711
|
Train/png/1711.png
|
def value(self):
from abilian.services.repository import session_repository as repository
repository.delete(self, self.uuid)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.