common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
1755
|
Train/png/1755.png
|
def set_tier(self, tier):
'Updates the tier and ending tier'
self.tier = tier
if tier > self.ending_tier:
self.ending_tier = tier
|
5210
|
Train/png/5210.png
|
def not0(a):
return matrix(list(map(lambda x: 1 if x == 0 else x, a)), a.size)
|
4157
|
Train/png/4157.png
|
def list_ext(self, collection, path, retrieve_all, **_params):
return self.list(collection, path, retrieve_all, **_params)
|
5106
|
Train/png/5106.png
|
def ltake(n: int, xs: Iterable[T]) -> List[T]:
return list(take(n, xs))
|
1445
|
Train/png/1445.png
|
def mandate(self):
return self.client.customer_mandates.with_parent_id(self.customer_id).get(self.mandate_id)
|
815
|
Train/png/815.png
|
def list_refunds(self, params=None):
request = self._get('transactions/refunds', params)
return self.responder(request)
|
5985
|
Train/png/5985.png
|
def time(hour, minute=0, second=0, microsecond=0): # type: (int, int, int, int) -> Time
return Time(hour, minute, second, microsecond)
|
9810
|
Train/png/9810.png
|
def get_installdir():
return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
5273
|
Train/png/5273.png
|
def mount(self, path, mount):
self._mountpoints[self._join_chunks(self._normalize_path(path))] = mount
|
8448
|
Train/png/8448.png
|
def similarity_transformation(rot, mat):
return np.dot(rot, np.dot(mat, np.linalg.inv(rot)))
|
8993
|
Train/png/8993.png
|
def facilityNetToMs():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x3a) # 00111010
c = Facility()
packet = a / b / c
return packet
|
8391
|
Train/png/8391.png
|
def mouse_move_event(self, event):
self.example.mouse_position_event(event.x(), event.y())
|
4867
|
Train/png/4867.png
|
def __run_delta_sql(self, delta):
self.__run_sql_file(delta.get_file())
self.__update_upgrades_table(delta)
|
1196
|
Train/png/1196.png
|
def set_guid(self):
try:
self.guid = self.soup.find('guid').string
except AttributeError:
self.guid = None
|
5816
|
Train/png/5816.png
|
def add_child(self, value):
child = FPNode(value, 1, self)
self.children.append(child)
return child
|
103
|
Train/png/103.png
|
def fetch_order_book(self) -> OrderBook:
return self._fetch('order book', self.market.code)(self._order_book)()
|
3250
|
Train/png/3250.png
|
def makedirs(path):
path = Path(path)
if not path.exists():
path.mkdir(parents=True)
|
4063
|
Train/png/4063.png
|
def removeAll(self):
rv = self._removeAll(self._reads, self._writes)
return rv
|
5525
|
Train/png/5525.png
|
def MakeDestinationKey(directory, filename):
return utils.SmartStr(utils.JoinPath(directory, filename)).lstrip("/")
|
3449
|
Train/png/3449.png
|
def rating(self, value):
self._rating = value
self._thumb = self._link_to_img()
|
1261
|
Train/png/1261.png
|
def mode(self):
mode = self.get_value('mode').get(self.device_id, None)
return mode.lower()
|
7387
|
Train/png/7387.png
|
def bind(self, callback, sender=None):
key = (_make_id(callback), _make_id(sender))
self.callbacks.append((key, callback))
|
9964
|
Train/png/9964.png
|
def stats_per_game(self, kind='R', summary=False):
return self._get_stats_table('per_game', kind=kind, summary=summary)
|
9954
|
Train/png/9954.png
|
def get_list(self, name):
norm_name = HTTPHeaders._normalize_name(name)
return self._as_list.get(norm_name, [])
|
9545
|
Train/png/9545.png
|
def apply(funcs, stack):
return reduce(lambda x, y: y(x), funcs, stack)
|
523
|
Train/png/523.png
|
def add_bond(self, key1, key2, bond):
self.graph.add_edge(key1, key2, bond=bond)
|
4968
|
Train/png/4968.png
|
def fullmatch(self, string, *args, **kwargs):
return self._pattern.fullmatch(string, *args, **kwargs)
|
9342
|
Train/png/9342.png
|
def flatten(self):
size = prod(self.shape[:-1])
return self.reshape(size, self.shape[-1])
|
4525
|
Train/png/4525.png
|
def memsize(self):
return self.size + 1 + TYPE.size(gl.BOUND_TYPE) * len(self.bounds)
|
8019
|
Train/png/8019.png
|
def add_reader(self, fd, callback):
" Start watching the file descriptor for read availability. "
h = msvcrt.get_osfhandle(fd)
self._read_fds[h] = callback
|
3633
|
Train/png/3633.png
|
def active(self):
qset = super(StaffMemberManager, self).get_queryset()
return qset.filter(is_active=True)
|
8412
|
Train/png/8412.png
|
def serve_http(self):
start_http_server(port=self.options.port,
addr=str(self.options.address))
|
3215
|
Train/png/3215.png
|
def execute(self, command):
self._cursor.execute(command)
self._commit()
return True
|
2600
|
Train/png/2600.png
|
def _configMailer(self):
self._MAILER = Mailer(self.MAILER_HOST, self.MAILER_PORT)
self._MAILER.login(self.MAILER_USER, self.MAILER_PWD)
|
534
|
Train/png/534.png
|
def build_css(minimize=True):
print('Build CSS')
args = {}
args['style'] = 'compressed' if minimize else 'nested'
cmd = CMD_SASS.format(**args)
run(cmd)
|
52
|
Train/png/52.png
|
def _count_pixels_on_line(self, y, p):
h = line(y, self._effective_thickness(p), 0.0)
return h.sum()
|
5152
|
Train/png/5152.png
|
def _node_set(self) -> List["InstanceNode"]:
return list(self) if isinstance(self.value, ArrayValue) else [self]
|
9533
|
Train/png/9533.png
|
def dumps(self) -> str:
return json.dumps(self.data, sort_keys=True, indent=4)
|
3081
|
Train/png/3081.png
|
def static_url(redis, path):
file_hash = get_cache_buster(redis, path)
return "%s/%s?v=%s" % (oz.settings["static_host"], path, file_hash)
|
303
|
Train/png/303.png
|
def loop(self):
if not self._loop:
self._loop = IOLoop.current()
return self._loop
return self._loop
|
8039
|
Train/png/8039.png
|
def append(self, value):
self.__field.validate_element(value)
return list.append(self, value)
|
9444
|
Train/png/9444.png
|
def seek(self, offset: int = 0, *args, **kwargs):
return self.fp.seek(offset, *args, **kwargs)
|
7184
|
Train/png/7184.png
|
def spline(x, knots, p, i=0.0):
assert (p+1 < len(knots))
return np.array([N(float(u), float(i), float(p), knots) for u in x])
|
7716
|
Train/png/7716.png
|
def gen_bisz(src, dst):
return ReilBuilder.build(ReilMnemonic.BISZ, src, ReilEmptyOperand(), dst)
|
901
|
Train/png/901.png
|
def register(lib_name: str, cbl: Callable[[_AsyncLib], None]):
return manager.register(lib_name, cbl)
|
1459
|
Train/png/1459.png
|
def check_job(cls, job_details):
return check_log(job_details.logfile, cls.string_exited, cls.string_successful)
|
9001
|
Train/png/9001.png
|
def startDtmfReject():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x37) # 00110111
c = Cause()
packet = a / b / c
return packet
|
7383
|
Train/png/7383.png
|
def back(self, *fields):
ts = self.irange(-1, -1, fields=fields)
if ts:
return ts.end(), ts[0]
|
7040
|
Train/png/7040.png
|
def getObjectList(IDs, date, pos):
objList = [getObject(ID, date, pos) for ID in IDs]
return ObjectList(objList)
|
6834
|
Train/png/6834.png
|
def main(dbfile, pidfile, mode):
Inspector(dbfile, pidfile).reuse_snapshot().snapshot(mode)
|
4598
|
Train/png/4598.png
|
def choice(anon, obj, field, val):
return anon.faker.choice(field=field)
|
9002
|
Train/png/9002.png
|
def statusEnquiry():
a = TpPd(pd=0x3)
b = MessageType(mesType=0x34) # 00110100
packet = a / b
return packet
|
468
|
Train/png/468.png
|
def delete(cls, uuid):
to_delete = Workflow.query.get(uuid)
db.session.delete(to_delete)
|
8673
|
Train/png/8673.png
|
def relabel(self, qubits: Qubits) -> 'Gate':
gate = copy(self)
gate.vec = gate.vec.relabel(qubits)
return gate
|
7113
|
Train/png/7113.png
|
def isIsosceles(self):
return (self.a == self.b) or (self.a == self.c) or (self.b == self.c)
|
5186
|
Train/png/5186.png
|
def is_unix_style(flags):
return (util.platform() != "windows" or (not bool(flags & REALPATH) and get_case(flags))) and not flags & _FORCEWIN
|
4301
|
Train/png/4301.png
|
def commit(self, message, files=None):
if files:
self.add(*files)
return _run_command(["git", "commit", "-m", f'"{message}"'])
|
5167
|
Train/png/5167.png
|
def warn(self, msg, *args, **kwargs):
self.log(self.WARN, msg, *args, **kwargs)
|
1536
|
Train/png/1536.png
|
def pop_result(self, key):
self.pending_callbacks.remove(key)
return self.results.pop(key)
|
8204
|
Train/png/8204.png
|
def get_dt_list(fn_list):
dt_list = np.array([fn_getdatetime(fn) for fn in fn_list])
return dt_list
|
487
|
Train/png/487.png
|
def strip_spaces(s):
return u" ".join([c for c in s.split(u' ') if c])
|
9558
|
Train/png/9558.png
|
def _set(self, pos):
assert 0 <= pos < self.len
self._datastore.setbit(pos)
|
7026
|
Train/png/7026.png
|
def pre_save(cls, sender, instance, *args, **kwargs):
instance.constant_contact_id = str(instance.data['id'])
|
2069
|
Train/png/2069.png
|
def update_local_reference(self, index, ref):
self._references[index] = ref
self.cache()
|
9038
|
Train/png/9038.png
|
def to_dicts(recarray):
for rec in recarray:
yield dict(zip(recarray.dtype.names, rec.tolist()))
|
6497
|
Train/png/6497.png
|
def word_to_vector(word):
vector = []
for char in list(word):
vector.append(char2int(char))
return vector
|
3537
|
Train/png/3537.png
|
def abort(message, *args):
if args:
raise _AbortException(message.format(*args))
raise _AbortException(message)
|
9371
|
Train/png/9371.png
|
def portalId(self):
if self._portalId is None:
self._portalId = self._findPortalId()
return self._portalId
|
2037
|
Train/png/2037.png
|
def to_file(self, filename):
with open(filename, 'wb') as f:
f.write(self.to_bytes())
|
3403
|
Train/png/3403.png
|
def relative_root_dir(self):
return Path(self.bundle.name) / str(self.created_at.date())
|
7914
|
Train/png/7914.png
|
def _collected_label(collect, label):
if not collect.__name__.startswith('<'):
return label + ' ' + collect.__name__
else:
return label
|
7964
|
Train/png/7964.png
|
def chat_delete(self, room_id, msg_id, **kwargs):
return self.__call_api_post('chat.delete', roomId=room_id, msgId=msg_id, kwargs=kwargs)
|
966
|
Train/png/966.png
|
def count_invalid_entries(self):
return sum([c.count_invalid_entries() for c in self.levels(with_mem=False)])
|
1889
|
Train/png/1889.png
|
def offset(self, offset):
clone = self._clone()
if isinstance(offset, int):
clone._offset = offset
return clone
|
6957
|
Train/png/6957.png
|
def inv(self):
result = Translation(-self.t)
result._cache_inv = self
return result
|
8763
|
Train/png/8763.png
|
def get_plot_panel(self):
plot_type_no = self.chart_type_book.GetSelection()
return self.chart_type_book.GetPage(plot_type_no)
|
5103
|
Train/png/5103.png
|
def to_dotfile(G: nx.DiGraph, filename: str):
A = to_agraph(G)
A.write(filename)
|
8906
|
Train/png/8906.png
|
def point(self, x, y):
return EllipticCurve.ECPoint(self, self.field.value(x), self.field.value(y))
|
7681
|
Train/png/7681.png
|
def _merge_args_with_kwargs(args_dict, kwargs_dict):
ret = args_dict.copy()
ret.update(kwargs_dict)
return ret
|
320
|
Train/png/320.png
|
def _value(self):
if self.data is not None:
value = self.data._data.get(self.field.to_field.name)
return str(value)
return ''
|
6650
|
Train/png/6650.png
|
def debugDumpString(output, str):
if output is not None:
output.flush()
libxml2mod.xmlDebugDumpString(output, str)
|
733
|
Train/png/733.png
|
def get_by(self, name):
item = self.app.get_by(name)
return TodoListUX(ux=self, controlled_list=item)
|
4124
|
Train/png/4124.png
|
def delete(self, option):
if self.config is not None:
if option in self.config:
del self.config[option]
|
6198
|
Train/png/6198.png
|
def background_color(self):
if self._has_real():
return self._data.real_background_color
return self._data.background_color
|
5703
|
Train/png/5703.png
|
def fail_all(self, err):
for c_id in self._futures:
self._fail_reply(c_id, err)
|
5457
|
Train/png/5457.png
|
def _get_py_loglevel(lvl):
if not lvl:
lvl = 'INFO'
return LOG_LEVEL_MAP.get(lvl.upper(), logging.DEBUG)
|
2622
|
Train/png/2622.png
|
def publish(self, topic, payload, qos, retain):
self._mqttc.publish(topic, payload, qos, retain)
|
883
|
Train/png/883.png
|
def __ensure_suffix(t, suffix):
tpath = str(t)
if not tpath.endswith(suffix):
return tpath+suffix
return t
|
9104
|
Train/png/9104.png
|
def created_today(self):
if self.datetime.date() == datetime.today().date():
return True
return False
|
4400
|
Train/png/4400.png
|
def exception(self, *args, **kwargs):
return self._log_kw(ERROR, args, kwargs, exc_info=True)
|
7047
|
Train/png/7047.png
|
def dnarcs(decl, lat):
dArc = 180 + 2 * ascdiff(decl, lat)
nArc = 360 - dArc
return (dArc, nArc)
|
2951
|
Train/png/2951.png
|
def flag_calcmad(data):
absdev = np.abs(data - np.median(data))
return np.median(absdev)
|
502
|
Train/png/502.png
|
def run(self, message):
for value in message:
self.update(value)
return [self.low, self.high]
|
543
|
Train/png/543.png
|
def column_stack_2d(data):
return list(list(itt.chain.from_iterable(_)) for _ in zip(*data))
|
148
|
Train/png/148.png
|
def fallback_to_sshv1(self, ctx):
command = self.get_command(version=1)
ctx.spawn_session(command)
return True
|
4201
|
Train/png/4201.png
|
def update_agent(self, agent, body=None):
return self.put(self.agent_path % (agent), body=body)
|
8573
|
Train/png/8573.png
|
def setdefault(self, name: str, default: Any = None) -> Any:
return self.__dict__.setdefault(name, default)
|
5714
|
Train/png/5714.png
|
def pop(self, key, default=None):
"Standard pop semantics for all mapping types"
if not isinstance(key, tuple):
key = (key,)
return self.data.pop(key, default)
|
5895
|
Train/png/5895.png
|
def write_json(template, file_name='../dxf.json.template'):
with open(file_name, 'w') as f:
json.dump(template, f, indent=4)
|
8899
|
Train/png/8899.png
|
def render(self, view, context=None):
return self.runtime.render(self, view, context)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.