common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
6503 | Train/png/6503.png | def generate_doxygen(app):
_run_cmd("cd %s/.. && make doxygen" % app.builder.srcdir)
_run_cmd("cp -rf doxygen/html %s/doxygen" % app.builder.outdir)
|
2295 | Train/png/2295.png | def delete_nic(self, instance_id, port_id):
self.client.servers.interface_detach(instance_id, port_id)
return True
|
7792 | Train/png/7792.png | def unlink(self, req, parent, name):
self.reply_err(req, errno.EROFS)
|
2065 | Train/png/2065.png | def generate_checker(value):
@property
@wraps(can_be_)
def checker(self):
return self.can_be_(value)
return checker
|
115 | Train/png/115.png | def clone(self):
from copy import copy
clone = copy(self)
clone.expr = copy(self.expr)
clone.factory = False
return clone
|
7572 | Train/png/7572.png | def add(self, name, desc, func=None, args=None, krgs=None):
self.entries.append(MenuEntry(name, desc, func, args or [], krgs or {}))
|
301 | Train/png/301.png | def lookup(self, value):
for k, v in self.iteritems():
if value == v:
return k
return None
|
1309 | Train/png/1309.png | def scroll_deck(self, decknum, scroll_x, scroll_y):
self.scroll_deck_x(decknum, scroll_x)
self.scroll_deck_y(decknum, scroll_y)
|
2963 | Train/png/2963.png | def as_detail(cls, protocol=Protocol.http, *args, **kwargs):
return cls.as_view('detail', protocol, *args, **kwargs)
|
3436 | Train/png/3436.png | def title(self):
if self._title is None:
self._title = self.get_title()
return self._title
|
1162 | Train/png/1162.png | def _list_model(self, model_cls: Type[X]) -> List[X]:
return self.session.query(model_cls).all()
|
7411 | Train/png/7411.png | def cv_residuals(self, cv=True):
vals = self.cv_values(cv)
return (self.y - vals) / self.dy
|
9965 | Train/png/9965.png | def stats_totals(self, kind='R', summary=False):
return self._get_stats_table('totals', kind=kind, summary=summary)
|
8270 | Train/png/8270.png | def flag_values_dict(self):
return {name: flag.value for name, flag in six.iteritems(self._flags())}
|
5663 | Train/png/5663.png | def ij_jlk_to_ilk(A, B):
return A.dot(B.reshape(B.shape[0], -1)).reshape(A.shape[0], B.shape[1], B.shape[2])
|
8462 | Train/png/8462.png | def _choice_from(self, key: str) -> str:
data = self._data[key]
return self.random.choice(data)
|
7256 | Train/png/7256.png | def write_byte(self, byte):
self.payload[self.pos] = byte
self.pos = self.pos + 1
|
5560 | Train/png/5560.png | def append_checksum(self, f, checksum):
align_file_position(f, 16)
f.write(struct.pack(b'B', checksum))
|
6056 | Train/png/6056.png | def _count_elements(mapping, iterable):
'Tally elements from the iterable.'
mapping_get = mapping.get
for elem in iterable:
mapping[elem] = mapping_get(elem, 0) + 1
|
3874 | Train/png/3874.png | def listen_for_updates(self):
self.toredis.subscribe(self.group_pubsub, callback=self.callback)
|
4054 | Train/png/4054.png | def w(msg, *args, **kwargs):
return logging.log(WARN, msg, *args, **kwargs)
|
8268 | Train/png/8268.png | def reset(self):
self.v = self.c
self.u = self.b * self.v
self.fired = 0.0
self.current = self.bias
|
954 | Train/png/954.png | def count_all(self):
return sum(x.func.count_all() if x.is_subchain else 1 for x in self)
|
10037 | Train/png/10037.png | def delete(self):
CProfileWrapper.profiler.disable()
self.running = False
self.set_status(204)
self.finish()
|
9235 | Train/png/9235.png | def start(self):
while not self.is_start(self.current_tag):
self.next()
self.new_entry()
|
3788 | Train/png/3788.png | def make_symmetric(dict):
for key, value in list(dict.items()):
dict[value] = key
return dict
|
6136 | Train/png/6136.png | def value_to_string(self, obj):
value = self.value_from_object(obj)
return self.get_prep_value(value)
|
5396 | Train/png/5396.png | def find_view_menu(self, name):
return self.get_session.query(self.viewmenu_model).filter_by(name=name).first()
|
5028 | Train/png/5028.png | def from_hex(cls, hexval: str) -> 'ColorCode':
c = cls()
c._init_hex(hexval)
return c
|
7804 | Train/png/7804.png | def remove(self, item):
'Remove first occurence of item. Raise ValueError if not found'
i = self.index(item)
del self._keys[i]
del self._items[i]
|
9338 | Train/png/9338.png | def post_process(self):
self.image.putdata(self.pixels)
self.image = self.image.transpose(Image.ROTATE_90)
|
4516 | Train/png/4516.png | def _selectItem(self, index):
self._selectedIndex = index
self.setCurrentIndex(self.model().createIndex(index, 0))
|
3755 | Train/png/3755.png | def prepare(doc):
doc.caption_found = False
doc.plot_found = False
doc.listings_counter = 0
|
2904 | Train/png/2904.png | def update(self, milliseconds):
self.__sort_up()
for obj in self.__up_objects:
obj.update(milliseconds)
|
7430 | Train/png/7430.png | def buffer(self, *args, **kwargs):
self.check_session()
result = self.session.buffer(*args, **kwargs)
return result
|
2392 | Train/png/2392.png | def pop(self):
node = self.nodes.pop()
self.__keys.remove(node.key)
|
10050 | Train/png/10050.png | def driver(self):
if self._driver is None:
self._driver = ImageDriver(self.ds.GetDriver())
return self._driver
|
4426 | Train/png/4426.png | def hexists(self, hashkey, attribute):
redis_hash = self._get_hash(hashkey, 'HEXISTS')
return self._encode(attribute) in redis_hash
|
9830 | Train/png/9830.png | def parse_omim_line(line, header):
omim_info = dict(zip(header, line.split('\t')))
return omim_info
|
8074 | Train/png/8074.png | def unpause(self):
self._pause_level -= 1
if not self._pause_level:
self._offset = self._paused_time - self._clock()
|
3272 | Train/png/3272.png | def get_numbers(s):
result = map(int, re.findall(r'[0-9]+', unicode(s)))
return result + [1] * (2 - len(result))
|
6601 | Train/png/6601.png | def get_n_r(self):
return math.floor(self.n / self.eta**self.i + _epsilon), math.floor(self.r * self.eta**self.i + _epsilon)
|
3431 | Train/png/3431.png | def delete(self, uri):
cache_key = self._build_cache_key(uri)
self._delete(cache_key)
|
7620 | Train/png/7620.png | def chunks(data, n):
for i in range(0, len(data), n):
yield data[i:i+n]
|
5720 | Train/png/5720.png | def first_frame(obj):
"Only display the first frame of an animated plot"
plot, renderer, fmt = single_frame_plot(obj)
plot.update(0)
return {'text/html': renderer.html(plot, fmt)}
|
5705 | Train/png/5705.png | def detect(args):
for l in args.input:
if l.strip():
_print("{:<20}{}".format(Detector(l).language.name, l.strip()))
|
4797 | Train/png/4797.png | def filter_pypi(self, entry):
for package in self.packages:
if entry.title.lower().startswith(package):
return entry
|
70 | Train/png/70.png | def _handle_mac(self, keycode):
key = self._keyname(unichr(keycode))
self._output(type="keys", key=key, realkey=key)
|
3632 | Train/png/3632.png | def title(self, title, show=False):
self._write("title:%d:%s\n" % (int(show), title))
return self
|
7151 | Train/png/7151.png | def count(self):
if self._primary_keys is None:
return self.queryset.count()
else:
return len(self.pks)
|
6988 | Train/png/6988.png | def checkbox_uncheck(self, force_check=False):
if self.get_attribute('checked'):
self.click(force_click=force_check)
|
985 | Train/png/985.png | def _short_color_list(self):
return [c for c in colors.get_colors() if not re.search(r'\d', c)]
|
8739 | Train/png/8739.png | def to_dict(self):
return {"name": self.table_name, "kind": self.table_kind, "data": [r.to_dict() for r in self]}
|
2067 | Train/png/2067.png | def build_info(name, path=None, module=None):
verlist = get_version_list(path, module)
verlist[0] = name
return tuple(verlist)
|
7820 | Train/png/7820.png | def new_temp_file(directory=None, hint=''):
return tempfile.NamedTemporaryFile(
prefix='tmp-wpull-{0}-'.format(hint), suffix='.tmp', dir=directory)
|
3690 | Train/png/3690.png | def __fade_in(self):
self.__timer.stop()
self.__vector = self.__fade_speed
self.__timer.start()
|
5493 | Train/png/5493.png | def remove_prefix(self, prefix):
self._req('prefix remove %s' % prefix)
time.sleep(1)
self._req('netdataregister')
|
3744 | Train/png/3744.png | def reverse_with_query(named_url, **kwargs):
"Reverse named URL with GET query"
q = QueryDict('', mutable=True)
q.update(kwargs)
return '{}?{}'.format(reverse(named_url), q.urlencode())
|
9125 | Train/png/9125.png | def set(self, f):
self.stop()
self._create_timer(f)
self.start()
|
1753 | Train/png/1753.png | def write_file(self, name, path=None):
if path is None:
path = name
self.zf.write(path, name)
|
2528 | Train/png/2528.png | def add_jsfile_head(self, src: str) -> None:
self.head.appendChild(Script(src=src))
|
2894 | Train/png/2894.png | def auth_uri(self):
return self.oauth.auth_uri(redirect_uri=self.redirect_uri, scope=self.scope)
|
8771 | Train/png/8771.png | def OnWidget(self, event):
self.choice_dialects.SetValue(len(self.choices['dialects']) - 1)
event.Skip()
|
4372 | Train/png/4372.png | def imapchain(*a, **kwa):
imap_results = map(*a, **kwa)
return itertools.chain(*imap_results)
|
7067 | Train/png/7067.png | def getFixedStar(ID, jd):
star = swe.sweFixedStar(ID, jd)
_signInfo(star)
return star
|
4694 | Train/png/4694.png | def rgfromid(idstr):
rgidx = idstr.find('resourceGroups/')
providx = idstr.find('/providers/')
return idstr[rgidx + 15:providx]
|
7668 | Train/png/7668.png | def put_info(self, key, value):
return self.instance.put_task_info(self.name, key, value)
|
5150 | Train/png/5150.png | def _input_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
self.get_child("input")._handle_substatements(stmt, sctx)
|
8570 | Train/png/8570.png | def get_easter_monday(self, year):
"Return the date of the monday after easter"
sunday = self.get_easter_sunday(year)
return sunday + timedelta(days=1)
|
2409 | Train/png/2409.png | def add_string(self, string):
self.string += string
self.length += len(string)
self.eos = 0
|
1086 | Train/png/1086.png | def _rlfunc(rl, lz, pot):
thisvcirc = vcirc(pot, rl, use_physical=False)
return rl*thisvcirc-lz
|
3954 | Train/png/3954.png | def warning(self, message, *args, **kwargs):
self._log(logging.WARNING, message, *args, **kwargs)
|
4238 | Train/png/4238.png | def number(v):
if nodesetp(v):
v = string(v)
try:
return float(v)
except ValueError:
return float('NaN')
|
4229 | Train/png/4229.png | def within_n_mads(n, series):
mad_score = (series - series.mean()) / series.mad()
return (mad_score.abs() <= n).all()
|
9083 | Train/png/9083.png | def debugPreview(self, title="Debug"):
haystack = Image.open(self.path)
haystack.show()
|
1298 | Train/png/1298.png | def spots_at(self, x, y):
for spot in self.spot.values():
if spot.collide_point(x, y):
yield spot
|
6328 | Train/png/6328.png | def prefix(self, keys):
assert isinstance(keys, tuple)
self._prefix = keys
self._load_prefix_binding()
|
2264 | Train/png/2264.png | def hasvar(obj, var):
if hasattr(obj, var):
return not callable(getattr(obj, var))
return False
|
6713 | Train/png/6713.png | def update_menu(self):
self.menu.clear()
add_actions(self.menu, self.create_context_menu_actions())
|
7300 | Train/png/7300.png | def setdefault(obj, field, default):
setattr(obj, field, getattr(obj, field, default))
|
1248 | Train/png/1248.png | def describe_edge(self, edge):
head, tail, data = self.edges[edge]
return edge, data, head, tail
|
323 | Train/png/323.png | def visit_AsyncFunctionDef(self, node):
node = self.get_function_node(node)
if node is not None:
node._async = True
|
5278 | Train/png/5278.png | def is_client(self):
return (self.args.client or self.args.browser) and not self.args.server
|
5040 | Train/png/5040.png | def appendNullPadding(str, blocksize=AES_blocksize):
'Pad with null bytes'
pad_len = paddingLength(len(str), blocksize)
padding = '\0'*pad_len
return str + padding
|
7349 | Train/png/7349.png | def find(command, on):
output_lines = parse_man_page(command, on)
click.echo(''.join(output_lines))
|
7719 | Train/png/7719.png | def gen_undef():
empty_reg = ReilEmptyOperand()
return ReilBuilder.build(ReilMnemonic.UNDEF, empty_reg, empty_reg, empty_reg)
|
1790 | Train/png/1790.png | def delete(self, **kwargs):
url_str = self.base_url + '/%s' % kwargs['alarm_id']
resp = self.client.delete(url_str)
return resp
|
416 | Train/png/416.png | def take_percentile(arr, percent):
size = len(arr)
stop = min(int(size * percent), len(arr))
return arr[0:stop]
|
1936 | Train/png/1936.png | def get_data_store(args):
return tacl.DataStore(args.db, args.memory, args.ram)
|
1992 | Train/png/1992.png | def replace_surrogates(self, m):
high, low = ord(m.group(1)), ord(m.group(2))
return chr((high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000)
|
24 | Train/png/24.png | def _is_valid(self, log: Optional[Logger] = None) -> bool:
return self._validate(self, log)[0]
|
3341 | Train/png/3341.png | def getLinesFromLogFile(stream):
stream.flush()
stream.seek(0)
lines = stream.readlines()
return lines
|
10074 | Train/png/10074.png | def t_DOUBLEEQUAL(self, t):
r"\=\="
t.endlexpos = t.lexpos + len(t.value)
return t
|
7271 | Train/png/7271.png | def child_get(self, child, *prop_names):
return [self.child_get_property(child, name) for name in prop_names]
|
1024 | Train/png/1024.png | def expr2truthtable(expr):
inputs = [ttvar(v.names, v.indices) for v in expr.inputs]
return truthtable(inputs, expr.iter_image())
|
3816 | Train/png/3816.png | def lookup_thread_id(self):
"Lookup the thread id as path to comment file."
path = os.path.join(self.realm, self.topic + '.csv')
return path
|
6391 | Train/png/6391.png | def clip_grad(learn: Learner, clip: float = 0.1) -> Learner:
"Add gradient clipping of `clip` during training."
learn.callback_fns.append(partial(GradientClipping, clip=clip))
return learn
|
7020 | Train/png/7020.png | def _from_list_dict(cls, list_dic):
return cls({_convert_id(dic[cls.CHAMP_ID]): dict(dic) for dic in list_dic})
|
4487 | Train/png/4487.png | def ichunk(iterable, n):
it = iter(iterable)
while True:
chunk = tuple(itertools.islice(it, n))
if not chunk:
return
yield chunk
|
4700 | Train/png/4700.png | def read_ssh_config(path):
with open(path, "r") as fh_:
lines = fh_.read().splitlines()
return SshConfig(lines)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.