common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
9326
|
Train/png/9326.png
|
def domains(self):
return self._h._get_resources(
resource=('apps', self.name, 'domains'),
obj=Domain, app=self
)
|
5821
|
Train/png/5821.png
|
def fetchall(self) -> Iterable[sqlite3.Row]:
return await self._execute(self._cursor.fetchall)
|
6553
|
Train/png/6553.png
|
def clear(self):
for key in self.conn.keys():
self.conn.delete(key)
|
4804
|
Train/png/4804.png
|
def read(self, fp):
"Reads a dictionary from an input stream."
base_size = struct.unpack(str("=I"), fp.read(4))[0]
self._units.fromfile(fp, base_size)
|
341
|
Train/png/341.png
|
def day(self):
self.magnification = 86400
self._update(self.baseNumber, self.magnification)
return self
|
7223
|
Train/png/7223.png
|
def _get(self, url, query=None, **kwargs):
return self._request('get', url, query, **kwargs)
|
5383
|
Train/png/5383.png
|
def all_subclasses(cls):
for s in cls.__subclasses__():
yield s
for c in s.all_subclasses():
yield c
|
8807
|
Train/png/8807.png
|
def waveform_length(X):
return np.sum(np.abs(np.diff(X, axis=1)), axis=1)
|
8753
|
Train/png/8753.png
|
def get_vec_lr(self):
return self.width * self.cos_a(), -self.width * self.sin_a()
|
3813
|
Train/png/3813.png
|
def register(self):
log.info('Installing ssh key, %s' % self.name)
self.consul.create_ssh_pub_key(self.name, self.key)
|
4409
|
Train/png/4409.png
|
def compress(obj):
return json.dumps(obj, sort_keys=True, separators=(',', ':'),
cls=CustomEncoder)
|
834
|
Train/png/834.png
|
def now_micros(absolute=False) -> int:
micros = int(time.time() * 1e6)
if absolute:
return micros
return micros - EPOCH_MICROS
|
3973
|
Train/png/3973.png
|
def prettyprint(self):
return json.dumps(self.asJSON(), sort_keys=True, indent=4, separators=(',', ': '))
|
314
|
Train/png/314.png
|
def remove_span(self, span):
this_node = span.get_node()
self.node.remove(this_node)
|
3875
|
Train/png/3875.png
|
def write(self, path):
with codecs.open(path, 'w', encoding='utf-8') as f:
f.write(self.text)
|
3103
|
Train/png/3103.png
|
def add_table(self, t):
self.push_element()
self._page.append(t.node)
self.cur_element = t
|
5435
|
Train/png/5435.png
|
def send_bytes(self):
data = b''.join(self.bytes_to_send)
self.bytes_to_send = []
return data
|
383
|
Train/png/383.png
|
def confirms(self, txid):
txid = deserialize.txid(txid)
return self.service.confirms(txid)
|
3894
|
Train/png/3894.png
|
def depipe(s):
n = 0
for i in reversed(s.split('|')):
n = n / 60.0 + float(i)
return n
|
2087
|
Train/png/2087.png
|
def sync(self):
for i in range(4):
self.elk.send(ps_encode(i))
self.get_descriptions(TextDescriptions.LIGHT.value)
|
7903
|
Train/png/7903.png
|
def n_chunks(self):
return self._data_source.n_chunks(self.chunksize, stride=self.stride, skip=self.skip)
|
173
|
Train/png/173.png
|
def log(*texts, sep=""):
text = sep.join(texts)
count = text.count("\n")
just_log("\n" * count, *get_time(), text.replace("\n", ""), sep=sep)
|
5366
|
Train/png/5366.png
|
def topics(self):
return set(node.tag for node in self.root.iter() if node.attrib)
|
8506
|
Train/png/8506.png
|
def _get_geometry(self):
return shapely.geometry.MultiPolygon([bbox.geometry for bbox in self.bbox_list])
|
6168
|
Train/png/6168.png
|
def get_error_codes(cls) -> Iterable[str]:
for group in cls.groups:
for error in group.errors:
yield error.code
|
7406
|
Train/png/7406.png
|
def has_urls(self):
"Handy for templates."
if self.isbn_uk or self.isbn_us or self.official_url or self.notes_url:
return True
else:
return False
|
2896
|
Train/png/2896.png
|
def length(self):
return math.sqrt((self.X * self.X) + (self.Y * self.Y))
|
5411
|
Train/png/5411.png
|
def datetime_to_timestamp(dt):
delta = dt - datetime.utcfromtimestamp(0)
return delta.seconds + delta.days * 24 * 3600
|
6688
|
Train/png/6688.png
|
def parse_timestamp(timestamp):
dt = dateutil.parser.parse(timestamp)
return dt.astimezone(dateutil.tz.tzutc())
|
7346
|
Train/png/7346.png
|
def text(self):
if callable(self._text):
return str(self._text())
return str(self._text)
|
9297
|
Train/png/9297.png
|
def characters(self, numberOfCharacters):
return self.code[self.index:self.index + numberOfCharacters]
|
2979
|
Train/png/2979.png
|
def rev(self, i):
on = copy(self)
on.revision = i
return on
|
9531
|
Train/png/9531.png
|
def file_exists(self) -> bool:
cfg_path = self.file_path
assert cfg_path
return path.isfile(cfg_path)
|
6067
|
Train/png/6067.png
|
def title(self, category):
return sum(
[self.getWidth(category, x) for x in self.fields])
|
6451
|
Train/png/6451.png
|
def rand_crop(*args, padding_mode='reflection', p: float = 1.):
"Randomized version of `crop_pad`."
return crop_pad(*args, **rand_pos, padding_mode=padding_mode, p=p)
|
7909
|
Train/png/7909.png
|
def Ctt_(self):
self._check_estimated()
return self._rc.cov_YY(bessel=self.bessel)
|
4776
|
Train/png/4776.png
|
def from_file(cls, filename, sr=22050):
y, sr = librosa.load(filename, sr=sr)
return cls(y, sr)
|
7281
|
Train/png/7281.png
|
def chunks(container, n):
for i in range(0, len(container), n):
yield container[i: i + n]
|
5464
|
Train/png/5464.png
|
def fit_linear(X, y):
model = linear_model.LinearRegression()
model.fit(X, y)
return model
|
3538
|
Train/png/3538.png
|
def aliasstr(self):
return ', '.join(repr(self.ns + x) for x in self.aliases)
|
6196
|
Train/png/6196.png
|
def get_op_symbol(obj, fmt='%s', symbol_data=symbol_data, type=type):
return fmt % symbol_data[type(obj)]
|
6172
|
Train/png/6172.png
|
def title(self):
with switch_window(self._browser, self.name):
return self._browser.title
|
2452
|
Train/png/2452.png
|
def run_thread(self):
self._run_thread = True
self._thread.setDaemon(True)
self._thread.start()
|
525
|
Train/png/525.png
|
def neighbors(self, key):
return {n: attr["bond"] for n, attr in self.graph[key].items()}
|
79
|
Train/png/79.png
|
def get_filename(self, year):
res = self.fldr + os.sep + self.type + year + '.' + self.user
return res
|
1667
|
Train/png/1667.png
|
def finish_plot():
plt.legend()
plt.grid(color='0.7')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
|
6037
|
Train/png/6037.png
|
def safe_open(filename, *args, **kwargs):
safe_mkdir_for(filename)
return open(filename, *args, **kwargs)
|
458
|
Train/png/458.png
|
def _connect(self):
log.debug("Connecting to JLigier")
self.socket = socket.socket()
self.socket.connect((self.host, self.port))
|
5817
|
Train/png/5817.png
|
def _execute(self, fn, *args, **kwargs):
return await self._conn._execute(fn, *args, **kwargs)
|
869
|
Train/png/869.png
|
def filter_products(self, desired_prods):
self.filter_prods = True
self.desired_prods = set(desired_prods)
|
346
|
Train/png/346.png
|
def refresh(self):
self.trace(list(self._fnames.keys()), _refresh=True)
|
4572
|
Train/png/4572.png
|
def clear(self):
'Clear tracks in memory - all zero'
for track in self._tracks:
self._tracks[track].setall(False)
|
5527
|
Train/png/5527.png
|
def MarkDone(self, responses):
client_id = responses.request.client_id
self.AddResultsToCollection(responses, client_id)
self.MarkClientDone(client_id)
|
2774
|
Train/png/2774.png
|
def is_valid(number):
n = str(number)
if not n.isdigit():
return False
return int(n[-1]) == get_check_digit(n[:-1])
|
3302
|
Train/png/3302.png
|
def create_fpath_dir(self, fpath: str):
os.makedirs(os.path.dirname(fpath), exist_ok=True)
|
5819
|
Train/png/5819.png
|
def executescript(self, sql_script: str) -> None:
await self._execute(self._cursor.executescript, sql_script)
|
56
|
Train/png/56.png
|
def state_push(self):
super(Composite, self).state_push()
for gen in self.generators:
gen.state_push()
|
5776
|
Train/png/5776.png
|
def Description(self):
descr = " ".join((self.getId(), self.aq_parent.Title()))
return safe_unicode(descr).encode('utf-8')
|
4297
|
Train/png/4297.png
|
def write(url, content, **args):
with FTPSResource(url, **args) as resource:
resource.write(content)
|
7789
|
Train/png/7789.png
|
def to_csr(self):
self._X_train = csr_matrix(self._X_train)
self._X_test = csr_matrix(self._X_test)
|
8424
|
Train/png/8424.png
|
def write_data(self, command, data, timeout=None):
self.write_message(
FilesyncMessageTypes.DataMessage(command, data), timeout)
|
8715
|
Train/png/8715.png
|
def on_paint(self, event):
dc = wx.AutoBufferedPaintDC(self)
dc.DrawBitmap(self._bmp, 0, 0)
|
8675
|
Train/png/8675.png
|
def H(self) -> 'Kraus':
operators = [op.H for op in self.operators]
return Kraus(operators, self.weights)
|
304
|
Train/png/304.png
|
def load_checkers():
for loader, name, _ in pkgutil.iter_modules([os.path.join(__path__[0], 'checkers')]):
loader.find_module(name).load_module(name)
|
5722
|
Train/png/5722.png
|
def array(arr, *args, **kwargs):
return weldarray(np.array(arr, *args, **kwargs))
|
3858
|
Train/png/3858.png
|
def dot_v2(vec1, vec2):
return vec1.x * vec2.x + vec1.y * vec2.y
|
9519
|
Train/png/9519.png
|
def escapeForIRI(xri):
xri = xri.replace('%', '%25')
xri = _xref_re.sub(_escape_xref, xri)
return xri
|
494
|
Train/png/494.png
|
def parse_datetime(dt_str):
date_format = "%Y-%m-%dT%H:%M:%S %z"
dt_str = dt_str.replace("Z", " +0000")
return datetime.datetime.strptime(dt_str, date_format)
|
9759
|
Train/png/9759.png
|
def maptag(tagname, contents):
return u''.join(tag(tagname, item) for item in contents)
|
1198
|
Train/png/1198.png
|
def _tf_squared_euclidean(X, Y):
return tf.reduce_sum(tf.pow(tf.subtract(X, Y), 2), axis=1)
|
667
|
Train/png/667.png
|
def get_all(self, qry, tpl):
self.cur.execute(qry, tpl)
result = self.cur.fetchall()
return result
|
6644
|
Train/png/6644.png
|
def provide_data(self):
return [(k, tuple([self.batch_size] + list(v.shape[1:]))) for k, v in self.data]
|
2433
|
Train/png/2433.png
|
def yesterday(self) -> datetime:
self.value = datetime.today() - timedelta(days=1)
return self.value
|
8494
|
Train/png/8494.png
|
def _forget_annot(self, annot):
aid = id(annot)
if aid in self._annot_refs:
self._annot_refs[aid] = None
|
7512
|
Train/png/7512.png
|
def to_jd(year, month, day):
return (day + ceil(29.5 * (month - 1)) + (year - 1) * 354 + trunc((3 + (11 * year)) / 30) + EPOCH) - 1
|
10063
|
Train/png/10063.png
|
def disconnect(self, connection):
proto = self._protocols.pop(connection)
proto.transport = None
return {}
|
9072
|
Train/png/9072.png
|
def records(self):
return ModelList(*[r for sent in self.sentences for r in sent.records])
|
8267
|
Train/png/8267.png
|
def stop(self):
self.working = False
for w in self.workers:
w.join()
self.workers = []
|
3661
|
Train/png/3661.png
|
def _options():
opts = sys.argv[1:]
return [click.Option((v.split('=')[0],)) for v in opts
if v[0] == '-' and v != '--help']
|
7892
|
Train/png/7892.png
|
def st_mtime(self):
mtime = self._st_mtime_ns / 1e9
return mtime if self.use_float else int(mtime)
|
1254
|
Train/png/1254.png
|
def humidity_unit(self):
if CONST.UNIT_PERCENT in self._get_status(CONST.HUMI_STATUS_KEY):
return CONST.UNIT_PERCENT
return None
|
6203
|
Train/png/6203.png
|
def be_array_from_bytes(fmt, data):
arr = array.array(str(fmt), data)
return fix_byteorder(arr)
|
622
|
Train/png/622.png
|
def params(self, dict):
self._configuration.update(dict)
self._measurements.update()
|
2582
|
Train/png/2582.png
|
def seconds(num):
now = pytime.time()
end = now + num
until(end)
|
2367
|
Train/png/2367.png
|
def preprocess(net, image):
return np.float32(np.rollaxis(image, 2)[::-1]) - net.transformer.mean["data"]
|
892
|
Train/png/892.png
|
def normaliseWV(wV, normFac=1.0):
f = sum(wV) / normFac
return [i/f for i in wV]
|
8984
|
Train/png/8984.png
|
def uplinkBusy():
name = "Uplink Busy"
a = TpPd(pd=0x6)
b = MessageType(mesType=0x2a) # 00101010
packet = a / b
return packet
|
5419
|
Train/png/5419.png
|
def read_large_int(self, bits, signed=True):
return int.from_bytes(
self.read(bits // 8), byteorder='little', signed=signed)
|
6953
|
Train/png/6953.png
|
def set_default_masses(self):
self.masses = np.array([periodic[n].mass for n in self.numbers])
|
1151
|
Train/png/1151.png
|
def has_edge_citation(self, u: BaseEntity, v: BaseEntity, key: str) -> bool:
return self._has_edge_attr(u, v, key, CITATION)
|
4324
|
Train/png/4324.png
|
def parse_to_tree(text):
xml_text = cabocha.as_xml(text)
tree = Tree(xml_text)
return tree
|
1653
|
Train/png/1653.png
|
def _get_type(self, obj):
typever = obj['Type']
typesplit = typever.split('.')
return typesplit[0] + '.' + typesplit[1]
|
7919
|
Train/png/7919.png
|
def draw_on(self, folium_map):
f = getattr(folium_map, self._map_method_name)
f(**self._folium_kwargs)
|
2535
|
Train/png/2535.png
|
def selectedOptions(self) -> NodeList:
return NodeList(list(opt for opt in self.options if opt.selected))
|
5521
|
Train/png/5521.png
|
def MemoryExceeded(self):
rss_size = self.proc.memory_info().rss
return rss_size // 1024 // 1024 > config.CONFIG["Client.rss_max"]
|
7233
|
Train/png/7233.png
|
def connections(self):
self._check_session()
status, data = self._rest.get_request('connections')
return data
|
5218
|
Train/png/5218.png
|
def H11(self):
"Difference entropy."
return -(self.p_xminusy * np.log(self.p_xminusy + self.eps)).sum(1)
|
9332
|
Train/png/9332.png
|
def _get_end_index(self):
return max(self.index + self.source_window,
self._get_target_index() + self.target_window)
|
2213
|
Train/png/2213.png
|
def insertLine(self, i):
self.data.insert(i, CSVEntry(self))
return self.lines[i]
|
6702
|
Train/png/6702.png
|
def set_rich_text_font(self, font):
self.rich_text.set_font(font, fixed_font=self.get_plugin_font())
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.