common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
3585
|
Train/png/3585.png
|
def activate(self):
_val = await self.request.get(self._base_path, params={ATTR_SCENE_ID: self._id})
return _val
|
8072
|
Train/png/8072.png
|
def cleanup(self):
all([delete_file_or_tree(f) for f in self.to_delete])
self.to_delete = []
|
6709
|
Train/png/6709.png
|
def show_intro(self):
from IPython.core.usage import interactive_usage
self.main.help.show_rich_text(interactive_usage)
|
9933
|
Train/png/9933.png
|
def proc_image(self, tokens):
print("IMAGE:", tokens, tokens.asList(), tokens.keys())
raise NotImplementedError
|
509
|
Train/png/509.png
|
def debug(*args, **attrs):
attrs.setdefault("is_flag", True)
attrs.setdefault("default", None)
return option(debug, *args, **attrs)
|
6316
|
Train/png/6316.png
|
def echo_error(root_resource, message):
params = dict(message=message)
return root_resource.get(ECHO_ERROR_PATH, params)
|
6970
|
Train/png/6970.png
|
def post(self, url, data=None, **kwargs):
return requests.post(url, data=data, headers=self.add_headers(**kwargs))
|
6288
|
Train/png/6288.png
|
def name_for_scalar_relationship(base, local_cls, referred_cls, constraint):
name = referred_cls.__name__.lower() + "_ref"
return name
|
6667
|
Train/png/6667.png
|
def regexpExec(self, content):
ret = libxml2mod.xmlRegexpExec(self._o, content)
return ret
|
6152
|
Train/png/6152.png
|
def get_param_names(cls):
return [m[0] for m in inspect.getmembers(cls)
if type(m[1]) == property]
|
7329
|
Train/png/7329.png
|
def convertAndMake(converter, handler):
def convertAction(loc, value):
return handler(loc, converter(value))
return convertAction
|
4023
|
Train/png/4023.png
|
def runtime(self):
t = time.time() - self.start
self.start = time.time()
return t
|
4025
|
Train/png/4025.png
|
def write_classifier(self, clf):
with open(os.path.join(self.repopath, 'classifier.pkl'), 'w') as fp:
pickle.dump(clf, fp)
|
6538
|
Train/png/6538.png
|
def make_globals(self, d):
if not d:
return self.globals
return dict(self.globals, **d)
|
1580
|
Train/png/1580.png
|
def template(cls, userdata):
ud = Userdata(cls.normalize(cls.create_empty(None), userdata))
return ud
|
6006
|
Train/png/6006.png
|
def main():
out_dir = sys.argv[1]
coeffs = get_all_coeffs()
save_coeffs(coeffs, out_dir=out_dir)
|
4365
|
Train/png/4365.png
|
def warning(self, *args) -> "Err":
error = self._create_err("warning", *args)
print(self._errmsg(error))
return error
|
1568
|
Train/png/1568.png
|
def auth(self):
if self.oauth:
return self.oauth
return (self.username, self.password)
|
1443
|
Train/png/1443.png
|
def name(self):
return ffi.string(
lib.EnvGetDeffunctionName(self._env, self._fnc)).decode()
|
3988
|
Train/png/3988.png
|
def rx_int_extra(rxmatch):
rxmatch = re.search("\d+", rxmatch.group(0))
return int(rxmatch.group(0))
|
8578
|
Train/png/8578.png
|
def _fix_callback_item(self, item):
'Update component identifier'
item.component_id = self._fix_id(item.component_id)
return item
|
8604
|
Train/png/8604.png
|
def run(self):
self.toplevel.protocol("WM_DELETE_WINDOW", self.__on_window_close)
self.toplevel.mainloop()
|
4570
|
Train/png/4570.png
|
def Conv3D(a, f, strides, padding):
patches = _conv_patches(a, f, strides, padding.decode("ascii"))
return np.sum(patches, axis=tuple(range(-f.ndim, -1))),
|
9234
|
Train/png/9234.png
|
def list_topics(self, Nwords=10):
return [(k, self.list_topic(k, Nwords)) for k in xrange(len(self.phi))]
|
3849
|
Train/png/3849.png
|
def set(self, key, value):
key = "{0}{1}".format(self.prefix, key)
value = json.dumps(value, cls=NumpyEncoder)
self.redis.set(key, value)
|
7036
|
Train/png/7036.png
|
def create_task_info(task):
task_info = None
if task.get('info'):
task_info = task['info']
else:
task_info = task
return task_info
|
2580
|
Train/png/2580.png
|
def receive(self, path, diffTo, diffFrom):
diff = self.toObj.diff(diffTo, diffFrom)
self._open(self.butterStore.receive(diff, [path, ]))
|
2655
|
Train/png/2655.png
|
def grad_desc_update(x, a, c, step=0.01):
return x - step * gradient(x, a, c)
|
5757
|
Train/png/5757.png
|
def cancel(self):
if self._body:
self._body._cancel = True
else:
self._cancel = True
|
6345
|
Train/png/6345.png
|
def sparse(numRows, numCols, colPtrs, rowIndices, values):
return SparseMatrix(numRows, numCols, colPtrs, rowIndices, values)
|
7979
|
Train/png/7979.png
|
def once(self, event, callback):
'Define a callback to handle the first event emitted by the server'
self._once_events.add(event)
self.on(event, callback)
|
10056
|
Train/png/10056.png
|
def add(self, result):
assert not self._complete
self._results.append(result)
self._change()
|
2193
|
Train/png/2193.png
|
def is_iter_non_string(obj):
if isinstance(obj, list) or isinstance(obj, tuple):
return True
return False
|
5864
|
Train/png/5864.png
|
def hdel(self, key, field, *fields):
return self.execute(b'HDEL', key, field, *fields)
|
4338
|
Train/png/4338.png
|
def operate(config):
"Interface to do simple operations on the database."
app = make_app(config=config)
print("Operate Mode")
with app.app_context():
operate_menu()
|
5933
|
Train/png/5933.png
|
def round_to_int(number, precision):
precision = int(precision)
rounded = (int(number) + precision / 2) // precision * precision
return rounded
|
6151
|
Train/png/6151.png
|
def splay(vec):
N2 = 2 ** int(numpy.log2(len(vec)) / 2)
N1 = len(vec) / N2
return N1, N2
|
2863
|
Train/png/2863.png
|
def keys_to_values(self, keys):
"Return the items in the keystore with keys in `keys`."
return dict((k, v) for k, v in self.data.items() if k in keys)
|
10015
|
Train/png/10015.png
|
def _delete_local(self, filename):
if os.path.exists(filename):
os.remove(filename)
|
1497
|
Train/png/1497.png
|
def count(self):
"Return a count of rows this Query would return."
return self.rpc_model.search_count(
self.domain, context=self.context
)
|
5763
|
Train/png/5763.png
|
def _bottom(self):
_, top, _, height = self._extents
return top + height
|
6374
|
Train/png/6374.png
|
def split_none(self):
"Don't split the data and create an empty validation set."
val = self[[]]
val.ignore_empty = True
return self._split(self.path, self, val)
|
3865
|
Train/png/3865.png
|
def get_model_alias(self):
if self.model_alias:
return self.model_alias
return '{}.{}'.format(self.get_app_label(), self.get_model_name())
|
754
|
Train/png/754.png
|
def getDictionary(self):
if os.path.exists(self.jsonFile):
return json.loads(Utility.readFile(self.jsonFile))
else:
return {}
|
3974
|
Train/png/3974.png
|
def read_interfaces(path: str) -> Interfaces:
with open(path, encoding='utf-8') as f:
return json.load(f)
|
7524
|
Train/png/7524.png
|
def set_orient(self):
self.orient = RADTODEG(N.arctan2(self.cd12, self.cd22))
|
2621
|
Train/png/2621.png
|
def handle_time(msg):
return msg.copy(ack=0, payload=calendar.timegm(time.localtime()))
|
3060
|
Train/png/3060.png
|
def weekly(date=datetime.date.today()):
return date - datetime.timedelta(days=date.weekday())
|
2857
|
Train/png/2857.png
|
def _previous(self):
self.summaries.rotate()
current_summary = self.summaries[0]
self._update_summary(current_summary)
|
6686
|
Train/png/6686.png
|
def get_tags(self):
return sorted([frozenset(meta_graph.meta_info_def.tags)
for meta_graph in self.meta_graphs])
|
4064
|
Train/png/4064.png
|
def addEvent(self, event, fd, action):
self._events[event] = (fd, action)
|
9107
|
Train/png/9107.png
|
def refresh_rate(self, value):
if isinstance(value, (int, float)):
self._refresh_rate = value
|
510
|
Train/png/510.png
|
def dryrun(*args, **attrs):
attrs.setdefault("is_flag", True)
attrs.setdefault("default", None)
return option(dryrun, *args, **attrs)
|
9458
|
Train/png/9458.png
|
def set_position(self, pos):
time_in_ms = int(pos)*1000
return self.apple_tv.set_property('dacp.playingtime', time_in_ms)
|
2153
|
Train/png/2153.png
|
def mapper_init(self):
self.lookup = CachedMetroLookup(precision=GEOHASH_PRECISION)
self.extractor = WordExtractor()
|
4794
|
Train/png/4794.png
|
def part(self, target, reason=None):
if reason:
target += ' :' + reason
self.send_line('PART %s' % target)
|
8783
|
Train/png/8783.png
|
def range(self, axis=None):
return (self.min(axis=axis), self.max(axis=axis))
|
7308
|
Train/png/7308.png
|
def add_feature(self, pr_name, pr_value):
setattr(self, pr_name, pr_value)
self.features.add(pr_name)
|
9244
|
Train/png/9244.png
|
def _unmarshall_reader(self, file_, d):
return util.unmarshall_config_reader(file_, d, self._get_config_type())
|
9765
|
Train/png/9765.png
|
def clear(self):
self._fwdm.clear()
self._invm.clear()
self._sntl.nxt = self._sntl.prv = self._sntl
|
6579
|
Train/png/6579.png
|
def _load_text(handle, split=False, encoding="utf-8"):
string = handle.read().decode(encoding)
return string.splitlines() if split else string
|
9822
|
Train/png/9822.png
|
def initialize_options(self):
self.branch = 'master'
self.fix = False
super(lint, self).initialize_options()
|
1496
|
Train/png/1496.png
|
def setup(cls, client_id, client_secret):
cls.client_id = client_id
cls.client_secret = client_secret
|
2289
|
Train/png/2289.png
|
def _reset(self):
self.records = list()
self.featsbyid = dict()
self.featsbyparent = dict()
self.countsbytype = dict()
|
5056
|
Train/png/5056.png
|
def input_files(self):
return self.workspace.mets.find_files(fileGrp=self.input_file_grp, pageId=self.page_id)
|
2926
|
Train/png/2926.png
|
def add_endpoint(self, name, **kwargs):
self._endpoints[name] = Endpoint(self, **kwargs)
|
9734
|
Train/png/9734.png
|
def _get_random(self, obj_type):
return self.mutator[obj_type][random.randint(0, self.config.level)]
|
723
|
Train/png/723.png
|
def set_artist(self, artist):
self._set_attr(TPE1(encoding=3, text=artist.decode('utf-8')))
|
7714
|
Train/png/7714.png
|
def gen_stm(src, dst):
return ReilBuilder.build(ReilMnemonic.STM, src, ReilEmptyOperand(), dst)
|
9423
|
Train/png/9423.png
|
def unindex_model_on_delete(sender, document, **kwargs):
if current_app.config.get('AUTO_INDEX'):
unindex.delay(document)
|
908
|
Train/png/908.png
|
def sha1_hash(string):
hasher = sha1()
hasher.update(string.encode())
return hasher.hexdigest()
|
7854
|
Train/png/7854.png
|
def update(self, item, dry_run=None):
return self.backend.update(validate(item, version=self.version, context=self.context), dry_run=dry_run)
|
3718
|
Train/png/3718.png
|
def _timeout(self, watcher, events):
self.timedout = True
self._finish()
self.deferred.errback(TimeoutError())
|
2434
|
Train/png/2434.png
|
def qdict_get_list(qdict, k):
pks = qdict.getlist(k)
return [e for e in pks if e]
|
4378
|
Train/png/4378.png
|
def _replace_service_arg(self, name, index, args):
args[index] = self.get_instantiated_service(name)
|
229
|
Train/png/229.png
|
def case(case_id):
case_obj = app.db.case(case_id)
return render_template('case.html', case=case_obj, case_id=case_id)
|
1104
|
Train/png/1104.png
|
def delete(self):
await self._handler.delete(
boot_source_id=self.boot_source.id, id=self.id)
|
9011
|
Train/png/9011.png
|
def deactivateAaPdpContextAccept():
a = TpPd(pd=0x8)
b = MessageType(mesType=0x54) # 01010100
packet = a / b
return packet
|
790
|
Train/png/790.png
|
def add_class(self, cssclass):
if self.has_class(cssclass):
return self
return self.toggle_class(cssclass)
|
905
|
Train/png/905.png
|
def set(self, *args, **kwargs):
return await _maybe_await(self.event.set(*args, **kwargs))
|
6965
|
Train/png/6965.png
|
def remove_unsafe_chars(text):
if isinstance(text, six.string_types):
text = UNSAFE_RE.sub('', text)
return text
|
8562
|
Train/png/8562.png
|
def text(self):
data = self.content
return data.decode(self.encoding or 'utf-8') if data else ''
|
7761
|
Train/png/7761.png
|
def clear(self):
super(LazyConfig, self).clear()
self._lazy_suffix = []
self._lazy_prefix = []
|
1522
|
Train/png/1522.png
|
def all(self, res):
"Get resources using a filter condition"
B = get_backend()
return B.get_objects(B.get_concrete(res))
|
6473
|
Train/png/6473.png
|
def is_in_expr(expr, find):
return expr == find or (isinstance(expr, ExprNode) and expr.is_in(find))
|
7484
|
Train/png/7484.png
|
def _get_subclass(name):
return next(x for x in BaseContainer.__subclasses__() if x.__name__ == name)
|
5863
|
Train/png/5863.png
|
def unlink(self, key, *keys):
return wait_convert(self.execute(b'UNLINK', key, *keys), int)
|
3561
|
Train/png/3561.png
|
def shuffle_characters(s):
s = list(s)
random.shuffle(s)
s = ''.join(s)
return s
|
105
|
Train/png/105.png
|
def fetch_deposits(self, limit: int) -> List[Deposit]:
return self._transactions(self._deposits, 'deposits', limit)
|
7900
|
Train/png/7900.png
|
def UNION_DECL(self, cursor, num=None):
return self._record_decl(cursor, typedesc.Union, num)
|
4692
|
Train/png/4692.png
|
def attrs(self):
return dict((k, v) for k, v in iteritems(self.__dict__) if k is not "sdk")
|
7842
|
Train/png/7842.png
|
def morph(self, into):
return self.game.cheat_action(self, [actions.Morph(self, into)])
|
7060
|
Train/png/7060.png
|
def A(self, ID):
obj = self.chart.getObject(ID).antiscia()
ID = 'A_%s' % (ID)
return self.G(ID, obj.lat, obj.lon)
|
1864
|
Train/png/1864.png
|
def update_cache(self, data):
UTILS.update(self._cache, data)
self._save_cache()
|
3880
|
Train/png/3880.png
|
def record_variant_id(record):
if record.ID:
return record.ID
else:
return record.CHROM + ':' + str(record.POS)
|
5224
|
Train/png/5224.png
|
def list_flavors(self, limit=None, marker=None):
return self._flavor_manager.list(limit=limit, marker=marker)
|
50
|
Train/png/50.png
|
def rgb_to_hsv(self, RGB):
"linear rgb to hsv"
gammaRGB = self._gamma_rgb(RGB)
return self._ABC_to_DEF_by_fn(gammaRGB, rgb_to_hsv)
|
807
|
Train/png/807.png
|
def start(self):
self._timer = Timer(self.time, self.handler)
self._timer.daemon = True
self._timer.start()
return
|
3809
|
Train/png/3809.png
|
def set(self, x, y, z):
self.x = x
self.y = y
self.z = z
return self
|
2463
|
Train/png/2463.png
|
def strip_end(text, suffix):
if not text.endswith(suffix):
return text
return text[:len(text)-len(suffix)]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.