common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
5664
|
Train/png/5664.png
|
def K_chol(self):
if self._K_chol is None:
self._K_chol = jitchol(self._K)
return self._K_chol
|
533
|
Train/png/533.png
|
def intern(obj, timeout):
core.gear.timeout = timeout
core.gear.pool.append(obj)
|
1534
|
Train/png/1534.png
|
def to_dict(self):
return {value.label: value.value for value in self.__values if not value.unset}
|
3112
|
Train/png/3112.png
|
def render_xsl(self, node, context):
for e in self.xsl_elements:
e.render(e.run)
|
4906
|
Train/png/4906.png
|
def tag_toggle(self, *tags):
return View({**self.spec, 'tag': list(set(self.tags) ^ set(tags))})
|
9578
|
Train/png/9578.png
|
def decode_uuid(value):
return uuid.UUID(bytes=bytes(bytearray(ffi.unpack(value.data, 16))))
|
4410
|
Train/png/4410.png
|
def dumps(obj):
return json.dumps(obj, indent=4, sort_keys=True, cls=CustomEncoder)
|
7960
|
Train/png/7960.png
|
def shutdown_server(self):
self.log.debug('shutdown_server: in')
if self.ensime and self.toggle_teardown:
self.ensime.stop()
|
6580
|
Train/png/6580.png
|
def add(ctx, left: int, right: int):
await ctx.send(left + right)
|
6332
|
Train/png/6332.png
|
def _(pymux, variables):
" Go to previous active window. "
w = pymux.arrangement.get_previous_active_window()
if w:
pymux.arrangement.set_active_window(w)
|
728
|
Train/png/728.png
|
def updateTraceCount(self):
self.ui.ntracesLbl.setNum(self.ui.trackview.model().traceCount())
|
4042
|
Train/png/4042.png
|
def logWrite(self, string):
logFile = open(self.logFile, 'at')
logFile.write(string + '\n')
logFile.close()
|
6141
|
Train/png/6141.png
|
def read(self, filehandle):
return self.__import(json.load(filehandle, **self.kwargs))
|
7657
|
Train/png/7657.png
|
def _create_api_uri(self, *parts):
return urljoin(self.BASE_API_URI, '/'.join(imap(quote, parts)))
|
2459
|
Train/png/2459.png
|
def get_offset(self):
return self.p1.y-self.get_slope()*self.p1.x
|
3943
|
Train/png/3943.png
|
def _help():
statement = '%s%s' % (shelp, phelp % ', '.join(cntx_.keys()))
print(statement.strip())
|
1455
|
Train/png/1455.png
|
def close(self):
for key in self.masklist.keys():
self.masklist[key] = None
self.masklist = {}
|
2498
|
Train/png/2498.png
|
def trigger_created(self, filepath):
if os.path.exists(filepath):
self._trigger('created', filepath)
|
7782
|
Train/png/7782.png
|
def _request(self, data):
return requests.post(self.endpoint, data=data.encode("ascii")).content
|
4463
|
Train/png/4463.png
|
def fib(n):
v = n.value
return v if v < 2 else fib2(PythonInt(v-1)) + fib(PythonInt(v-2))
|
7201
|
Train/png/7201.png
|
def blob_info(self):
if not self.__blob_info:
self.__blob_info = BlobInfo.get(self.__blob_key)
return self.__blob_info
|
7193
|
Train/png/7193.png
|
def buildingname(ddtt):
idf = ddtt.theidf
building = idf.idfobjects['building'.upper()][0]
return building.Name
|
7555
|
Train/png/7555.png
|
def createSomeItems(store, itemType, values, counter):
for i in counter:
itemType(store=store, **values)
|
433
|
Train/png/433.png
|
def camelcase_underscore(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
6429
|
Train/png/6429.png
|
def on_batch_end(self, train, **kwargs):
"Take the stored results and puts it in `self.stats`"
if train:
self.stats.append(self.hooks.stored)
|
8764
|
Train/png/8764.png
|
def set_plot_type(self, plot_type):
ptypes = [pt["type"] for pt in self.plot_types]
self.plot_panel = ptypes.index(plot_type)
|
4117
|
Train/png/4117.png
|
def abspath(self, path):
return os.path.abspath(os.path.join(os.path.dirname(self.path), path))
|
2179
|
Train/png/2179.png
|
def clean(self):
terms = list(self)
for t in terms:
self.doc.remove_term(t)
|
2644
|
Train/png/2644.png
|
def crc_srec(hexstr):
crc = sum(bytearray(binascii.unhexlify(hexstr)))
crc &= 0xff
crc ^= 0xff
return crc
|
7364
|
Train/png/7364.png
|
def GET_save_timegrid(self) -> None:
state.timegrids[self._id] = copy.deepcopy(hydpy.pub.timegrids.sim)
|
6204
|
Train/png/6204.png
|
def to_json(self):
sets = self.sets()
return sorted(sorted(x) for x in sets)
|
5561
|
Train/png/5561.png
|
def get_chunks(source, chunk_len):
return (source[i: i + chunk_len] for i in range(0, len(source), chunk_len))
|
4801
|
Train/png/4801.png
|
def genpass(pattern=r'[\w]{32}'):
try:
return rstr.xeger(pattern)
except re.error as e:
raise ValueError(str(e))
|
9908
|
Train/png/9908.png
|
def contains(self, k):
if self._changed():
self._read()
return k in self.store.keys()
|
7698
|
Train/png/7698.png
|
def get_init(self):
suffix = self._separator + "%s" % str(self._counter_init)
return self._base_name + suffix
|
2934
|
Train/png/2934.png
|
def optimized(code, silent=True, ignore_errors=True):
return constant_fold(code, silent=silent, ignore_errors=ignore_errors)
|
2866
|
Train/png/2866.png
|
def get_lang_dict(self):
r = self.yandex_translate_request("getLangs")
self.handle_errors(r)
return r.json()["langs"]
|
2743
|
Train/png/2743.png
|
def add_oct(self, oid, value, label=None):
self.add_oid_entry(oid, 'OCTET', value, label=label)
|
1991
|
Train/png/1991.png
|
def match(self, category, pattern):
return fnmatch.fnmatch(category, pattern, flags=self.FNMATCH_FLAGS)
|
6324
|
Train/png/6324.png
|
def focus_right(pymux):
" Move focus to the right. "
_move_focus(pymux,
lambda wp: wp.xpos + wp.width + 1,
lambda wp: wp.ypos)
|
2590
|
Train/png/2590.png
|
def play(self):
if self.state == STATE_PAUSED:
self._player.set_state(Gst.State.PLAYING)
self.state = STATE_PLAYING
|
8732
|
Train/png/8732.png
|
def _onLeave(self, evt):
evt.Skip()
FigureCanvasBase.leave_notify_event(self, guiEvent=evt)
|
7429
|
Train/png/7429.png
|
def vec_by_id(self, docid):
pos = self.id2pos[docid]
return self.qindex.vector_by_id(pos)
|
9041
|
Train/png/9041.png
|
def set_left_to_right(self):
self.displaymode |= LCD_ENTRYLEFT
self.write8(LCD_ENTRYMODESET | self.displaymode)
|
6150
|
Train/png/6150.png
|
def new_output_file_opt(self, opt, name):
fil = File(name)
self.add_output_opt(opt, fil)
return fil
|
242
|
Train/png/242.png
|
def write(self, *string):
self._output.write(' '.join([six.text_type(s) for s in string]))
return self
|
8581
|
Train/png/8581.png
|
def compute():
if what == "numpy":
y = eval(expr)
else:
y = ne.evaluate(expr)
return len(y)
|
3406
|
Train/png/3406.png
|
def tween2(self, val, frm, to):
return self.tween(Mapping.linlin(val, frm, to, 0, 1))
|
6181
|
Train/png/6181.png
|
def Clone(self):
return AccountState(self.ScriptHash, self.IsFrozen, self.Votes, self.Balances)
|
3883
|
Train/png/3883.png
|
def update(self):
vm = self._cs_api.list_virtualmachines(id=self.id)[0]
self.is_running = self._is_running(vm.state)
|
8722
|
Train/png/8722.png
|
def cmd_fw_manifest_purge(self):
for filepath in self.find_manifests():
os.unlink(filepath)
self.manifests_parse()
|
5649
|
Train/png/5649.png
|
def find_by_id(key: str, user: str = None) -> Optional['ApiKey']:
return ApiKey.from_db(db.get_key(key, user))
|
8554
|
Train/png/8554.png
|
def ping(self, message=None):
return self.write(self.parser.ping(message), encode=False)
|
5539
|
Train/png/5539.png
|
def _Members(self, group):
group.members = set(group.members).union(self.gids.get(group.gid, []))
return group
|
7268
|
Train/png/7268.png
|
def tripleExprFor(self, id_: ShExJ.tripleExprLabel) -> ShExJ.tripleExpr:
return self.te_id_map.get(id_)
|
3424
|
Train/png/3424.png
|
def security(name, *permissions):
def inner(c):
c.security = Security(name, *permissions)
return c
return inner
|
8004
|
Train/png/8004.png
|
def add_to_cart(item_id):
cart = Cart(session['cart'])
if cart.change_item(item_id, 'add'):
session['cart'] = cart.to_dict()
return list_products()
|
665
|
Train/png/665.png
|
def unit_vector(self):
return Point2D(self.x / self.magnitude, self.y / self.magnitude)
|
2449
|
Train/png/2449.png
|
def mcus():
ls = []
for h in hwpack_names():
for b in board_names(h):
ls += [mcu(b, h)]
ls = sorted(list(set(ls)))
return ls
|
9015
|
Train/png/9015.png
|
def to_unit(self, unit):
new_data_c = self.duplicate()
new_data_c.convert_to_unit(unit)
return new_data_c
|
9848
|
Train/png/9848.png
|
def info(self):
return itertools.chain(self.pods, self.assumptions, self.warnings)
|
9804
|
Train/png/9804.png
|
def load_file(self, file_path) -> List[str]:
content = []
content = read_lines_from_file(file_path)
return content
|
3544
|
Train/png/3544.png
|
def pm(self):
if self._pm is None:
self._pm = QPixmap(self._xpmstr)
return self._pm
|
7961
|
Train/png/7961.png
|
def doc_uri(self, args, range=None):
self.log.debug('doc_uri: in')
self.send_at_position("DocUri", False, "point")
|
1839
|
Train/png/1839.png
|
def SPI_write_byte(self, chip_select, data):
'Writes a data to a SPI device selected by chipselect bit. '
self.bus.write_byte_data(self.address, chip_select, data)
|
7277
|
Train/png/7277.png
|
def hide_auth(msg):
for pattern, repl in RE_HIDE_AUTH:
msg = pattern.sub(repl, msg)
return msg
|
655
|
Train/png/655.png
|
def init(config_file):
schema = generate_schema_file(open(config_file, 'r').read())
sys.stdout.write(schema)
|
9436
|
Train/png/9436.png
|
def image(self):
if self._image is None:
self._populate_from_rasterio_object(read_image=True)
return self._image
|
9408
|
Train/png/9408.png
|
def reset(self):
if self.resetable:
for i in range(len(self)):
self[i] = self.default
|
3129
|
Train/png/3129.png
|
def next(self):
msg = cr.Message()
msg.type = cr.NEXT
self.send_message(msg)
|
6208
|
Train/png/6208.png
|
def scaleY(self, canvasY):
'returns plotter y coordinate, with y-axis inverted'
plotterY = super().scaleY(canvasY)
return (self.plotviewBox.ymax-plotterY+4)
|
9515
|
Train/png/9515.png
|
def set_text(self, text):
self.traj_controls.timelabel.setText(
self.traj_controls._label_tmp.format(text))
|
9888
|
Train/png/9888.png
|
def _wait_for_response(self):
while not self.server.response_code:
time.sleep(2)
time.sleep(5)
self.server.shutdown()
|
3364
|
Train/png/3364.png
|
def use_value(self, value):
if self.check_value(value):
return value
return self.convert_value(value)
|
1301
|
Train/png/1301.png
|
def on_rule(self, *args):
if self.rule is None:
return
self.rule.connect(self._listen_to_rule)
|
9180
|
Train/png/9180.png
|
def get_emailer(self, cfg_section):
shutit_global.shutit_global_object.yield_to_draw()
import emailer
return emailer.Emailer(cfg_section, self)
|
136
|
Train/png/136.png
|
def none_of(value, *args):
if len(args):
value = (value,) + args
return ExpectationNone(value)
|
5322
|
Train/png/5322.png
|
def entries(self):
self.meta.seek(self.file_list_start)
for i in range(0, self.num_files):
yield self._get_node()
|
6055
|
Train/png/6055.png
|
def set_url(self, url):
self.url = url
self.host, self.path = urllib.parse.urlparse(url)[1:3]
|
7624
|
Train/png/7624.png
|
def lambdef_check(self, original, loc, tokens):
return self.check_strict("Python-style lambda", original, loc, tokens)
|
4899
|
Train/png/4899.png
|
def guess_title(basename):
base, _ = os.path.splitext(basename)
return re.sub(r'[ _-]+', r' ', base).title()
|
8655
|
Train/png/8655.png
|
def mach2tas(Mach, H):
a = vsound(H)
Vtas = Mach*a
return Vtas
|
8628
|
Train/png/8628.png
|
def close_links(self):
for uri, cf in self._cfs.items():
cf.close_link()
self._is_open = False
|
7778
|
Train/png/7778.png
|
def isclosed(self):
assert len(self) != 0
assert self.iscontinuous()
return self.start == self.end
|
5987
|
Train/png/5987.png
|
def _from_bytes(bytes, byteorder="big", signed=False):
return int.from_bytes(bytes, byteorder=byteorder, signed=signed)
|
7306
|
Train/png/7306.png
|
def ping(self):
url = self._build_url('pings', base_url=self._api)
return self._boolean(self._post(url), 204, 404)
|
7917
|
Train/png/7917.png
|
def as_html(self):
if not self._folium_map:
self.draw()
return self._inline_map(self._folium_map, self._width, self._height)
|
3877
|
Train/png/3877.png
|
def close(self):
self.cell = None
self.coro = None
self.buffer = None
del self.dests[:]
del self.sources[:]
|
9070
|
Train/png/9070.png
|
def load(self, model):
self._dawg.load(find_data(model))
self._loaded_model = True
|
7021
|
Train/png/7021.png
|
def dumps(self):
return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES}
|
4740
|
Train/png/4740.png
|
def decode(self, byteStream):
self.header = bytearray(byteStream[:HEADER_SIZE])
self.payload = byteStream[HEADER_SIZE:]
|
9911
|
Train/png/9911.png
|
def startTimer(self):
self.td = self.t.start(self.inter)
if self.use_ssh and self.ssh_connector:
self.ssh_client.connect()
|
8455
|
Train/png/8455.png
|
def display(self):
w, h = self.session.window_size()
return Display(w*self.scale, h*self.scale)
|
4697
|
Train/png/4697.png
|
def git_branch(self):
info = self.info
return 'rpm-{major}.{minor}.x'.format(
major=info[0], minor=info[1])
|
6045
|
Train/png/6045.png
|
def expand_path(path):
return os.path.abspath(os.path.expandvars(os.path.expanduser(path)))
|
4677
|
Train/png/4677.png
|
def delete_topic(self, topic):
nsq.assert_valid_topic_name(topic)
return self._request('POST', '/topic/delete', fields={'topic': topic})
|
4395
|
Train/png/4395.png
|
def receiver(self, func=None, json=False):
self.receivers.append((func, json))
|
7665
|
Train/png/7665.png
|
def get(self, path, params, **options):
return self.request('get', path, params=params, **options)
|
2888
|
Train/png/2888.png
|
def get(self):
key = self.get_key_from_request()
result = self.get_storage().get(key)
return result if result else None
|
6878
|
Train/png/6878.png
|
def drop(self):
if self._is_dropped is False:
self.table.drop(self.engine)
self._is_dropped = True
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.