common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
---|---|---|
8539
|
Train/png/8539.png
|
def opt_restore(prefix, opts):
return {prefix + name: value for name, value in opts.items()}
|
1009
|
Train/png/1009.png
|
def save_results(self, path='.'):
with open(path, 'wb') as f:
pickle.dump(self.results, f)
|
6174
|
Train/png/6174.png
|
def cli(self):
if self._cli is None:
self._cli = self.create_interface()
return self._cli
|
7267
|
Train/png/7267.png
|
def _split_license(license):
return (x.strip() for x in (l for l in _regex.split(license) if l))
|
2184
|
Train/png/2184.png
|
def directory_files(path):
for entry in os.scandir(path):
if not entry.name.startswith('.') and entry.is_file():
yield entry.name
|
7871
|
Train/png/7871.png
|
def append(self, value):
self.database.run_script(
'array_append',
keys=[self.key],
args=[value])
|
3848
|
Train/png/3848.png
|
def add_user(self, uid, nodes, weights):
for i, node in enumerate(nodes):
self.file.write("{},{},{}\n".format(uid, node, weights[i]))
|
2383
|
Train/png/2383.png
|
def finalize(self):
for c in self.consumers:
c.finalize()
self.result = [c.result for c in self.consumers]
|
4785
|
Train/png/4785.png
|
def cli(yamlfile, format, output):
print(OwlSchemaGenerator(yamlfile, format).serialize(output=output))
|
3152
|
Train/png/3152.png
|
def is_zsettable(s):
return all(map(lambda x: isinstance(x, (int, float, long)), s.values()))
|
9523
|
Train/png/9523.png
|
def send_response_message(self, request_id, meta, body):
self.response_messages.append((request_id, meta, body))
|
3090
|
Train/png/3090.png
|
def _make_regex(self):
return re.compile("|".join(map(re.escape, self.keys())))
|
6987
|
Train/png/6987.png
|
def checkbox_check(self, force_check=False):
if not self.get_attribute('checked'):
self.click(force_click=force_check)
|
7748
|
Train/png/7748.png
|
def selectnone(table, field, complement=False):
return select(table, field, lambda v: v is None, complement=complement)
|
9775
|
Train/png/9775.png
|
def iftrain(self, then_branch, else_branch):
return ifelse(self._training_flag, then_branch, else_branch, name="iftrain")
|
4625
|
Train/png/4625.png
|
def get_codec(self):
act = self.service.action("X_GetCodec")
res = await act.async_call()
return res
|
4101
|
Train/png/4101.png
|
def pull(self):
repo_root = settings.REPO_ROOT
pull_from_origin(join(repo_root, self.name))
|
8358
|
Train/png/8358.png
|
def _urlopen_as_json(self, url, headers=None):
req = Request(url, headers=headers)
return json.loads(urlopen(req).read())
|
2060
|
Train/png/2060.png
|
def _int(ctx, number):
return conversions.to_integer(conversions.to_decimal(number, ctx).to_integral_value(ROUND_FLOOR), ctx)
|
9074
|
Train/png/9074.png
|
def unapostrophe(text):
text = re.sub(r'[%s]s?$' % ''.join(APOSTROPHES), '', text)
return text
|
2034
|
Train/png/2034.png
|
def printheader(h=None):
writer = csv.writer(sys.stdout)
writer.writerow(header_fields(h))
|
2683
|
Train/png/2683.png
|
def dfromdm(dm):
if np.size(dm) > 1:
dm = np.atleast_1d(dm)
return 10**(1+dm/5)
|
8637
|
Train/png/8637.png
|
def create_new_example(self, foo='', a='', b=''):
return create_new_example(foo=foo, a=a, b=b)
|
6549
|
Train/png/6549.png
|
def cli(ctx, file, quote):
ctx.obj = {}
ctx.obj['FILE'] = file
ctx.obj['QUOTE'] = quote
|
9962
|
Train/png/9962.png
|
def bind_bar(self, sender=None, **kwargs):
bar = kwargs.pop('bar')
self.bars[bar.name] = bar
|
8592
|
Train/png/8592.png
|
def read_float(self):
self.bitcount = self.bits = 0
return unpack('>d', self.input.read(8))[0]
|
8208
|
Train/png/8208.png
|
def getAttributeData(self, name, channel=None):
return self._getNodeData(name, self._ATTRIBUTENODE, channel)
|
1771
|
Train/png/1771.png
|
def running(self, offset=0, count=25):
return self.client('jobs', 'running', self.name, offset, count)
|
3428
|
Train/png/3428.png
|
def finish(self):
self._my_map['over'] = True # finished == over?
self._my_map['completionTime'] = DateTime.utcnow()
self._save()
|
611
|
Train/png/611.png
|
def swipe_left(self, width: int = 1080, length: int = 1920) -> None:
self.swipe(0.8*width, 0.5*length, 0.2*width, 0.5*length)
|
3005
|
Train/png/3005.png
|
def set_url_part(url, **kwargs):
d = parse_url_to_dict(url)
d.update(kwargs)
return unparse_url_dict(d)
|
3578
|
Train/png/3578.png
|
def sorted_chain(*ranges: Iterable[Tuple[int, int]]) -> List[Tuple[int, int]]:
return sorted(itertools.chain(*ranges))
|
3683
|
Train/png/3683.png
|
def _ensure_queue(self):
if self._queue_path not in self._client.kv:
self._client.kv[self._queue_path] = None
|
3504
|
Train/png/3504.png
|
def readFAM(basefilename, usecols=None):
fam = basefilename+'.fam'
fam = SP.loadtxt(fam, dtype=bytes, usecols=usecols)
return fam
|
9108
|
Train/png/9108.png
|
def add(self, record):
self._field.validate_value(record)
self._elements[record.id] = record
self._sync_field()
|
5233
|
Train/png/5233.png
|
def head(self, item):
uri = "/%s/%s" % (self.uri_base, utils.get_id(item))
return self._head(uri)
|
5515
|
Train/png/5515.png
|
def Convert(self, metadata, value, token=None):
for r in self.BatchConvert([(metadata, value)], token=token):
yield r
|
1687
|
Train/png/1687.png
|
def clean_up(self):
self.socket.close()
for h in self.capture_handlers:
h['logger'].close()
|
333
|
Train/png/333.png
|
def to_coverage(ctx):
sm = Smother.load(ctx.obj['report'])
sm.coverage = coverage.coverage()
sm.write_coverage()
|
2421
|
Train/png/2421.png
|
def get_all(self, name):
return [annot for annot in self.all_annotations if annot.name == name]
|
6206
|
Train/png/6206.png
|
def DictKeyColumns(d):
'Return a list of Column objects from dictionary keys.'
return [ColumnItem(k, k, type=deduceType(d[k])) for k in d.keys()]
|
5630
|
Train/png/5630.png
|
def save_screenshot(self, name, folder=None):
return page_actions.save_screenshot(self.driver, name, folder)
|
3493
|
Train/png/3493.png
|
def setXr(self, Xr):
self.Xr = Xr
self.gp_block.covar.G = Xr
|
1922
|
Train/png/1922.png
|
def bands(self):
if self._bands is None:
self._bands = self._compute_bands()
return self._bands
|
3088
|
Train/png/3088.png
|
def appendData(self, content):
if self.pcdata is not None:
self.pcdata += content
else:
self.pcdata = content
|
1541
|
Train/png/1541.png
|
def child_added(self, child):
view = child.widget
if view is not None:
self.toast.setView(view)
|
3148
|
Train/png/3148.png
|
def _emit_error(cls, message):
sys.stderr.write('ERROR: {message}\n'.format(message=message))
sys.stderr.flush()
|
8748
|
Train/png/8748.png
|
def OnTool(self, event):
msgtype = self.ids_msgs[event.GetId()]
post_command_event(self, msgtype)
|
9820
|
Train/png/9820.png
|
def additional_files(self):
return [os.path.join(f, self.filename) for f in self.additional_dirs]
|
2525
|
Train/png/2525.png
|
def getElementsBy(self, cond: Callable[[Element], bool]) -> NodeList:
return getElementsBy(self, cond)
|
5454
|
Train/png/5454.png
|
def wait(self, timeout=None):
self._event.wait(timeout)
return self._event.isSet()
|
260
|
Train/png/260.png
|
def is_complete(self):
return all(p.name in self.values for p in self.parameters if p.required)
|
7230
|
Train/png/7230.png
|
def _to_solr(self, data):
return self._dest.index_json(self._dest_coll, json.dumps(data, sort_keys=True))
|
9449
|
Train/png/9449.png
|
def enable_encryption(self, output_key, input_key):
self._chacha = chacha20.Chacha20Cipher(output_key, input_key)
|
2899
|
Train/png/2899.png
|
def __execute_rot(self, surface):
self.image = pygame.transform.rotate(surface, self.__rotation)
self.__resize_surface_extents()
|
2397
|
Train/png/2397.png
|
def libraries():
ls = libraries_dir().dirs()
ls = [str(x.name) for x in ls]
ls.sort()
return ls
|
4129
|
Train/png/4129.png
|
def parse_path(path):
version, project = path[1:].split('/')
return dict(version=int(version), project=project)
|
6641
|
Train/png/6641.png
|
def ToTimedelta(self):
return timedelta(
seconds=self.seconds, microseconds=_RoundTowardZero(
self.nanos, _NANOS_PER_MICROSECOND))
|
7354
|
Train/png/7354.png
|
def reset_ttl(self, other):
self.created = other.created
self.ttl = other.ttl
|
1565
|
Train/png/1565.png
|
def print_graph(self, format: str = 'turtle') -> str:
print(self.g.serialize(format=format).decode('utf-8'))
|
6922
|
Train/png/6922.png
|
def Cx(mt, x):
return ((1 / (1 + mt.i)) ** (x + 1)) * mt.dx[x] * ((1 + mt.i) ** 0.5)
|
1909
|
Train/png/1909.png
|
def create_ticket(self, service):
ticket = AuthTicket(owner=self, service=service)
ticket.authorize()
return ticket
|
7106
|
Train/png/7106.png
|
def relativeAreaSTE(self):
s = self.noSTE.shape
return np.sum(self.mask_STE) / (s[0] * s[1])
|
9299
|
Train/png/9299.png
|
def extend(a: dict, b: dict) -> dict:
res = a.copy()
res.update(b)
return res
|
7780
|
Train/png/7780.png
|
def set_title(self, title, **kwargs):
ax = self.get_axes()
ax.set_title(title, **kwargs)
|
5962
|
Train/png/5962.png
|
def SampleStart(self):
self._start_cpu_time = time.clock()
self.start_sample_time = time.time()
self.total_cpu_time = 0
|
234
|
Train/png/234.png
|
def converter(f):
@wraps(f)
def wrapper(*args, **kwds):
return convert(f(*args, **kwds))
return wrapper
|
4986
|
Train/png/4986.png
|
def buildpack(self, url):
cmd = ["heroku", "buildpacks:add", url, "--app", self.name]
self._run(cmd)
|
9819
|
Train/png/9819.png
|
def magnitude(X):
r = np.real(X)
i = np.imag(X)
return np.sqrt(r * r + i * i)
|
2131
|
Train/png/2131.png
|
def impute_data(self, x):
imp = Imputer(missing_values='NaN', strategy='mean', axis=0)
return imp.fit_transform(x)
|
613
|
Train/png/613.png
|
def swipe_up(self, width: int = 1080, length: int = 1920) -> None:
self.swipe(0.5*width, 0.8*length, 0.5*width, 0.2*length)
|
4883
|
Train/png/4883.png
|
def set_background(self, background):
scene = self.scene
scene.setBackgroundBrush(QColor.fromRgba(background.argb))
|
4675
|
Train/png/4675.png
|
def ready(self, count):
self.ready_count = count
self.send(nsq.ready(count))
|
2811
|
Train/png/2811.png
|
def favorites_remove(photo_id):
method = 'flickr.favorites.remove'
_dopost(method, auth=True, photo_id=photo_id)
return True
|
4789
|
Train/png/4789.png
|
def cli(yamlfile, format, output, context):
print(RDFGenerator(yamlfile, format).serialize(
output=output, context=context))
|
6040
|
Train/png/6040.png
|
def run(self):
while not self._state.is_terminating:
self._process_event_queue()
self._state.maybe_pause()
|
6627
|
Train/png/6627.png
|
def next(self):
self._parse_block()
if self._remaining > 0:
self._remaining -= 1
return six.next(self._iter_rows)
|
7164
|
Train/png/7164.png
|
def _isclose(obja, objb, rtol=1e-05, atol=1e-08):
return abs(obja - objb) <= (atol + rtol * abs(objb))
|
3118
|
Train/png/3118.png
|
def _set_toChange(x):
for key in list(x.keys()):
self.toChange[key] = True
|
2234
|
Train/png/2234.png
|
def remove_path(target_path):
if os.path.isdir(target_path):
shutil.rmtree(target_path)
else:
os.unlink(target_path)
|
1178
|
Train/png/1178.png
|
def write(self, arg):
if isinstance(arg, str):
arg = arg.encode(self.encoding)
return self._buffer.write(arg)
|
4364
|
Train/png/4364.png
|
def download_to(self, folder):
urlretrieve(self.maven_url, os.path.join(folder, self.filename))
|
7739
|
Train/png/7739.png
|
def list(self, **params) -> Mapping:
response = await self.docker._query_json("images/json", "GET", params=params)
return response
|
6699
|
Train/png/6699.png
|
def _row_resized(self, row, old_height, new_height):
self.dataTable.setRowHeight(row, new_height)
self._update_layout()
|
8517
|
Train/png/8517.png
|
def reload(self, env=None, silent=None): # pragma: no cover
self.clean()
self.execute_loaders(env, silent)
|
1265
|
Train/png/1265.png
|
def _nelec(self):
pd = self.particle_distribution(self._gam * mec2)
return pd.to(1 / mec2_unit).value
|
5195
|
Train/png/5195.png
|
def to_snake(camel):
if not camel:
return camel
return ''.join('_' + x if 'A' <= x <= 'Z' else x for x in camel).lower()[camel[0].isupper():]
|
9943
|
Train/png/9943.png
|
def _set_addr(self, addr):
if self._addr != addr:
ioctl(self._fd, SMBUS.I2C_SLAVE, addr)
self._addr = addr
|
482
|
Train/png/482.png
|
def parse_rule(rule: str, raise_error=False):
parser = Parser(raise_error)
return parser.parse(rule)
|
8466
|
Train/png/8466.png
|
def spawn(f):
def fun(pipe, x):
pipe.send(f(x))
pipe.close()
return fun
|
8756
|
Train/png/8756.png
|
def Reposition(self):
rect = self.GetFieldRect(1)
self.safemode_staticbmp.SetPosition((rect.x, rect.y))
self.size_changed = False
|
5981
|
Train/png/5981.png
|
def SRem(a: BitVec, b: BitVec) -> BitVec:
return _arithmetic_helper(a, b, z3.SRem)
|
7920
|
Train/png/7920.png
|
def _set_folium_map(self):
m = Map(features=[self], width=self._width, height=self._height)
self._folium_map = m.draw()
|
1331
|
Train/png/1331.png
|
def get_plugins(cls, *args, **kwargs):
return [plugin(*args, **kwargs) for plugin in cls.plugins]
|
6504
|
Train/png/6504.png
|
def merge_dict(a, b):
c = a.copy()
c.update(b)
return c
|
10100
|
Train/png/10100.png
|
def start_channels(self, *args, **kw):
super(QtKernelManager, self).start_channels(*args, **kw)
self.started_channels.emit()
|
4078
|
Train/png/4078.png
|
def all_files(self):
return set([entry.decode() for entry, _ in self.git.open_index().items()])
|
5855
|
Train/png/5855.png
|
def bitop_not(self, dest, key):
return self.execute(b'BITOP', b'NOT', dest, key)
|
1233
|
Train/png/1233.png
|
def has_user(self, username):
return self.model.objects.filter(
**self._filter_user_by(username)
).exists()
|
8027
|
Train/png/8027.png
|
def forward_char(event):
" Move forward a character. "
buff = event.current_buffer
buff.cursor_position += buff.document.get_cursor_right_position(
count=event.arg)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.