common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
5611
|
Train/png/5611.png
|
def register_nscf_task(self, *args, **kwargs):
kwargs["task_class"] = NscfTask
return self.register_task(*args, **kwargs)
|
9130
|
Train/png/9130.png
|
def shortcuts(self):
return {name: action.shortcut
for name, action in self._actions_dict.items()}
|
8967
|
Train/png/8967.png
|
def _npiter(arr):
for a in np.nditer(arr, flags=["refs_ok"]):
c = a.item()
if c is not None:
yield c
|
4999
|
Train/png/4999.png
|
def _ufo_logging_ref(ufo):
if ufo.path:
return os.path.basename(ufo.path)
return ufo.info.styleName
|
6574
|
Train/png/6574.png
|
def add_tags(self, *tags):
self.tags.extend([
Tag(name=tag) for tag in tags
])
|
6868
|
Train/png/6868.png
|
def _station(self) -> str:
return str(self.obj.SBRes.SBReq.Start.Station.HafasName.Text.pyval)
|
8955
|
Train/png/8955.png
|
def getDayStart(self, dateTime):
return ensure_localtime(dateTime).replace(hour=0, minute=0, second=0, microsecond=0)
|
7566
|
Train/png/7566.png
|
def _before_request(self):
g._request_id = str(uuid.uuid4())
g._start_timestamp = time.time()
|
8701
|
Train/png/8701.png
|
def set_popup_menu(self, menu):
self.popup_menu = menu
self.in_queue.put(MPImagePopupMenu(menu))
|
1310
|
Train/png/1310.png
|
def do_layout(self, *args):
if self.size == [1, 1]:
return
for i in range(0, len(self.decks)):
self.layout_deck(i)
|
5640
|
Train/png/5640.png
|
def SdkSetup(self):
if self.vc_ver > 9.0:
return []
return [os.path.join(self.si.WindowsSdkDir, 'Setup')]
|
3720
|
Train/png/3720.png
|
def get_month_start_end_day():
t = date.today()
n = mdays[t.month]
return (date(t.year, t.month, 1), date(t.year, t.month, n))
|
7487
|
Train/png/7487.png
|
def stop(self):
self.stopped = True
self.loop_event.set()
# Waiting for shutdown of loop()
await self.stopped_event.wait()
|
3684
|
Train/png/3684.png
|
def case_us2mc(x):
return re.sub(r'_([a-z])', lambda m: (m.group(1).upper()), x)
|
8640
|
Train/png/8640.png
|
def country_list_nlp(cts):
ct_nlp = []
for i in cts.keys():
nlped = nlp(i)
ct_nlp.append(nlped)
return ct_nlp
|
8401
|
Train/png/8401.png
|
def write(self, buf):
return self.transport_sock.sendto(
buf,
(self.transport_host, self.transport_port)
)
|
662
|
Train/png/662.png
|
def do_ctrlc(self, arg):
print('STOP')
if self.arm.is_connected():
self.arm.write('STOP')
|
6776
|
Train/png/6776.png
|
def parse(self, s):
return datetime.datetime.strptime(s, self.date_format).date()
|
293
|
Train/png/293.png
|
def process_result_value(self, value, dialect):
if value is not None:
value = simplejson.loads(value)
return value
|
4872
|
Train/png/4872.png
|
def delete(self, uri, query=None, **kwargs):
return self.fetch('delete', uri, query, **kwargs)
|
5710
|
Train/png/5710.png
|
def uint32_to_uint8(cls, img):
return np.flipud(img.view(dtype=np.uint8).reshape(img.shape + (4,)))
|
1133
|
Train/png/1133.png
|
def list_files(directory):
return [f for f in pathlib.Path(directory).iterdir() if f.is_file() and not f.name.startswith('.')]
|
1204
|
Train/png/1204.png
|
def is_parameter(self):
return (isinstance(self.scope, CodeFunction)
and self in self.scope.parameters)
|
8686
|
Train/png/8686.png
|
def get_authors(self, language):
return self.gettext(language, self._author) if self._author else ""
|
4738
|
Train/png/4738.png
|
def _outliers(self, x):
outliers = self._tukey(x, threshold=1.5)
return np.size(outliers)
|
6485
|
Train/png/6485.png
|
def embedding_to_padding(emb):
emb_sum = tf.reduce_sum(tf.abs(emb), axis=-1, keep_dims=True)
return tf.to_float(tf.equal(emb_sum, 0.0))
|
6969
|
Train/png/6969.png
|
def patch(self, url, data=None, **kwargs):
return requests.patch(url, data=data, headers=self.add_headers(**kwargs))
|
9317
|
Train/png/9317.png
|
def set_source_text(self, p_text):
self.src = p_text.strip()
self.fields = parse_line(self.src)
|
2842
|
Train/png/2842.png
|
def clip_rect(self, x: float, y: float, w: float, h: float) -> None:
pass
|
1967
|
Train/png/1967.png
|
def _handle_chat(self, data):
self.conn.enqueue_data(
"chat", ChatMessage.from_data(self.room, self.conn, data)
)
|
2646
|
Train/png/2646.png
|
def join(mapping, bind, values):
return [' '.join([six.text_type(v) for v in values if v is not None])]
|
4682
|
Train/png/4682.png
|
def _wrapper_find_one(self, filter_=None, *args, **kwargs):
return self.__collect.find_one(filter_, *args, **kwargs)
|
1566
|
Train/png/1566.png
|
def redirect_output(fileobj):
old = sys.stdout
sys.stdout = fileobj
try:
yield fileobj
finally:
sys.stdout = old
|
9362
|
Train/png/9362.png
|
def charm_dir():
d = os.environ.get('JUJU_CHARM_DIR')
if d is not None:
return d
return os.environ.get('CHARM_DIR')
|
4580
|
Train/png/4580.png
|
def insert_before(self, key, new_item, instance=0):
self._insert_item(key, new_item, instance, False)
|
9795
|
Train/png/9795.png
|
def _add_process(self, proc, priority) -> None:
self._events.push(self.now, priority, proc)
|
4563
|
Train/png/4563.png
|
def SegmentMax(a, ids):
def func(idxs): return np.amax(a[idxs], axis=0)
return seg_map(func, a, ids),
|
9621
|
Train/png/9621.png
|
def join(self):
self._future = False
self._job.poll()
self._job = None
|
8791
|
Train/png/8791.png
|
def restore(self, training_info: TrainingInfo, local_batch_idx: int, model: Model, hidden_state: dict):
pass
|
2939
|
Train/png/2939.png
|
def average(sequence, key):
return sum(map(key, sequence)) / float(len(sequence))
|
4522
|
Train/png/4522.png
|
def _param32(ins):
output = _32bit_oper(ins.quad[1])
output.append('push de')
output.append('push hl')
return output
|
4148
|
Train/png/4148.png
|
def info(self, text):
self.logger.info("{}{}".format(self.message_prefix, text))
|
9668
|
Train/png/9668.png
|
def _bipartite_shape(self):
return (self._input_dim, self._output_dim, self._input_dim,
self._output_dim)
|
5479
|
Train/png/5479.png
|
def setKey(self, key):
key = self._guardAgainstUnicode(key)
self.__key = key
|
6122
|
Train/png/6122.png
|
def visit_decorators(self, node):
return "@%s\n" % "\n@".join(item.accept(self) for item in node.nodes)
|
307
|
Train/png/307.png
|
def pack(self):
block = bytearray(self.size)
self.pack_into(block)
return block
|
4800
|
Train/png/4800.png
|
def remove_message(self, message):
if message in self.__messages:
self.__messages.remove(message)
|
8407
|
Train/png/8407.png
|
def delete_tmp_dir(self):
logger.debug("Deleting: " + self.tmp_dir)
shutil.rmtree(self.tmp_dir, True)
|
7676
|
Train/png/7676.png
|
def export(self):
data = {}
for key in self._specification:
data[key] = self[key]
return data
|
6852
|
Train/png/6852.png
|
def inventory(self):
for chassis in self.chassis_list.values():
chassis.inventory(modules_inventory=True)
|
2620
|
Train/png/2620.png
|
def compute_crc(data):
crc16 = crcmod.predefined.Crc('modbus')
crc16.update(data)
return int(crc16.hexdigest(), 16)
|
4345
|
Train/png/4345.png
|
def distinct(self, fieldname, key=None):
return tuple(unique_everseen(self[fieldname], key=key))
|
6703
|
Train/png/6703.png
|
def set_plain_text_font(self, font, color_scheme=None):
self.plain_text.set_font(font, color_scheme=color_scheme)
|
4193
|
Train/png/4193.png
|
def show_pool(self, pool, **_params):
return self.get(self.pool_path % (pool), params=_params)
|
203
|
Train/png/203.png
|
def debugger():
sdb = _current[0]
if sdb is None or not sdb.active:
sdb = _current[0] = Sdb()
return sdb
|
959
|
Train/png/959.png
|
def binary_dumps(obj, alt_format=False):
return b''.join(_binary_dump_gen(obj, alt_format=alt_format))
|
2188
|
Train/png/2188.png
|
def es_client(self):
es_conf = self.campaign.export.elasticsearch
return Elasticsearch(self.hosts, **es_conf.connection_params)
|
1273
|
Train/png/1273.png
|
def config(self):
return ", ".join('%s:%s' % (key, value) for key, value in self.conf.items())
|
2088
|
Train/png/2088.png
|
def sync(self):
self.elk.send(cp_encode())
self.get_descriptions(TextDescriptions.SETTING.value)
|
6771
|
Train/png/6771.png
|
def show_message(self, message, timeout=0):
self.main.statusBar().showMessage(message, timeout)
|
5931
|
Train/png/5931.png
|
def xvals(self):
return [
val[0] for serie in self.all_series for val in serie.values
if val[0] is not None
]
|
9065
|
Train/png/9065.png
|
def get_ids(cs):
records = []
for c in cs:
records.append({k: c[k] for k in c if k in {'names', 'labels'}})
return records
|
3139
|
Train/png/3139.png
|
def put_text(self, key, text):
with open(key, "w") as fh:
fh.write(text)
|
2938
|
Train/png/2938.png
|
def step(self):
op = self.code[self.instruction_pointer]
self.instruction_pointer += 1
op(self)
|
4753
|
Train/png/4753.png
|
def icomments(self, tag, limit=0):
for comment in CommentsMatch(tag).get_comments(limit):
yield comment
|
2769
|
Train/png/2769.png
|
def total_cycles(self) -> int:
return sum((int(re.sub(r'\D', '', op)) for op in self.tokens))
|
4292
|
Train/png/4292.png
|
def register_animation(self, animation_class):
self.state.animationClasses.append(animation_class)
return len(self.state.animationClasses) - 1
|
5644
|
Train/png/5644.png
|
def coarse_tag_str(pos_seq):
global tag2coarse
tags = [tag2coarse.get(tag, 'O') for tag in pos_seq]
return ''.join(tags)
|
2609
|
Train/png/2609.png
|
def ready_print(worker, output, error): # pragma : no cover
global COUNTER
COUNTER += 1
print(COUNTER, output, error)
|
6120
|
Train/png/6120.png
|
def visit_augassign(self, node):
return "%s %s %s" % (node.target.accept(self), node.op, node.value.accept(self))
|
2438
|
Train/png/2438.png
|
def Negation(expr: Expression) -> Expression:
expr = Expression(_negate(expr.body))
return ast.fix_missing_locations(expr)
|
7622
|
Train/png/7622.png
|
def wrap_comment(self, text, reformat=True):
if reformat:
text = self.reformat(text)
return "#" + self.add_ref("comment", text) + unwrapper
|
3361
|
Train/png/3361.png
|
def print_header(msg, sep='='):
" More strong message "
LOGGER.info("\n%s\n%s" % (msg, ''.join(sep for _ in msg)))
|
5682
|
Train/png/5682.png
|
def stop_playback(self):
self._sink.flush()
self._sink.stop()
self._playing = False
|
4957
|
Train/png/4957.png
|
def is_running(self) -> bool:
if self._proc is None or self._proc.returncode is not None:
return False
return True
|
7066
|
Train/png/7066.png
|
def toString(self):
slist = self.toList()
string = angle.slistStr(slist)
return string if slist[0] == '-' else string[1:]
|
512
|
Train/png/512.png
|
def dict_to_numpy_array(d):
return fromarrays(d.values(), np.dtype([(str(k), v.dtype) for k, v in d.items()]))
|
7837
|
Train/png/7837.png
|
def do_EOF(self, args):
if _debug:
ConsoleCmd._debug("do_EOF %r", args)
return self.do_exit(args)
|
5506
|
Train/png/5506.png
|
def GetSize(cls):
format_str = "".join([x[0] for x in cls._fields])
return struct.calcsize(format_str)
|
8225
|
Train/png/8225.png
|
def valid_host(host):
for part in host.split("."):
if not _valid_host_part.match(part):
return False
return True
|
5706
|
Train/png/5706.png
|
def pos_tag(args):
tagger = POSTagger(lang=args.lang)
tag(tagger, args)
|
4961
|
Train/png/4961.png
|
def force_ascii_values(data):
return {
k: v.encode('utf8').decode('ascii', 'backslashreplace')
for k, v in data.items()
}
|
9769
|
Train/png/9769.png
|
def run_show_val(obj, name):
val = obj.debugger.settings[obj.name]
obj.msg("%s is %s." % (obj.name, obj.cmd.proc._saferepr(val),))
return False
|
2724
|
Train/png/2724.png
|
def value(self):
if self._prop.fget is None:
raise AttributeError('Unable to read attribute')
return self._prop.fget(self._obj)
|
3217
|
Train/png/3217.png
|
def bind(self, app):
self.parent = app
app.add_subapp(self.prefix, self.app)
|
2964
|
Train/png/2964.png
|
def get(handler, item_id, decrypt):
data = {'operation': 'get',
'decrypt': decrypt,
'id': item_id}
handler.invoke(data)
|
8911
|
Train/png/8911.png
|
def center(self):
points = np.array(self._points)
return np.mean(points[:, COLS.XYZ], axis=0)
|
2306
|
Train/png/2306.png
|
def iteritems(self):
for n, v in self.msgobj.__dict__["_headers"]:
yield n.lower(), v
return
|
7471
|
Train/png/7471.png
|
def all(self):
return self.pages(self.url.page, self.url.max_page)
|
686
|
Train/png/686.png
|
def get_client(self, client_id):
client_response = self.get_request('clients/%s' % client_id)
return Client(self, client_response['client'])
|
2982
|
Train/png/2982.png
|
def log_to_file(self, message):
with self.build_fs.open(self.log_file, 'a+') as f:
f.write(unicode(message + '\n'))
|
365
|
Train/png/365.png
|
def is_punctuation(text):
return not (text.lower() in config.AVRO_VOWELS or
text.lower() in config.AVRO_CONSONANTS)
|
5808
|
Train/png/5808.png
|
def sharey(axes):
linker = Linker(axes)
for ax in axes:
ax._linker = linker
|
1677
|
Train/png/1677.png
|
def _sub(cmd, *sections):
cmd_func = cmd if isfunction(cmd) else cmd.cmd
return Subcmd(baredoc(cmd), *sections, func=cmd_func)
|
8312
|
Train/png/8312.png
|
def process(self, metric):
self.log.debug("Metric: %s", str(metric).rstrip().replace(' ', '\t'))
|
2536
|
Train/png/2536.png
|
def innerHTML(self) -> str:
if self._inner_element:
return self._inner_element.innerHTML
return super().innerHTML
|
7420
|
Train/png/7420.png
|
def search(self, spec, operator):
return self.xmlrpc.search(spec, operator.lower())
|
4160
|
Train/png/4160.png
|
def show_quota(self, project_id, **_params):
return self.get(self.quota_path % (project_id), params=_params)
|
484
|
Train/png/484.png
|
def make_file_path(project_dir, project_name, root, name):
return path.join(make_dir_path(project_dir, root, project_name), name)
|
6478
|
Train/png/6478.png
|
def tanh_discrete_unbottleneck(x, hidden_size):
x = tf.layers.dense(x, hidden_size, name="tanh_discrete_unbottleneck")
return x
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.