common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
2783
|
Train/png/2783.png
|
def to_native(self, obj):
ret = super(UserSerializer, self).to_native(obj)
del ret['password']
return ret
|
7404
|
Train/png/7404.png
|
def connectionMade(self):
cmd = stomper.connect(self.username, self.password)
self.transport.write(cmd)
|
417
|
Train/png/417.png
|
def equal(list1, list2):
return [item1 == item2 for item1, item2 in broadcast_zip(list1, list2)]
|
88
|
Train/png/88.png
|
def pivot(self):
self.op_data = [list(i) for i in zip(*self.ip_data)]
|
6097
|
Train/png/6097.png
|
def vowel_in_stem(self):
for i in range(0, self.j+1):
if not self.cons(i):
return True
return False
|
8107
|
Train/png/8107.png
|
def filter(self, func):
self._data = xfilter(func, self._data)
return self
|
257
|
Train/png/257.png
|
def emit(self, *args, **kwargs):
self._messanger.send(self, *args, **kwargs)
|
8194
|
Train/png/8194.png
|
def stripext(cmd, archive, verbosity, extension=""):
if verbosity >= 0:
print(util.stripext(archive)+extension)
return None
|
1938
|
Train/png/1938.png
|
def primitive(self):
primitive = copy(self.item.primitive)
primitive.update(self.entry.primitive)
return primitive
|
1484
|
Train/png/1484.png
|
def output_names(self) -> Iterable[str]:
self._load_models()
return chain.from_iterable(map(lambda m: m.output_names, self._models))
|
3299
|
Train/png/3299.png
|
def prefix(filename):
return os.path.split(re.sub(_afni_suffix_regex, "", str(filename)))[1]
|
2294
|
Train/png/2294.png
|
def _init_name_core(self, name: str):
self.__regex = re.compile(rf'^{self._pattern}$')
self.name = name
|
5489
|
Train/png/5489.png
|
def _disjoint_qubits(op1: ops.Operation, op2: ops.Operation) -> bool:
return not set(op1.qubits) & set(op2.qubits)
|
3510
|
Train/png/3510.png
|
def _hook_id(self, info):
if isinstance(info, dict) and 'id' in info.keys():
self.id = info['id']
|
9606
|
Train/png/9606.png
|
def base_dtype(dtype):
dtype = tf.as_dtype(dtype)
if hasattr(dtype, 'base_dtype'):
return dtype.base_dtype
return dtype
|
511
|
Train/png/511.png
|
def log(*args, **attrs):
attrs.setdefault("metavar", "PATH")
attrs.setdefault("show_default", False)
return option(log, *args, **attrs)
|
412
|
Train/png/412.png
|
def aug_sysargv(cmdstr):
import shlex
argv = shlex.split(cmdstr)
sys.argv.extend(argv)
|
6135
|
Train/png/6135.png
|
def _set_choices(self, value):
super(LazyChoicesMixin, self)._set_choices(value)
self.widget.choices = value
|
2915
|
Train/png/2915.png
|
def format_name(text):
name = unescape(text)
name = asciify(name.replace(u'&', u'And').replace(u'@', u'At'))
name = capfirst(name)
return name
|
6792
|
Train/png/6792.png
|
def _verify_auth(self):
return self.token and bool(self.application.auth.get_tok(self.token))
|
8541
|
Train/png/8541.png
|
def remove_flag(self, flag):
if self.has_flag(flag):
del self._flags[flag.lower()]
|
2706
|
Train/png/2706.png
|
def I(self):
r
return list(set(range(self.nstates)) - set(self._A) - set(self._B))
|
7179
|
Train/png/7179.png
|
def start(self):
self._process = threading.Thread(target=self._background_runner)
self._process.start()
|
6665
|
Train/png/6665.png
|
def resolveSystem(self, sysID):
ret = libxml2mod.xmlACatalogResolveSystem(self._o, sysID)
return ret
|
7802
|
Train/png/7802.png
|
def _score(cluster):
x, y = zip(*cluster)[:2]
return min(len(set(x)), len(set(y)))
|
5807
|
Train/png/5807.png
|
def round_to_n(x, n):
return round(x, -int(np.floor(np.log10(x))) + (n - 1))
|
5612
|
Train/png/5612.png
|
def register_relax_task(self, *args, **kwargs):
kwargs["task_class"] = RelaxTask
return self.register_task(*args, **kwargs)
|
2583
|
Train/png/2583.png
|
def _hue(color, **kwargs):
h = colorsys.rgb_to_hls(*[x / 255.0 for x in color.value[:3]])[0]
return NumberValue(h * 360.0)
|
4028
|
Train/png/4028.png
|
def ngram(n, iter_tokens):
z = len(iter_tokens)
return (iter_tokens[i:i+n] for i in range(z-n+1))
|
9156
|
Train/png/9156.png
|
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
7456
|
Train/png/7456.png
|
def fin(self):
self.connection.fin(self.id)
self.processed = True
|
4721
|
Train/png/4721.png
|
def _delete_keys(dct, keys):
c = deepcopy(dct)
assert isinstance(keys, list)
for k in keys:
c.pop(k)
return c
|
3056
|
Train/png/3056.png
|
def rows(self):
bf = self.copy()
result = bf.query.executeQuery(format="soa")
return result["_rowName"]
|
4798
|
Train/png/4798.png
|
def quote(bot, mask, target, args):
msg = ' '.join(args['<args>'])
bot.log.info('quote> %r', msg)
bot.send(msg)
|
6592
|
Train/png/6592.png
|
def xhtml_unescape(value: Union[str, bytes]) -> str:
return re.sub(r"&(#?)(\w+?);", _convert_entity, _unicode(value))
|
9788
|
Train/png/9788.png
|
def isPow2(num) -> bool:
if not isinstance(num, int):
num = int(num)
return num != 0 and ((num & (num - 1)) == 0)
|
9384
|
Train/png/9384.png
|
def parse_atom_bytes(data: bytes) -> AtomFeed:
root = parse_xml(BytesIO(data)).getroot()
return _parse_atom(root)
|
9626
|
Train/png/9626.png
|
def _get_stream_id(self, text):
m = self._image_re.search(text)
if m:
return m.group("stream_id")
|
1381
|
Train/png/1381.png
|
def set_schedule(self, data):
value = Schedule.build(data)
self._conn.make_request(PROP_WRITE_HANDLE, value)
|
9221
|
Train/png/9221.png
|
def msg_name(code):
ids = {v: k for k, v in COMMANDS.items()}
return ids[code]
|
4553
|
Train/png/4553.png
|
def Sum(a, axis, keep_dims):
return np.sum(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis),
keepdims=keep_dims),
|
7803
|
Train/png/7803.png
|
def parse_description(s):
s = "".join(s.split()[1:]).replace("/", ";")
a = parse_qs(s)
return a
|
9893
|
Train/png/9893.png
|
def get_defined_srms(srm_file):
srms = read_table(srm_file)
return np.asanyarray(srms.index.unique())
|
5080
|
Train/png/5080.png
|
def _on_group_mute(self, data):
self._groups.get(data.get('id')).update_mute(data)
|
2173
|
Train/png/2173.png
|
def ticker(delay, to):
for i in range(to):
yield i
await asyncio.sleep(delay)
|
7496
|
Train/png/7496.png
|
def temperature(self, what):
self._temperature = units.validate_quantity(what, u.K)
|
9118
|
Train/png/9118.png
|
def get_class_logger(obj):
return logging.getLogger(obj.__class__.__module__ + '.' + obj.__class__.__name__)
|
2601
|
Train/png/2601.png
|
def _execFilters(self, type, msg):
for filter in self.FILTERS:
msg = filter(type, msg)
return msg
|
581
|
Train/png/581.png
|
def user_got_role_event(user, role):
msg = 'User ({}){} got new role [{}]'
current_app.logger.info(msg.format(user.id, user.email, role.handle))
|
5407
|
Train/png/5407.png
|
def _filter_attrs(attrs, ignored_attrs):
return dict((k, v) for k, v in attrs.items() if k not in ignored_attrs)
|
6106
|
Train/png/6106.png
|
def APO(series, fast=12, slow=26, matype=0):
return _series_to_series(series, talib.APO, fast, slow, matype)
|
5751
|
Train/png/5751.png
|
def connect(self, protocol=None, mode=None, disposition=None):
self.component.connect(protocol, mode, disposition)
|
5818
|
Train/png/5818.png
|
def executemany(self, sql: str, parameters: Iterable[Iterable[Any]]) -> None:
await self._execute(self._cursor.executemany, sql, parameters)
|
2155
|
Train/png/2155.png
|
def url2tmp(self, root, url):
filename = url.rsplit('/', 1)[-1]
return os.path.join(root, filename)
|
8093
|
Train/png/8093.png
|
def mixedcase(path):
words = path.split('_')
return words[0] + ''.join(word.title() for word in words[1:])
|
6845
|
Train/png/6845.png
|
def is_answer_valid(self, ans):
return ans in [str(i+1) for i in range(len(self.choices))]
|
2250
|
Train/png/2250.png
|
def print_message(self, message, verbosity_needed=1):
if self.args.verbosity >= verbosity_needed:
print(message)
|
6342
|
Train/png/6342.png
|
def _jseq(self, cols, converter=None):
return _to_seq(self.sql_ctx._sc, cols, converter)
|
9281
|
Train/png/9281.png
|
def list_names(cls):
ret = dict([(item['id'], item['name'])
for item in cls.list({'items_per_page': 500})])
return ret
|
1820
|
Train/png/1820.png
|
def box(side=1):
half_side = side / 2
_state["ctx"].rectangle(-half_side, -half_side, side, side)
_state["ctx"].fill()
|
8192
|
Train/png/8192.png
|
def list_bzip2(archive, compression, cmd, verbosity, interactive):
return stripext(cmd, archive, verbosity)
|
4919
|
Train/png/4919.png
|
def get_groups(self, table_name):
df = self.dm[table_name]
return list(df['group'].unique())
|
9609
|
Train/png/9609.png
|
def _mode(self):
return (self.mean_direction +
tf.zeros_like(self.concentration)[..., tf.newaxis])
|
5225
|
Train/png/5225.png
|
def get_check(self, check):
chk = self._check_manager.get(check)
chk.set_entity(self)
return chk
|
931
|
Train/png/931.png
|
def Y_tighter(self):
self.parent.value('y_distance', self.parent.value('y_distance') / 1.4)
self.parent.traces.display()
|
6396
|
Train/png/6396.png
|
def make_horizontal_box(cls, children, layout=Layout()):
"Make a horizontal box with `children` and `layout`."
return widgets.HBox(children, layout=layout)
|
6114
|
Train/png/6114.png
|
def constraint_join(cfg_nodes):
r = 0
for e in cfg_nodes:
r = r | constraint_table[e]
return r
|
26
|
Train/png/26.png
|
def log(self, *args, **kwargs):
if self.verbose:
print(' ' * self.depth, *args, **kwargs)
|
9416
|
Train/png/9416.png
|
def delete(identifier):
log.info('Deleting source "%s"', identifier)
actions.delete_source(identifier)
log.info('Deleted source "%s"', identifier)
|
5098
|
Train/png/5098.png
|
def deleteICM(uuid: str):
_metadata = ICMMetadata.query.filter_by(id=uuid).first()
db.session.delete(_metadata)
db.session.commit()
return ("", 204)
|
9036
|
Train/png/9036.png
|
def render_table(self, headers, rows, style=None):
table = self.table(headers, rows, style)
table.render(self._io)
|
2305
|
Train/png/2305.png
|
def timeit(self, metric, func, *args, **kwargs):
return metrics.timeit(metric, func, *args, **kwargs)
|
6939
|
Train/png/6939.png
|
def _init(self):
self._line_number = next_line(
self._communication.last_requested_line_number,
self._file.read(1)[0])
|
9589
|
Train/png/9589.png
|
def wtf(message, exit_code=1):
print_log(message, RED, BOLD)
if exit_code is not None:
sys.exit(exit_code)
|
7527
|
Train/png/7527.png
|
def notify(self, event):
self.log('Got a notification event!')
self.log(event, pretty=True)
self.log(event.__dict__)
|
8185
|
Train/png/8185.png
|
def loads(s, cls=BinaryQuadraticModel, vartype=None):
return load(s.split('\n'), cls=cls, vartype=vartype)
|
5591
|
Train/png/5591.png
|
def load_data(self, filename):
with zopen(filename, "rt") as f:
self._data = json.load(f, cls=MontyDecoder)
|
322
|
Train/png/322.png
|
def visit_FunctionDef(self, node):
node = self.get_function_node(node)
if node is not None:
node._async = False
|
3853
|
Train/png/3853.png
|
def name(self, value):
self._name = value
# generate slug
if not self.slug:
self.slug = KnwKB.generate_slug(value)
|
8068
|
Train/png/8068.png
|
def get_current_user(self):
url = self.current_user_url
result = self.get(url)
return result
|
9464
|
Train/png/9464.png
|
def append_transition(self, symbol, targetset):
if symbol in self.transitions:
return
self.transitions[symbol] = targetset
|
3225
|
Train/png/3225.png
|
def select_distinct(self, table, cols='*', execute=True):
return self.select(table, cols, execute, select_type='SELECT DISTINCT')
|
2957
|
Train/png/2957.png
|
def clear(self):
collection = self.ds.connection(COLLECTION_MANAGED_PROCESS)
return collection.delete_many(filter={})
|
7847
|
Train/png/7847.png
|
def _get_all_policy_ids(zap_helper):
policies = zap_helper.zap.ascan.policies()
return [p['id'] for p in policies]
|
2091
|
Train/png/2091.png
|
def as_dict(self):
attrs = vars(self)
return {key: attrs[key] for key in attrs if not key.startswith('_')}
|
7117
|
Train/png/7117.png
|
def yAxisIsMinor(self):
return min(self.radius.x, self.radius.y) == self.radius.y
|
3135
|
Train/png/3135.png
|
def write_mzxml(filename, df, info=None, precision='f'):
for r in df.values:
df.columns
pass
|
965
|
Train/png/965.png
|
def is_namedtuple(type_: Type[Any]) -> bool:
return _issubclass(type_, tuple) and hasattr(type_, '_field_types') and hasattr(type_, '_fields')
|
574
|
Train/png/574.png
|
def __unLock(self):
self._operation = False
self._timer = 0
self._isLocked = False
|
1425
|
Train/png/1425.png
|
def initializable(self):
return bool(lib.EnvSlotInitableP(self._env, self._cls, self._name))
|
311
|
Train/png/311.png
|
def load_secrets(self, secret_path):
self._config = p_config.render_secrets(self.config_path, secret_path)
|
7466
|
Train/png/7466.png
|
def pub(self, topic, message):
return self.post('pub', params={'topic': topic}, data=message)
|
1480
|
Train/png/1480.png
|
def asarray2d(a):
arr = np.asarray(a)
if arr.ndim == 1:
arr = arr.reshape(-1, 1)
return arr
|
8841
|
Train/png/8841.png
|
def parse(source, remove_comments=True, **kw):
return ElementTree.parse(source, SourceLineParser(), **kw)
|
3926
|
Train/png/3926.png
|
def _eval_variables(self):
for k, v in listitems(self._variables):
self._variables[k] = v() if hasattr(v, '__call__') else v
|
6220
|
Train/png/6220.png
|
def add_scalar(self, name, value, step):
self.writer.add_scalar(name, value, step)
|
485
|
Train/png/485.png
|
def parse(html_string, wrapper=Parser, *args, **kwargs):
return Parser(lxml.html.fromstring(html_string), *args, **kwargs)
|
8920
|
Train/png/8920.png
|
def _max_diameter(tree):
return 2. * max(max(node.points[:, COLS.R]) for node in tree.ipreorder())
|
6720
|
Train/png/6720.png
|
def _create_worker(self, worker):
worker.sig_started.connect(self._start)
self._workers.append(worker)
|
2627
|
Train/png/2627.png
|
def _write_to_cache(self, expr, res):
res = dedent(res)
super()._write_to_cache(expr, res)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.