common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
9646 | Train/png/9646.png | def show(self, title=''):
self.render(title=title)
if self.fig:
plt.show(self.fig)
|
6588 | Train/png/6588.png | def denormalize_bboxes(bboxes, rows, cols):
return [denormalize_bbox(bbox, rows, cols) for bbox in bboxes]
|
8132 | Train/png/8132.png | def get_intent(self, intent_id):
endpoint = self._intent_uri(intent_id=intent_id)
return self._get(endpoint)
|
2475 | Train/png/2475.png | def put(self, key, value, *args):
self._db[key] = value
await self.save()
|
4344 | Train/png/4344.png | def message(self, text):
self.client.publish(self.keys.external,
'{}: {}'.format(self.resource, text))
|
4329 | Train/png/4329.png | def list_websites(self):
self.connect()
results = self.server.list_websites(self.session_id)
return results
|
6369 | Train/png/6369.png | def _maybe_to_sparse(array):
if isinstance(array, ABCSparseSeries):
array = array.values.copy()
return array
|
7166 | Train/png/7166.png | def write(self):
dumped = self._fax.codec.dump(self.__state, open(self.state_file, 'w'))
|
1105 | Train/png/1105.png | def read(cls, id: int):
data = await cls._handler.read(id=id)
return cls(data)
|
1657 | Train/png/1657.png | def touch():
from .models import Bucket
bucket = Bucket.create()
db.session.commit()
click.secho(str(bucket), fg='green')
|
8200 | Train/png/8200.png | def iqr(b, perc=(25, 75)):
b = checkma(b)
low, high = calcperc(b, perc)
return low, high, high - low
|
9325 | Train/png/9325.png | def get_attr(self, method_name):
return self.attrs.get(method_name) or self.get_callable_attr(method_name)
|
4847 | Train/png/4847.png | def get(cls, parent, name):
return cls.query.filter_by(parent=parent, name=name).one_or_none()
|
7133 | Train/png/7133.png | def from_def(cls, obj):
prof = cls(obj["steamid"])
prof._cache = obj
return prof
|
3705 | Train/png/3705.png | def response(self, msgid, response):
self.requests[msgid].callback(response)
del self.requests[msgid]
|
7334 | Train/png/7334.png | def emphasis(node):
o = nodes.emphasis()
for n in MarkDown(node):
o += n
return o
|
8806 | Train/png/8806.png | def mse(X):
return np.mean(np.square(np.abs(np.fft.fft(X, axis=1))), axis=1)
|
9542 | Train/png/9542.png | def truncate(data, l=20):
"truncate a string"
info = (data[:l] + '..') if len(data) > l else data
return info
|
2993 | Train/png/2993.png | def measures(self):
from ambry.valuetype.core import ROLE
return [c for c in self.columns if c.role == ROLE.MEASURE]
|
5270 | Train/png/5270.png | def _escape_jid(jid):
jid = six.text_type(jid)
jid = re.sub(r"'*", "", jid)
return jid
|
5230 | Train/png/5230.png | def list(self, limit=None, offset=None):
return self._manager.list(limit=limit, offset=offset)
|
7407 | Train/png/7407.png | def client(self):
if self._client is None:
self._client = self._client_builder()
return self._client
|
8952 | Train/png/8952.png | def set_tempo(self, bpm):
self.bpm = bpm
self.track_data += self.set_tempo_event(self.bpm)
|
1333 | Train/png/1333.png | def _resolved_objects(pdf, xobject):
return [pdf.getPage(i).get(xobject) for i in range(pdf.getNumPages())][0]
|
8642 | Train/png/8642.png | def escape(str):
out = ''
for char in str:
if char in '\\ ':
out += '\\'
out += char
return out
|
7083 | Train/png/7083.png | def warning(self, msg, indent=0, **kwargs):
return self.logger.warning(self._indent(msg, indent), **kwargs)
|
5904 | Train/png/5904.png | def zone_data(self):
if self._zone_data is None:
self._zone_data = self._get('/zones/' + self.domain).json()
return self._zone_data
|
8133 | Train/png/8133.png | def post_intent(self, intent_json):
endpoint = self._intent_uri()
return self._post(endpoint, data=intent_json)
|
9359 | Train/png/9359.png | def _add_relations(self, relations):
for k, v in six.iteritems(relations):
self.d.relate(k, v)
|
7150 | Train/png/7150.png | def field_pk_from_json(self, data):
model = get_model(data['app'], data['model'])
return PkOnlyModel(self, model, data['pk'])
|
1997 | Train/png/1997.png | def density(self):
r = self.radius * _Rsun
m = self.mass * _Msun
return 0.75 * m / (np.pi * r * r * r)
|
3040 | Train/png/3040.png | def empty_bar_plot(ax):
plt.sca(ax)
plt.setp(plt.gca(), xticks=[], xticklabels=[])
return ax
|
6740 | Train/png/6740.png | def load_bookmarks(filename):
bookmarks = _load_all_bookmarks()
return {k: v for k, v in bookmarks.items() if v[0] == filename}
|
3673 | Train/png/3673.png | def resync(self, alias):
return Zlist(lib.zdir_resync(self._as_parameter_, alias), True)
|
4524 | Train/png/4524.png | def count(self):
return functools.reduce(lambda x, y: x * y, (x.count for x in self.bounds))
|
1848 | Train/png/1848.png | def FromString(s, **kwargs):
f = StringIO.StringIO(s)
return FromFile(f, **kwargs)
|
6326 | Train/png/6326.png | def focus_up(pymux):
" Move focus up. "
_move_focus(pymux,
lambda wp: wp.xpos,
lambda wp: wp.ypos - 2)
|
7315 | Train/png/7315.png | def transform(self, attrs):
self.collect(attrs)
self.add_missing_implementations()
self.fill_attrs(attrs)
|
2387 | Train/png/2387.png | def impute(imputer):
def f(G, bim):
return imputer.fit_transform(G), bim
return f
|
1271 | Train/png/1271.png | def get_leaves(self):
return self.fold_up(lambda n, fl, fg: fl + fg, lambda leaf: [leaf])
|
6022 | Train/png/6022.png | def send_exit(cls, sock, payload=b''):
cls.write_chunk(sock, ChunkType.EXIT, payload)
|
347 | Train/png/347.png | def count(self):
result = 0
for tasks in self.__registry.values():
result += len(tasks)
return result
|
243 | Train/png/243.png | def aggregate_count(keyname):
def inner(docs):
return sum(doc[keyname] for doc in docs)
return keyname, inner
|
3730 | Train/png/3730.png | def init(module, db):
for model in farine.discovery.import_models(module):
model._meta.database = db
|
6373 | Train/png/6373.png | def filter_by_func(self, func: Callable) -> 'ItemList':
"Only keep elements for which `func` returns `True`."
self.items = array([o for o in self.items if func(o)])
return self
|
6565 | Train/png/6565.png | def do_files_exist(filenames):
preexisting = [tf.io.gfile.exists(f) for f in filenames]
return any(preexisting)
|
1256 | Train/png/1256.png | def set_origin(self, origin=None):
if origin:
self._origin = origin.encode()
else:
self._origin = None
|
3461 | Train/png/3461.png | def set_transcript_name(self, name):
self._options = self._options._replace(name=name)
|
6933 | Train/png/6933.png | def save(self, sortkey=True):
return [k + '=' + repr(v) for k, v in self.config_items(sortkey)]
|
7781 | Train/png/7781.png | def clear_matplotlib_ticks(self, axis="both"):
ax = self.get_axes()
plotting.clear_matplotlib_ticks(ax=ax, axis=axis)
|
7457 | Train/png/7457.png | def exception(self):
code, _, message = self.data.partition(' ')
return self.find(code)(message)
|
805 | Train/png/805.png | def bit_clone(bits):
new = BitSet(bits.size)
new.ior(bits)
return new
|
3489 | Train/png/3489.png | def delete_table(self, tablename):
self.tables = filter(lambda x: x.name != tablename, self.tables)
|
6367 | Train/png/6367.png | def _set_as_cached(self, item, cacher):
self._cacher = (item, weakref.ref(cacher))
|
9392 | Train/png/9392.png | def schedule(self, task):
self.task_manager.register(task)
self.worker_manager.dispatch(task)
|
3545 | Train/png/3545.png | def icon(self):
if self._icon is None:
self._icon = QIcon(self.pm())
return self._icon
|
2493 | Train/png/2493.png | def _make_individual(self, paramlist):
part = creator.Individual(paramlist)
part.ident = None
return part
|
6382 | Train/png/6382.png | def annealing_exp(start: Number, end: Number, pct: float) -> Number:
"Exponentially anneal from `start` to `end` as pct goes from 0.0 to 1.0."
return start * (end/start) ** pct
|
9736 | Train/png/9736.png | def export(self, metadata, **kwargs):
"Turn metadata into JSON"
kwargs.setdefault('indent', 4)
metadata = json.dumps(metadata, **kwargs)
return u(metadata)
|
8802 | Train/png/8802.png | def project_top_dir(self, *args) -> str:
return os.path.join(self.project_dir, *args)
|
1927 | Train/png/1927.png | def get_root_path():
root_path = __file__
return os.path.dirname(os.path.realpath(root_path))
|
3353 | Train/png/3353.png | def rebuild(self):
movi = self.riff.find('LIST', 'movi')
movi.chunks = self.combine_streams()
self.rebuild_index()
|
6169 | Train/png/6169.png | def possible_params(self):
return self.params if isinstance(self.params, list) else [self.params]
|
5332 | Train/png/5332.png | def some(arr):
return functools.reduce(lambda x, y: x or (y is not None), arr, False)
|
8416 | Train/png/8416.png | def remove_checksum(path):
path = '{}.md5sum'.format(path)
if os.path.exists(path):
os.remove(path)
|
3565 | Train/png/3565.png | def substitute(self, values: Dict[str, Any]) -> str:
return self.template.substitute(values)
|
5658 | Train/png/5658.png | def sort_args(args):
args = args.copy()
flags = [i for i in args if FLAGS_RE.match(i[1])]
for i in flags:
args.remove(i)
return args + flags
|
6784 | Train/png/6784.png | def _expand_path(path):
path = os.path.expandvars(path)
path = os.path.expanduser(path)
return path
|
8706 | Train/png/8706.png | def path(self):
(x, y) = self.tile
return os.path.join('%u' % self.zoom,
'%u' % y,
'%u.img' % x)
|
2965 | Train/png/2965.png | def create(handler, item_document):
data = {'operation': 'create',
'item': json.load(item_document)}
handler.invoke(data)
|
4353 | Train/png/4353.png | def __complete_cmds(self, text):
return [name for name in self._cmd_map_visible.keys() if name.startswith(text)]
|
8129 | Train/png/8129.png | def split(self):
key = '%s/split' % self.key
return self._server.query(key, method=self._server._session.put)
|
8636 | Train/png/8636.png | def list_services(self):
services = list(self.services.keys())
services.sort()
return services
|
99 | Train/png/99.png | def append_text(self, txt):
with open(self.fullname, "a") as myfile:
myfile.write(txt)
|
1236 | Train/png/1236.png | def hex_to_rgb(self, h):
rgb = (self.hex_to_red(h), self.hex_to_green(h), self.hex_to_blue(h))
return rgb
|
6714 | Train/png/6714.png | def setup_proxy_model(self):
self.proxymodel = ProxyModel(self)
self.proxymodel.setSourceModel(self.fsmodel)
|
217 | Train/png/217.png | def install(self):
with self.selenium.context(self.selenium.CONTEXT_CHROME):
self.find_primary_button().click()
|
8359 | Train/png/8359.png | def Times(self, val):
return Point(self.x * val, self.y * val, self.z * val)
|
6489 | Train/png/6489.png | def _norm(self, x):
return tf.sqrt(tf.reduce_sum(tf.square(x), keepdims=True, axis=-1) + 1e-7)
|
4281 | Train/png/4281.png | def printdata(self) -> None:
np.set_printoptions(threshold=np.nan)
print(self.data)
np.set_printoptions(threshold=1000)
|
4954 | Train/png/4954.png | def filter_string(n: Node, query: str) -> str:
return _scalariter2item(n, query, str)
|
8963 | Train/png/8963.png | def load_plugins():
loader = _PluginLoader()
for pkg in PLUGIN_PACKAGES:
loader.load_plugins(pkg)
return loader.plugins
|
4105 | Train/png/4105.png | def update(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)
|
3601 | Train/png/3601.png | def values_for(self, k):
return [getattr(frame, k) for frame in self.stack if hasattr(frame, k)]
|
6533 | Train/png/6533.png | def write(self, s, flush=True):
return self._writeb(s, flush=flush)
|
1320 | Train/png/1320.png | def get_all(self, path, data=None, limit=100):
return ListResultSet(path=path, data=data or {}, limit=limit)
|
2841 | Train/png/2841.png | def draw_image(
self, img_filename: str, x: float, y: float, w: float, h: float
) -> None:
pass
|
3532 | Train/png/3532.png | def create_table(self, cursor, target, options):
"Creates the target table."
cursor.execute(
self.create_sql[target].format(self.qualified_names[target]))
|
3832 | Train/png/3832.png | def set_time(self, key_name, new_time):
self.unbake()
kf = self.dct[key_name]
kf['time'] = new_time
self.bake()
|
4777 | Train/png/4777.png | def remove(self, sound):
with self.chunk_available:
sound.playing = False
self.sounds.remove(sound)
|
1572 | Train/png/1572.png | def device_not_active(self, addr):
self.aldb_device_handled(addr)
for callback in self._cb_device_not_active:
callback(addr)
|
5004 | Train/png/5004.png | def _has_manual_kern_feature(font):
return any(f for f in font.features if f.name == "kern" and not f.automatic)
|
731 | Train/png/731.png | def print_callback(msg):
json.dump(msg, stdout)
stdout.write('\n')
stdout.flush()
|
1810 | Train/png/1810.png | def _get_chain_by_sid(sid):
try:
return d1_gmn.app.models.Chain.objects.get(sid__did=sid)
except d1_gmn.app.models.Chain.DoesNotExist:
pass
|
1976 | Train/png/1976.png | def write_line(self, line, count=1):
self.write(line)
self.write_newlines(count)
|
5428 | Train/png/5428.png | def _decode_request(self, encoded_request):
obj = self.serializer.loads(encoded_request)
return request_from_dict(obj, self.spider)
|
6418 | Train/png/6418.png | def get_model(model: nn.Module):
"Return the model maybe wrapped inside `model`."
return model.module if isinstance(model, (DistributedDataParallel, nn.DataParallel)) else model
|
1739 | Train/png/1739.png | def meta_get(self, key, metafield, default=None):
return self._meta.get(key, {}).get(metafield, default)
|
4806 | Train/png/4806.png | def supported_operations(self):
return tuple(op for op in backend.DIR_OPS if self._dir_ops & op)
|
9437 | Train/png/9437.png | def crs(self): # type: () -> CRS
if self._crs is None:
self._populate_from_rasterio_object(read_image=False)
return self._crs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.