common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
2121 | Train/png/2121.png | def delete(self, *args, **kwargs):
super(UpdateCountsMixin, self).delete(*args, **kwargs)
self.update_count()
|
4180 | Train/png/4180.png | def update_ikepolicy(self, ikepolicy, body=None):
return self.put(self.ikepolicy_path % (ikepolicy), body=body)
|
459 | Train/png/459.png | def restart(uuid, **kwargs):
from .worker_engine import restart_worker
return text_type(restart_worker(uuid, **kwargs).uuid)
|
6796 | Train/png/6796.png | def all_keys(self):
keys = self.list_keys()
keys.update(self.local_keys())
return keys
|
318 | Train/png/318.png | def row_iter(self):
for k in utils.range_(self.side):
yield self.row(k)
|
2981 | Train/png/2981.png | def rev(self, rev):
d = self.dict
d['revision'] = rev
return self.from_dict(d)
|
3012 | Train/png/3012.png | def call_interval(freq, **kwargs):
def wrapper(f):
return CallInterval(f, freq, **kwargs)
return wrapper
|
3120 | Train/png/3120.png | def create_transition(oracle, method='trn'):
mat, hist, n = _create_trn_mat_symbolic(oracle, method)
return mat, hist, n
|
5109 | Train/png/5109.png | def flatMap(f: Callable, xs: Iterable) -> List:
return flatten(lmap(f, xs))
|
2687 | Train/png/2687.png | def marvcli_user_list():
app = create_app()
for name in db.session.query(User.name).order_by(User.name):
click.echo(name[0])
|
4357 | Train/png/4357.png | def longest_service_name(self):
return max([len(service_handle.service.name) for service_handle in self.service_handles] + [0])
|
2496 | Train/png/2496.png | def max_knob_end_distance(self):
return max([distance(self.knob_end, h) for h in self.hole])
|
286 | Train/png/286.png | def repo(name: str, owner: str) -> snug.Query[dict]:
return json.loads((yield f'/repos/{owner}/{name}').content)
|
9278 | Train/png/9278.png | def dump(cls, message):
if cls.verbose > 2:
msg = '[DUMP] %s' % message
cls.echo(msg)
|
9900 | Train/png/9900.png | def uniqify(cls, seq):
seen = set()
seen_add = seen.add
return [x for x in seq if x not in seen and not seen_add(x)]
|
3918 | Train/png/3918.png | def add_str(window, line_num, str):
try:
window.addstr(line_num, 0, str)
except curses.error:
pass
|
252 | Train/png/252.png | def copy(self):
return Limit(self.scan_limit, self.item_limit, self.min_scan_limit,
self.strict, self.filter)
|
4419 | Train/png/4419.png | def flatten_dict(self, obj):
return OrderedDict(zip(self.fieldnames, self.flatten(obj)))
|
7328 | Train/png/7328.png | def ldGet(self, what, key):
if isListKey(key):
return what[listKeyIndex(key)]
else:
return what[key]
|
10055 | Train/png/10055.png | def reset_(self):
for opt, meta in self.defaults_():
self[opt] = meta.default
|
6180 | Train/png/6180.png | def send(self, msg):
debug('sent %s', msg)
self.loop.send(self._packer.pack(msg))
|
2488 | Train/png/2488.png | def error_handler(_, err, arg):
arg.value = err.error
return libnl.handlers.NL_STOP
|
3371 | Train/png/3371.png | def is_cached(file_name):
gml_file_path = join(join(expanduser('~'), OCTOGRID_DIRECTORY), file_name)
return isfile(gml_file_path)
|
8323 | Train/png/8323.png | def window_size(self, window_size):
BasePlotter.window_size.fset(self, window_size)
self.app_window.setBaseSize(*window_size)
|
7432 | Train/png/7432.png | def solve_tuple(expr, vars):
result = tuple(solve(x, vars).value for x in expr.children)
return Result(result, ())
|
8018 | Train/png/8018.png | def sequential_id(k, identifier):
key = _key(k)
return int(monotonic_zadd(keys=[key], args=[identifier]))
|
7295 | Train/png/7295.png | def add(self, k, count=1):
self.counts[k] += count
self.total += count
|
7064 | Train/png/7064.png | def toList(self):
date = self.date()
sign = '+' if date[0] >= 0 else '-'
date[0] = abs(date[0])
return list(sign) + date
|
5579 | Train/png/5579.png | def zoom(self, factor):
camera = self.ren.GetActiveCamera()
camera.Zoom(factor)
self.ren_win.Render()
|
4701 | Train/png/4701.png | def orthogonal_vector(v):
if v[1] != 0 or v[2] != 0:
c = (1, 0, 0)
else:
c = (0, 1, 0)
return np.cross(v, c)
|
1451 | Train/png/1451.png | def user_agent(self):
components = ["/".join(x) for x in self.user_agent_components.items()]
return " ".join(components)
|
8549 | Train/png/8549.png | def add_stmt(stmt, arg_rules):
(arg, rules) = arg_rules
stmt_map[stmt] = (arg, rules)
|
8852 | Train/png/8852.png | def _publish(self, obj):
bin_obj = umsgpack.packb(obj)
self.pub.send(bin_obj)
|
4002 | Train/png/4002.png | def _join_types(seq, last_separator=''):
class_names = [_format_type(cls) for cls in seq]
return _join_sequence(class_names, last_separator)
|
488 | Train/png/488.png | def strip_linebreaks(s):
return u"\n".join([c for c in s.split(u'\n') if c])
|
9476 | Train/png/9476.png | def get_outputs_from_cm(index, cm):
return tuple(i for i in range(cm.shape[0]) if cm[index][i])
|
370 | Train/png/370.png | def find(self, *args, **kwargs):
" new query builder on current db"
return Query(*args, db=self, schema=self.schema)
|
5379 | Train/png/5379.png | def data_raw(self):
return self._client.send(data=sc_pb.RequestData(
ability_id=True, unit_type_id=True))
|
4995 | Train/png/4995.png | def image_url(self):
return construct_api_url(self.input, 'image', self.resolvers, False, self.get3d, False, **self.kwargs)
|
5446 | Train/png/5446.png | def index():
posts = Post.query.order_by(Post.created.desc()).all()
return render_template("blog/index.html", posts=posts)
|
9254 | Train/png/9254.png | def flush(self):
self.notify(tuple(self._queue))
self._queue.clear()
|
8710 | Train/png/8710.png | def find_var_end(self, text):
return self.find_end(text, self.start_var_token, self.end_var_token)
|
3547 | Train/png/3547.png | def add(self, name: str, pattern: str) -> None:
self.patterns[name] = URITemplate(
pattern, converters=self.converters)
|
7172 | Train/png/7172.png | def delete(self):
if self.isfile:
os.remove(self.fn)
elif self.isdir:
shutil.rmtree(self.fn)
|
10013 | Train/png/10013.png | def last(self) -> Signature:
k = sorted(self._hsig.keys())
return self._hsig[k[-1]]
|
4781 | Train/png/4781.png | def nest2ring(nside, ipix):
ipix = np.atleast_1d(ipix).astype(np.int64, copy=False)
return nested_to_ring(ipix, nside)
|
9334 | Train/png/9334.png | def empty(rq, ctx, all, queues):
"Empty given queues."
return ctx.invoke(
rq_cli.empty,
all=all,
queues=queues or rq.queues,
**shared_options(rq)
)
|
8360 | Train/png/8360.png | def Angle(self, other):
return math.atan2(self.CrossProd(other).Norm2(),
self.DotProd(other))
|
5920 | Train/png/5920.png | def reset(self):
self._x = self._start_x
self._y = self._start_y
|
8071 | Train/png/8071.png | def _set_country(self, c):
self.location.countrycode = c.split()[0].split('=')[1].strip().upper()
|
8849 | Train/png/8849.png | def no_imls(self):
return all(numpy.isnan(ls).any() for ls in self.imtls.values())
|
3105 | Train/png/3105.png | def enable():
Benchmark.enable = True
ComparisonBenchmark.enable = True
BenchmarkedFunction.enable = True
BenchmarkedClass.enable = True
|
6221 | Train/png/6221.png | def _is_subspan(self, m, span):
return m.figure.document.id == span[0] and m.figure.position == span[1]
|
6567 | Train/png/6567.png | def update(self, n=1):
with self._lock:
self._pbar.update(n)
self.refresh()
|
3019 | Train/png/3019.png | def is_closed(self):
return (self.state == SESSION_STATE.CLOSED
or self.state == SESSION_STATE.CLOSING)
|
7118 | Train/png/7118.png | def perimeter(self):
return sum([a.distance(b) for a, b in self.pairs()])
|
2482 | Train/png/2482.png | def reserved(self, value):
self.bytearray[self._get_slicers(2)] = bytearray(c_uint16(value or 0))
|
641 | Train/png/641.png | def fourier(x, N):
term = 0.
for n in range(1, N, 2):
term += (1. / n) * math.sin(n * math.pi * x / L)
return (4. / (math.pi)) * term
|
9333 | Train/png/9333.png | def get_views(self):
url = self.__url + 'views'
return self.session.get(url).json()
|
1376 | Train/png/1376.png | def cons(self, element: Any) -> 'List':
tail = self._get_value()
return List(lambda sel: sel(element, tail))
|
9588 | Train/png/9588.png | def e(message, exit_code=None):
print_log(message, YELLOW, BOLD)
if exit_code is not None:
sys.exit(exit_code)
|
5259 | Train/png/5259.png | def service_list():
r = salt.utils.http.query(
DETAILS['url']+'service/list', decode_type='json', decode=True)
return r['dict']
|
6359 | Train/png/6359.png | def is_full_slice(obj, l):
return (isinstance(obj, slice) and obj.start == 0 and obj.stop == l and
obj.step is None)
|
8698 | Train/png/8698.png | def setup_logfile_raw(self, logfile, mode='w'):
self.logfile_raw = open(logfile, mode=mode)
|
85 | Train/png/85.png | def load_image(fname):
with open(fname, "rb") as f:
i = Image.open(fname)
# i.load()
return i
|
1769 | Train/png/1769.png | def remove(self, resource):
if isinstance(resource, Resource):
self._resources.remove(resource)
|
5792 | Train/png/5792.png | def clear(self):
if len(self.list):
self._LOG.debug("List cleared.")
self.list.clear()
|
3468 | Train/png/3468.png | def tabText(self, tab):
if not isinstance(tab, int):
tab = self.indexOf(tab)
return super(FwTabWidget, self).tabText(tab)
|
7515 | Train/png/7515.png | def to_jd(baktun, katun, tun, uinal, kin):
return EPOCH + (baktun * 144000) + (katun * 7200) + (tun * 360) + (uinal * 20) + kin
|
8839 | Train/png/8839.png | def get_distance_coefficients(self, C, imt):
c3 = self.c3[imt]["c3"] if self.c3 else C["c3"]
return c3
|
8444 | Train/png/8444.png | def random_terms(self):
return {k: v for (k, v) in self.terms.items() if v.random}
|
7655 | Train/png/7655.png | def infix_handle(tokens):
func, args = get_infix_items(tokens, callback=infix_handle)
return "(" + func + ")(" + ", ".join(args) + ")"
|
4109 | Train/png/4109.png | def get_scaled(self, magnitude):
result = self.copy()
result.scale(magnitude)
return result
|
8569 | Train/png/8569.png | def get_easter_saturday(self, year):
"Return the Easter Saturday date"
sunday = self.get_easter_sunday(year)
return sunday - timedelta(days=1)
|
1456 | Train/png/1456.png | def checkMultipleFiles(input):
f, i, o, a = buildFileList(input)
return len(f) > 1
|
6870 | Train/png/6870.png | def _format(self, _, result):
return self._fmt.format(six.text_type(result))
|
6652 | Train/png/6652.png | def namePop(ctxt):
if ctxt is None:
ctxt__o = None
else:
ctxt__o = ctxt._o
ret = libxml2mod.namePop(ctxt__o)
return ret
|
4979 | Train/png/4979.png | def subscribe(self, client):
self.clients.append(client)
log("Subscribed client {} to channel {}".format(client, self.name))
|
1 | Train/png/1.png | def find_best_rsquared(list_of_fits):
res = sorted(list_of_fits, key=lambda x: x.rsquared)
return res[-1]
|
371 | Train/png/371.png | def fetch(self):
if not self.local_path:
self.make_local_path()
fetcher = BookFetcher(self)
fetcher.fetch()
|
1215 | Train/png/1215.png | def get_next(self):
return BillingCycle.objects.filter(date_range__gt=self.date_range).order_by('date_range').first()
|
9786 | Train/png/9786.png | def send(r, stream=False):
r.send(stream=stream)
return r.response
|
495 | Train/png/495.png | def n2l(c, l):
"network to host long"
l = U32(c[0] << 24)
l = l | (U32(c[1]) << 16)
l = l | (U32(c[2]) << 8)
l = l | (U32(c[3]))
return l
|
1434 | Train/png/1434.png | def delete(self):
if lib.EnvDeleteRouter(self._env, self._name.encode()) == 0:
raise RuntimeError("Unable to delete router %s" % self._name)
|
6017 | Train/png/6017.png | def teardown_socket(s):
try:
s.shutdown(socket.SHUT_WR)
except socket.error:
pass
finally:
s.close()
|
2080 | Train/png/2080.png | def list_vms(self, preset_name):
return list(vm for vm in self._vms.values() if vm.name == preset_name)
|
7865 | Train/png/7865.png | def sdiff(self, keys, *args):
"Return the difference of sets specified by ``keys``"
args = list_or_args(keys, args)
return await self.execute_command('SDIFF', *args)
|
4306 | Train/png/4306.png | def revision(self, message):
alembic.command.revision(self.alembic_config(), message=message)
|
1915 | Train/png/1915.png | def expect(self):
exp = Expectation(self)
self._expectations.append(exp)
return exp
|
9134 | Train/png/9134.png | def pan(self, value):
assert len(value) == 2
self._pan[:] = value
self._constrain_pan()
self.update()
|
3608 | Train/png/3608.png | def infoObject(object, cat, format, *args):
doLog(INFO, object, cat, format, args)
|
3307 | Train/png/3307.png | def superdict(arg=()):
def update(obj, arg):
return obj.update(arg) or obj
return update(defaultdict(superdict), arg)
|
3860 | Train/png/3860.png | def dot(self, vec):
return self.x * vec.x + self.y * vec.y
|
4226 | Train/png/4226.png | def pull_repo(repo_name):
repo = ClonedRepo.objects.get(pk=repo_name)
repo.pull()
|
337 | Train/png/337.png | def write(self):
with open(self.me, 'w') as f:
f.write(self.printMe(self.tag, self.value))
|
3896 | Train/png/3896.png | def stop(self):
self.elapse = time.clock() - self.st
self.records.append(self.elapse)
|
1634 | Train/png/1634.png | def open(self, name, *mode):
return self.file_factory(self.file_path(name), *mode)
|
674 | Train/png/674.png | def key(**kwargs):
output, err = cli_syncthing_adapter.key(device=True)
click.echo("%s" % output, err=err)
|
6318 | Train/png/6318.png | def scan(self):
self._logger.info("iface '%s' scans", self.name())
self._wifi_ctrl.scan(self._raw_obj)
|
6132 | Train/png/6132.png | def add_child(self, node, callback):
if node not in self.children:
self.children.append(ChildNode(node, callback))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.