common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
1826
|
Train/png/1826.png
|
def state(self, state: str) -> None:
self._state = state
for callback in self._callbacks:
callback()
|
2490
|
Train/png/2490.png
|
def resetPassword(self, userId):
self._setHeaders('resetPassword')
return self._sforce.service.resetPassword(userId)
|
1386
|
Train/png/1386.png
|
def simplices(self):
return [Simplex([self.points[i] for i in v]) for v in self.vertices]
|
8942
|
Train/png/8942.png
|
def change_octave(self, diff):
self.octave += diff
if self.octave < 0:
self.octave = 0
|
4511
|
Train/png/4511.png
|
def set_value(self, string_value):
value = self.validate_value(string_value)
self._value[self._channel._selected] = value
|
1087
|
Train/png/1087.png
|
def _radec(self, *args, **kwargs):
lbd = self._lbd(*args, **kwargs)
return coords.lb_to_radec(lbd[:, 0], lbd[:, 1], degree=True, epoch=None)
|
3199
|
Train/png/3199.png
|
def left_to_right(self):
self._entry_mode |= Command.MODE_INCREMENT
self.command(self._entry_mode)
|
2612
|
Train/png/2612.png
|
def _save(file, data, mode='w+'):
with open(file, mode) as fh:
fh.write(data)
|
9895
|
Train/png/9895.png
|
def get_out_file(self, ending='rst'):
return os.path.splitext(self.outfile)[0] + os.path.extsep + ending
|
6272
|
Train/png/6272.png
|
def main_photo(self):
if not self._main_photo:
self._main_photo = self.photos_factory()
return self._main_photo
|
840
|
Train/png/840.png
|
def infohash_base32(self):
self.validate()
info = self.convert()[b'info']
return b32encode(sha1(bencode(info)).digest())
|
7658
|
Train/png/7658.png
|
def add_loss(self, loss, name=None):
self.bookkeeper.add_loss(loss, name=name)
return Loss(self.bookkeeper, tensor=loss, name=name)
|
1227
|
Train/png/1227.png
|
def rigthgen(self, value=0):
while True:
yield self.newarray(self.nplanes_right * self.width, value)
|
4218
|
Train/png/4218.png
|
def remove_tag(self, resource_type, resource_id, tag, **_params):
return self.delete(self.tag_path % (resource_type, resource_id, tag))
|
4595
|
Train/png/4595.png
|
def company(anon, obj, field, val):
return anon.faker.company(field=field)
|
2461
|
Train/png/2461.png
|
def get_center(self):
return Point((self.p1.x+self.p2.x)/2.0, (self.p1.y+self.p2.y)/2.0)
|
4216
|
Train/png/4216.png
|
def add_tag(self, resource_type, resource_id, tag, **_params):
return self.put(self.tag_path % (resource_type, resource_id, tag))
|
6306
|
Train/png/6306.png
|
def python(self, func, *args, **kwargs):
self.ops.append(lambda: func(*args, **kwargs))
|
3151
|
Train/png/3151.png
|
def add_feed(url):
with Database("feeds") as db:
title = feedparser.parse(url).feed.title
name = str(title)
db[name] = url
return name
|
3959
|
Train/png/3959.png
|
def split_data(data, subset, splits):
return dict([(k, data[k][splits[subset]]) for k in data])
|
9005
|
Train/png/9005.png
|
def attachComplete():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x3) # 00000011
packet = a / b
return packet
|
9548
|
Train/png/9548.png
|
def read_plain_byte_array(file_obj, count):
return [file_obj.read(struct.unpack(b"<i", file_obj.read(4))[0]) for i in range(count)]
|
5894
|
Train/png/5894.png
|
def get_json(file_name='../dxf.json.template'):
with open(file_name, 'r') as f:
t = json.load(f)
return t
|
3996
|
Train/png/3996.png
|
def bind_and_save(self, lxc):
bound_meta = self.bind(lxc)
bound_meta.save()
return bound_meta
|
8262
|
Train/png/8262.png
|
def _iter_keys_as_str(key):
for i in range(winreg.QueryInfoKey(key)[0]):
yield winreg.EnumKey(key, i)
|
182
|
Train/png/182.png
|
def write(self, *args, **kwargs):
return self.stream.write(ending="", *args, **kwargs)
|
7982
|
Train/png/7982.png
|
def pre_scan(self):
escape_re = re.compile(r'\\\n[\t ]+')
self.source = escape_re.sub('', self.source)
|
1044
|
Train/png/1044.png
|
def get_root_uri(uri):
chunks = urlsplit(uri)
return urlunsplit((chunks.scheme, chunks.netloc, chunks.path, '', ''))
|
6389
|
Train/png/6389.png
|
def clear_imgs(self) -> None:
"Clear the widget's images preview pane."
self._preview_header.value = self._heading
self._img_pane.children = tuple()
|
988
|
Train/png/988.png
|
def deltaStarsRaDecDeg1(ra1_deg, dec1_deg, ra2_deg, dec2_deg):
phi, dist = dispos(ra1_deg, dec1_deg, ra2_deg, dec2_deg)
return arcsecToDeg(dist * 60.0)
|
5548
|
Train/png/5548.png
|
def process_response(self, request, response, resource, req_succeeded):
self.logger.info(self._generate_combined_log(request, response))
|
7700
|
Train/png/7700.png
|
def _print_memory(self, memory):
for addr, value in memory.items():
print(" 0x%08x : 0x%08x (%d)" % (addr, value, value))
|
745
|
Train/png/745.png
|
def get_export_table(self):
symbols = self.binary.DIRECTORY_ENTRY_EXPORT.symbols
names = AttrsGetter(symbols, join=False).name
return names
|
8181
|
Train/png/8181.png
|
def set_unavailable(self):
show = PresenceShow.NONE
self.set_presence(PresenceState(available=False, show=show))
|
7569
|
Train/png/7569.png
|
def result(self):
# Module(body=[Expr(value=...)])
return self.eval_(ast.parse(self.expr).body[0].value)
|
3111
|
Train/png/3111.png
|
def root(self, value):
self._xml = t2s(value)
self._root = value
|
8600
|
Train/png/8600.png
|
def _count_values(self):
indices = {yi: [i] for i, yi in enumerate(self.y) if self.status[i]}
return indices
|
6758
|
Train/png/6758.png
|
def clear_selection(self):
cursor = self.textCursor()
cursor.clearSelection()
self.setTextCursor(cursor)
|
7434
|
Train/png/7434.png
|
def _mem(self):
value = int(psutil.virtual_memory().percent)
set_metric("memory", value, category=self.category)
gauge("memory", value)
|
684
|
Train/png/684.png
|
def tasks(self):
tasks_response = self.get_request('tasks/')
return [Task(self, tjson['task']) for tjson in tasks_response]
|
5126
|
Train/png/5126.png
|
def _batch_key(self, query):
return ''.join(['%s%s' % (k, v) for k, v in sorted(query.items())])
|
4715
|
Train/png/4715.png
|
def level(self):
ev = self._query_waiters.request(self.__do_query_level)
ev.wait(1.0)
return self._level
|
1410
|
Train/png/1410.png
|
def delayed_close(self):
self.state = CLOSING
self.server.io_loop.add_callback(self.close)
|
3629
|
Train/png/3629.png
|
def send(self, request):
return self.session.send(request(self.url, self.auth))
|
5105
|
Train/png/5105.png
|
def ptake(n: int, xs: Iterable[T]) -> Iterable[T]:
return tqdm(take(n, xs), total=n)
|
8051
|
Train/png/8051.png
|
def reload(self):
self.read_notmuch_config(self._notmuchconfig.filename)
self.read_config(self._config.filename)
|
5336
|
Train/png/5336.png
|
def _content_blocks(self, r):
return (self._block_rows - self._left_zero_blocks(r)
- self._right_zero_blocks(r))
|
9598
|
Train/png/9598.png
|
def _machine_eps(dtype):
if isinstance(dtype, tf.DType):
dtype = dtype.as_numpy_dtype()
return np.finfo(dtype).eps
|
9699
|
Train/png/9699.png
|
def show_node(self, node):
if self.config.show_builtin:
return True
return node.root().name != BUILTINS_NAME
|
2221
|
Train/png/2221.png
|
def newEntry(self, ident="", seq="", plus="", qual=""):
e = FastqEntry()
self.data.append(e)
return e
|
4019
|
Train/png/4019.png
|
def to_vcards(self):
self._update()
return [self._to_vcard(self._book[entry]) for entry in self._book.sections()]
|
732
|
Train/png/732.png
|
def query_decl(self, **kwargs):
return self.session.query(Decl).filter_by(**kwargs).all()
|
2848
|
Train/png/2848.png
|
def get_labels(labels):
label_u = unique_labels(labels)
label_u_line = [i + "_line" for i in label_u]
return label_u, label_u_line
|
5990
|
Train/png/5990.png
|
def items(self, obj):
return TaggedItem.objects.get_by_model(
Entry.published.all(), obj)[:self.limit]
|
8707
|
Train/png/8707.png
|
def tile_to_path(self, tile):
return os.path.join(self.cache_path, self.service, tile.path())
|
1379
|
Train/png/1379.png
|
def append(self, other: 'List') -> 'List':
if self.null():
return other
return (self.tail().append(other)).cons(self.head())
|
634
|
Train/png/634.png
|
def link_empty_favicon_fallback(self):
self.favicon_fallback = os.path.join(
os.path.dirname(__file__), 'favicon.ico')
|
9522
|
Train/png/9522.png
|
def _doc_rev(self, res):
jstr = res.headers['X-Couchbase-Meta']
jobj = json.loads(jstr)
return jobj['rev']
|
4722
|
Train/png/4722.png
|
def _mean_dict(dict_list):
return {k: np.array([d[k] for d in dict_list]).mean()
for k in dict_list[0].keys()}
|
3163
|
Train/png/3163.png
|
def molmz(df, noise=10000):
d = ((df.values > noise) * df.columns).max(axis=1)
return Trace(d, df.index, name='molmz')
|
8379
|
Train/png/8379.png
|
def rlogistic(mu, tau, size=None):
u = np.random.random(size)
return mu + np.log(u / (1 - u)) / tau
|
9582
|
Train/png/9582.png
|
def acgt_match(string):
search = re.compile(r'[^ACGT]').search
return not bool(search(string))
|
5858
|
Train/png/5858.png
|
def mget(self, key, *keys, encoding=_NOTSET):
return self.execute(b'MGET', key, *keys, encoding=encoding)
|
3320
|
Train/png/3320.png
|
def get_wordset(poems):
words = sorted(list(set(reduce(lambda x, y: x + y, poems))))
return words
|
8643
|
Train/png/8643.png
|
def print_err(*args, end='\n'):
print(*args, end=end, file=sys.stderr)
sys.stderr.flush()
|
492
|
Train/png/492.png
|
def sha256(content):
if isinstance(content, str):
content = content.encode('utf-8')
return hashlib.sha256(content).hexdigest()
|
1618
|
Train/png/1618.png
|
def _mysql_aes_key(key):
final_key = bytearray(16)
for i, c in enumerate(key):
final_key[i % 16] ^= key[i] if PY3 else ord(key[i])
return bytes(final_key)
|
10077
|
Train/png/10077.png
|
def t_LE(self, t):
r"\<\="
t.endlexpos = t.lexpos + len(t.value)
return t
|
994
|
Train/png/994.png
|
def panset_cb(self, setting, value, chviewer, info):
return self.panset(chviewer, info.chinfo)
|
2261
|
Train/png/2261.png
|
def link2html(text):
match = r'\[([^\]]+)\]\(([^)]+)\)'
replace = r'<a href="\2">\1</a>'
return re.sub(match, replace, text)
|
6493
|
Train/png/6493.png
|
def add_metrics(self, metrics: Iterable[float]) -> None:
for metric in metrics:
self.add_metric(metric)
|
3948
|
Train/png/3948.png
|
def set_attribute(self, code, value):
attr, _ = self.get_or_create(code=code)
attr.value = value
attr.save()
|
913
|
Train/png/913.png
|
def name(self):
return self.inquire(name=True, lifetime=False,
usage=False, mechs=False).name
|
8158
|
Train/png/8158.png
|
def _resource_dump(pe, res):
rva = res.data.struct.OffsetToData
size = res.data.struct.Size
dump = pe.get_data(rva, size)
return dump
|
2707
|
Train/png/2707.png
|
def upload_file(token, channel_name, file_name):
slack = Slacker(token)
slack.files.upload(file_name, channels=channel_name)
|
3059
|
Train/png/3059.png
|
def unShare(sharedItem):
sharedItem.store.query(Share, Share.sharedItem ==
sharedItem).deleteFromStore()
|
1551
|
Train/png/1551.png
|
def wait(self, timeout=None):
if self._thread is None:
return
self._thread.join(timeout=timeout)
|
379
|
Train/png/379.png
|
def startMultiple(self, zones):
path = 'zone/start_multiple'
payload = {'zones': zones}
return self.rachio.put(path, payload)
|
3558
|
Train/png/3558.png
|
def write_long(self, number):
buf = pack(self.byte_order + "q", number)
self.write(buf)
|
4559
|
Train/png/4559.png
|
def Any(a, axis, keep_dims):
return np.any(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis),
keepdims=keep_dims),
|
8084
|
Train/png/8084.png
|
def _modname(path):
base = os.path.basename(path)
filename, ext = os.path.splitext(base)
return filename
|
10073
|
Train/png/10073.png
|
def basic_transform(val):
if isinstance(val, int):
return struct.pack('>i', val)
else:
return safe_lower_utf8(val)
|
6412
|
Train/png/6412.png
|
def data_collate(batch: ItemsList) -> Tensor:
"Convert `batch` items to tensor data."
return torch.utils.data.dataloader.default_collate(to_data(batch))
|
8754
|
Train/png/8754.png
|
def get_vec_tb(self):
return self.height * self.sin_a(), self.height * self.cos_a()
|
5176
|
Train/png/5176.png
|
def add_child(self, child):
child.parent = self
self.children.append(child)
return child
|
3223
|
Train/png/3223.png
|
def get_content_title(self, obj):
return Content.objects.get(id=obj.content.id).title
|
1858
|
Train/png/1858.png
|
def on_save_as(self):
self.tabWidget.save_current_as()
self._update_status_bar(self.tabWidget.current_widget())
|
6992
|
Train/png/6992.png
|
def register(cache):
global caches
name = cache().name
if not caches.has_key(name):
caches[name] = cache
|
271
|
Train/png/271.png
|
def start(self, *args, **kwargs):
self._stop = False
super(Plant, self).start(*args, **kwargs)
|
9947
|
Train/png/9947.png
|
def main(properties=properties, options=options, **custom_options):
return init(**dict(options, **custom_options))(**properties)
|
6754
|
Train/png/6754.png
|
def get_array_shape(self, key):
data = self.model.get_data()
return data[key].shape
|
2940
|
Train/png/2940.png
|
def write(self, path):
with open(path, 'wb') as f:
f.write(self.getXML())
|
1373
|
Train/png/1373.png
|
def save(self):
self.session.add(self)
self.session.flush()
return self
|
6984
|
Train/png/6984.png
|
def can_into(self, val: str) -> bool:
return val in self.paths or (self.param and self.param_name == val)
|
881
|
Train/png/881.png
|
def set_entry(self, filename, obj):
self.entries[filename] = obj
self.dirty = True
|
6653
|
Train/png/6653.png
|
def newNode(name):
ret = libxml2mod.xmlNewNode(name)
if ret is None:
raise treeError('xmlNewNode() failed')
return xmlNode(_obj=ret)
|
3554
|
Train/png/3554.png
|
def nin(self, qfield, *values):
self.__query_obj.nin(qfield, *values)
return self
|
5507
|
Train/png/5507.png
|
def Delete(self):
args = user_management_pb2.ApiDeleteGrrUserArgs(username=self.username)
self._context.SendRequest("DeleteGrrUser", args)
|
4176
|
Train/png/4176.png
|
def update_endpoint_group(self, endpoint_group, body=None):
return self.put(self.endpoint_group_path % endpoint_group, body=body)
|
7834
|
Train/png/7834.png
|
def write(self, handle):
handle.write(u"\t".join(self.columns))
handle.write(u"\n")
for row in self.rows:
row.write(handle)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.