common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
9477 | Train/png/9477.png | def small_phi_ces_distance(C1, C2):
return sum(c.phi for c in C1) - sum(c.phi for c in C2)
|
1813 | Train/png/1813.png | def connect(self, signal, **kwargs):
signal.connect(self, **kwargs)
self.connections.append((signal, kwargs))
|
397 | Train/png/397.png | def _heappush_max(heap, item):
heap.append(item)
heapq._siftdown_max(heap, 0, len(heap) - 1)
|
1663 | Train/png/1663.png | def end_byte(self):
return min(
(self.part_number + 1) * self.multipart.chunk_size,
self.multipart.size
)
|
8161 | Train/png/8161.png | def _rectangular(n):
for i in n:
if len(i) != len(n[0]):
return False
return True
|
7563 | Train/png/7563.png | def nRows(self):
if self.nCols:
return max([len(x) for x in self.colData])
else:
return 0
|
9075 | Train/png/9075.png | def peers(cls):
contentType = ContentType.objects.get_for_model(cls)
return cls.objects.filter(content_type=contentType)
|
1046 | Train/png/1046.png | def pull(image, tag=None):
if tag:
image = ":".join([image, tag])
utils.xrun("docker pull", [image])
|
2512 | Train/png/2512.png | def unicode_to_string(self):
for tag in self.tags:
self.ununicode.append(str(tag))
|
2313 | Train/png/2313.png | def _bld_op(self, op, num, **kwargs):
kwargs['other'] = num
setattr(self, op, {'mtype': pab, 'kwargs': kwargs})
|
8281 | Train/png/8281.png | def calc_volume(self, sample: np.ndarray):
return sqrt(np.mean(np.square(sample)))
|
5382 | Train/png/5382.png | def replay_data(self, replay_path):
with gfile.Open(self.abs_replay_path(replay_path), "rb") as f:
return f.read()
|
1414 | Train/png/1414.png | def list(self, channels=None, server=""):
self.send_items('LIST', ','.join(always_iterable(channels)), server)
|
5978 | Train/png/5978.png | def UGE(a: BitVec, b: BitVec) -> Bool:
return Or(UGT(a, b), a == b)
|
5753 | Train/png/5753.png | def createConnection(self):
uri = self.reader.createConnection()
return Pyro.core.getAttrProxyForURI(uri)
|
6640 | Train/png/6640.png | def ToMilliseconds(self):
millis = _RoundTowardZero(self.nanos, _NANOS_PER_MILLISECOND)
return self.seconds * _MILLIS_PER_SECOND + millis
|
10036 | Train/png/10036.png | def delete(self):
CProfileWrapper.profiler.create_stats()
self.enable()
self.set_status(204)
self.finish()
|
6534 | Train/png/6534.png | def rmdir(self):
if self._closed:
self._raise_closed()
self._accessor.rmdir(self)
|
3846 | Train/png/3846.png | def add(self, action):
self._state_machine.transition_to_add()
self._actions.append(action)
|
10099 | Train/png/10099.png | def downsample(array, k):
length = array.shape[0]
indices = random.sample(xrange(length), k)
return array[indices]
|
1699 | Train/png/1699.png | def _extension(modpath: str) -> setuptools.Extension:
return setuptools.Extension(modpath, [modpath.replace(".", "/") + ".py"])
|
2101 | Train/png/2101.png | def average(iterator):
count = 0
total = 0
for num in iterator:
count += 1
total += num
return float(total)/count
|
600 | Train/png/600.png | def _init_turrets(self):
for turret in Turret.select():
self.turrets.append(turret.to_dict())
|
4914 | Train/png/4914.png | def delete_row(self, ind):
self.df = pd.concat([self.df[:ind], self.df[ind+1:]], sort=True)
return self.df
|
1313 | Train/png/1313.png | def load_byte(buf, pos):
end = pos + 1
if end > len(buf):
raise BadRarFile('cannot load byte')
return S_BYTE.unpack_from(buf, pos)[0], end
|
8500 | Train/png/8500.png | def drawQuad(self, quad):
q = Quad(quad)
return self.drawPolyline([q.ul, q.ll, q.lr, q.ur, q.ul])
|
1130 | Train/png/1130.png | def get_id(self):
_id = self._meta.get("id", None)
if _id is None:
_id = self.save()
return _id
|
538 | Train/png/538.png | def dumpfile(self, fd):
self.start()
dump = DumpFile(fd)
self.queue.append(dump)
|
1195 | Train/png/1195.png | def set_author(self):
try:
self.author = self.soup.find('author').string
except AttributeError:
self.author = None
|
9277 | Train/png/9277.png | def safe_call(cls, method, *args):
return cls.call(method, *args, safe=True)
|
6447 | Train/png/6447.png | def _brightness(x, change: uniform):
"Apply `change` in brightness of image `x`."
return x.add_(scipy.special.logit(change))
|
5964 | Train/png/5964.png | def prepare_batch(self, batch: mx.io.DataBatch):
self.module.prepare(batch)
|
4194 | Train/png/4194.png | def update_pool(self, pool, body=None):
return self.put(self.pool_path % (pool), body=body)
|
5999 | Train/png/5999.png | def xyz2angle(x, y, z):
azi = xu.rad2deg(xu.arctan2(x, y))
zen = 90 - xu.rad2deg(xu.arctan2(z, xu.sqrt(x**2 + y**2)))
return azi, zen
|
1599 | Train/png/1599.png | def _button_minus_clicked(self, n):
self._button_save.setEnabled(True)
self.pop_colorpoint(n)
self._build_gui()
|
7654 | Train/png/7654.png | def lenient_add_filter(self, *args, **kwargs):
if args and args[0] != "raiseonerror":
self.original_add_filter(*args, **kwargs)
|
3594 | Train/png/3594.png | def reset(cls):
cls.input_el.value = ""
cls.subconspect_el.html = ""
cls.show_error(False)
|
3080 | Train/png/3080.png | def safestr(str_):
str_ = str_ or ""
return "".join(x for x in str_ if x.isalnum())
|
750 | Train/png/750.png | def removeItem(self, index):
self._stim.removeComponent(index.row(), index.column())
|
9917 | Train/png/9917.png | def create_user(username):
"Create a new user."
password = prompt_pass("Enter password")
user = User(username=username, password=password)
db.session.add(user)
db.session.commit()
|
8000 | Train/png/8000.png | def sockets(self):
return [Socket(self._device, i) for i in range(len(self.raw))]
|
1552 | Train/png/1552.png | def stop(self):
if self._thread is not None and self._thread.isAlive():
self._done.set()
|
5191 | Train/png/5191.png | def _match_literal(self, a, b=None):
return a.lower() == b if not self.case_sensitive else a == b
|
1103 | Train/png/1103.png | def get_power_parameters(self):
data = await self._handler.power_parameters(system_id=self.system_id)
return data
|
3490 | Train/png/3490.png | def delete_row(self, key, value):
self.rows = filter(lambda x: x.get(key) != value, self.rows)
|
5010 | Train/png/5010.png | def Reverse(self, y):
return self._Bisect(y, self.ys, self.xs)
|
1155 | Train/png/1155.png | def get_edge_annotations(self, u, v, key: str) -> Optional[AnnotationsDict]:
return self._get_edge_attr(u, v, key, ANNOTATIONS)
|
2765 | Train/png/2765.png | def info(docgraph):
print(networkx.info(docgraph), '\n')
node_statistics(docgraph)
print
edge_statistics(docgraph)
|
387 | Train/png/387.png | def __unroll(self, rolled):
return np.array(np.concatenate([matrix.flatten() for matrix in rolled], axis=1)).reshape(-1)
|
6625 | Train/png/6625.png | def _decimal_to_json(value):
if isinstance(value, decimal.Decimal):
value = str(value)
return value
|
2594 | Train/png/2594.png | def auth_request(self, url, headers, body):
return self.req.post(url, headers, body=body)
|
3777 | Train/png/3777.png | def filter_users(self, users):
return [LeaderboardInstance(x) for x in self._leaderboard if x['user_id'] in users]
|
1060 | Train/png/1060.png | def _filter(self, query, **kwargs):
query = self._auto_filter(query, **kwargs)
return query
|
1075 | Train/png/1075.png | def _hmac_auth(self):
return TcExHmacAuth(self.args.api_access_id, self.args.api_secret_key, self.tcex.log)
|
7269 | Train/png/7269.png | def normalize_uri(u: URI) -> URIRef:
return u if isinstance(u, URIRef) else URIRef(str(u))
|
3392 | Train/png/3392.png | def bundle(self, name: str) -> models.Bundle:
return self.Bundle.filter_by(name=name).first()
|
2242 | Train/png/2242.png | def children(self, vertex):
return [self.head(edge) for edge in self.out_edges(vertex)]
|
7441 | Train/png/7441.png | def _to_args(x):
if not isinstance(x, (list, tuple, np.ndarray)):
x = [x]
return x
|
10040 | Train/png/10040.png | def render3d(self, view=None):
super(StaticWorld, self).render3d(view)
self.batch3d.draw()
|
4782 | Train/png/4782.png | def ring2nest(nside, ipix):
ipix = np.atleast_1d(ipix).astype(np.int64, copy=False)
return ring_to_nested(ipix, nside)
|
5134 | Train/png/5134.png | def exists(path, **kwargs):
import os.path
return os.path.exists(path, **kwargs)
|
7454 | Train/png/7454.png | def wrapping(self):
value = self._wrapping
return value[0] if all([v == value[0] for v in value]) else value
|
8527 | Train/png/8527.png | def chain_id(chain_id: int, chain_class: Type[BaseChain]) -> Type[BaseChain]:
return chain_class.configure(chain_id=chain_id)
|
9284 | Train/png/9284.png | def set_alias(cls, domain, login, aliases):
return cls.call('domain.mailbox.alias.set', domain, login, aliases)
|
3676 | Train/png/3676.png | def reset(self, data, size):
return lib.zframe_reset(self._as_parameter_, data, size)
|
1555 | Train/png/1555.png | def add_synonym(self, other):
self.synonyms.extend(other.synonyms)
other.synonyms = self.synonyms
|
37 | Train/png/37.png | def save_dot(self, fd):
from pylon.io import DotWriter
DotWriter(self).write(fd)
|
1487 | Train/png/1487.png | def push(h, x):
h.push(x)
up(h, h.size()-1)
|
7145 | Train/png/7145.png | def do_quit(self, args):
self._interp.set_break(self._interp.BREAK_NONE)
return True
|
8744 | Train/png/8744.png | def __print(self, msg):
self.announce(msg, level=distutils.log.INFO)
|
3133 | Train/png/3133.png | def step_impl07(context):
assert context.st_1 is context.st_2
assert context.st_2 is context.st_3
|
398 | Train/png/398.png | def remove(self, idxs):
import utool as ut
keep_idxs = ut.index_complement(idxs, len(self))
return self.take(keep_idxs)
|
2366 | Train/png/2366.png | def status(context):
context.obj.find_repo_type()
context.obj.call([context.obj.vc_name, 'status'])
|
2898 | Train/png/2898.png | def center_origin(self):
self.set_origin(Vector2(self.image.get_width() /
2.0, self.image.get_height() / 2.0))
|
1799 | Train/png/1799.png | def from_wc(cls, wc):
return cls(wcdict=wc.dict, scale=wc.scale, eft=wc.eft, basis=wc.basis)
|
5906 | Train/png/5906.png | def reseed_random(seed):
r = random.Random(seed)
random_internal_state = r.getstate()
set_random_state(random_internal_state)
|
2029 | Train/png/2029.png | def getroot(self):
builder = ET.TreeBuilder()
self.build(builder)
return builder.close()
|
6820 | Train/png/6820.png | def get(key, profile=None):
conn = salt.utils.memcached.get_conn(profile)
return salt.utils.memcached.get(conn, key)
|
317 | Train/png/317.png | def verify(backup_path, fast):
from PyHardLinkBackup.phlb.verify import verify_backup
verify_backup(backup_path, fast)
|
6618 | Train/png/6618.png | def reset_state(self):
super(AugmentorList, self).reset_state()
for a in self.augmentors:
a.reset_state()
|
6757 | Train/png/6757.png | def show_env(self, env):
self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
|
9747 | Train/png/9747.png | def offsets(self):
return np.array([self.x_offset, self.y_offset, self.z_offset])
|
6546 | Train/png/6546.png | def path_to(self, p):
if os.path.isabs(p):
return p
return os.sep.join([self._original_dir, p])
|
8725 | Train/png/8725.png | def set_ip_port(self, ip, port):
self.address = ip
self.port = port
self.stop()
self.start()
|
2592 | Train/png/2592.png | def stop(self):
urllib.request.urlcleanup()
self._player.set_state(Gst.State.NULL)
self.state = STATE_IDLE
self._tags = {}
|
9632 | Train/png/9632.png | def delete_variable(self, name):
del self.variables[name]
self.signal_variable_changed.emit(self, name, "delete")
|
7755 | Train/png/7755.png | def save(self, filename):
clibrebound.reb_output_binary(
byref(self), c_char_p(filename.encode("ascii")))
|
6436 | Train/png/6436.png | def channel_view(x: Tensor) -> Tensor:
"Make channel the first axis of `x` and flatten remaining axes"
return x.transpose(0, 1).contiguous().view(x.shape[1], -1)
|
6159 | Train/png/6159.png | def docstr(self, prefix='', include_label=True):
return '\n'.join([x.docstr(prefix, include_label) for x in self])
|
2846 | Train/png/2846.png | def get_field(brain_or_object, name, default=None):
fields = get_fields(brain_or_object)
return fields.get(name, default)
|
8213 | Train/png/8213.png | def _make_immutable(self):
self._bytes = bytes(self._bytes)
self.__immutable = True
|
9922 | Train/png/9922.png | def write_config(configuration):
with open(CONFIG_PATH, 'w') as f:
json.dump(configuration, f, indent=2, sort_keys=True)
|
8976 | Train/png/8976.png | def stderr(msg, silent=False):
if not silent:
print(msg, file=sys.stderr)
|
2742 | Train/png/2742.png | def add_int(self, oid, value, label=None):
self.add_oid_entry(oid, 'INTEGER', value, label=label)
|
4784 | Train/png/4784.png | def cli(yamlfile, inline, format):
print(JsonSchemaGenerator(yamlfile, format).serialize(inline=inline))
|
8088 | Train/png/8088.png | def log_message(self, msg, *args):
if args:
msg = msg % args
self.logger.info(msg)
|
7827 | Train/png/7827.png | def python_version():
major, minor, patch = sys.version_info[0:3]
return '{0}.{1}.{2}'.format(major, minor, patch)
|
2709 | Train/png/2709.png | def regex(self):
if not self._compiled_regex:
self._compiled_regex = re.compile(self.raw)
return self._compiled_regex
|
1620 | Train/png/1620.png | def _ip2country(ip):
if ip:
match = geolite2.reader().get(ip)
return match.get('country', {}).get('iso_code') if match else None
|
8121 | Train/png/8121.png | def cart2pol(x, y):
theta = np.arctan2(y, x)
rho = np.hypot(x, y)
return theta, rho
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.