common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
5009
|
Train/png/5009.png
|
def Lookup(self, x):
return self._Bisect(x, self.xs, self.ys)
|
722
|
Train/png/722.png
|
def set_title(self, name):
self._set_attr(TIT2(encoding=3, text=name.decode('utf-8')))
|
3766
|
Train/png/3766.png
|
def cancel(self):
if (not self.cancelled) and (self._fn is not None):
self._cancelled = True
self._drop_fn()
|
3966
|
Train/png/3966.png
|
def imp_print(self, text, end):
sys.stdout.write((text + end).encode("utf-8"))
|
5046
|
Train/png/5046.png
|
def write(self, fptr):
fptr.write(struct.pack('>I4s', 12, b'jP '))
fptr.write(struct.pack('>BBBB', *self.signature))
|
521
|
Train/png/521.png
|
def add_atom(self, key, atom):
self.graph.add_node(key, atom=atom)
|
1818
|
Train/png/1818.png
|
def getZoom(self, resolution):
"Return the zoom level for a given resolution"
assert resolution in self.RESOLUTIONS
return self.RESOLUTIONS.index(resolution)
|
4168
|
Train/png/4168.png
|
def update_subnet(self, subnet, body=None):
return self.put(self.subnet_path % (subnet), body=body)
|
4535
|
Train/png/4535.png
|
def _glob_pjoin(*parts):
if parts[0] in ('.', ''):
parts = parts[1:]
return pjoin(*parts).replace(os.sep, '/')
|
7157
|
Train/png/7157.png
|
def setPoint(self, targetTemp):
self.targetTemp = targetTemp
self.Integrator = 0
self.Derivator = 0
|
6691
|
Train/png/6691.png
|
def main():
import sys
from bokeh.command.bootstrap import main as _main
# Main entry point (see setup.py)
_main(sys.argv)
|
9872
|
Train/png/9872.png
|
def get_user_id(self):
'Returns "id" of a OneDrive user.'
if self._user_id is None:
self._user_id = self.get_user_data()['id']
return self._user_id
|
3564
|
Train/png/3564.png
|
def _is_in_restart(self, x, y):
x1, y1, x2, y2 = self._new_game
return x1 <= x < x2 and y1 <= y < y2
|
4314
|
Train/png/4314.png
|
def postgres(command):
show = not command.startswith("psql")
return sudo(command, show=show, user="postgres")
|
477
|
Train/png/477.png
|
def append(self, item: TransItem):
self.data[item.key].append(item)
|
1897
|
Train/png/1897.png
|
def update_energy(self, bypass_check=False):
for outlet in self.outlets:
outlet.update_energy(bypass_check)
|
9750
|
Train/png/9750.png
|
def close(self):
_LOGGER.debug("Closing...")
self.closed = True
if self.connected:
self._writer.close()
|
3900
|
Train/png/3900.png
|
def transition_to_execute(self):
assert self.state in [AQStateMachineStates.add]
self.state = AQStateMachineStates.execute
|
6589
|
Train/png/6589.png
|
def check_keypoints(keypoints, rows, cols):
for kp in keypoints:
check_keypoint(kp, rows, cols)
|
7053
|
Train/png/7053.png
|
def inSignJoy(self):
return props.object.signJoy[self.obj.id] == self.obj.sign
|
2394
|
Train/png/2394.png
|
def get_time(self, idx=0):
thetime = super(SingleData, self).get_time(idx=0)
return thetime
|
5115
|
Train/png/5115.png
|
def digit(m: Union[int, pd.Series], n: int) -> Union[int, pd.Series]:
return (m // (10 ** n)) % 10
|
2947
|
Train/png/2947.png
|
def retrieve(self):
response = self.request(E.retrieveResellerRequest())
return Reseller(response.data)
|
4070
|
Train/png/4070.png
|
def element(self, name, attrs=None):
self.open(name, attrs)
yield
self.close()
|
3976
|
Train/png/3976.png
|
def bling(self, target, sender):
"will print yo"
if target.startswith("#"):
self.message(target, "%s: yo" % sender)
else:
self.message(sender, "yo")
|
8077
|
Train/png/8077.png
|
def send_action(action, params=None):
data = {"msg_type": "action", "action": action}
if params is not None:
data['params'] = params
_comm.send(data)
|
36
|
Train/png/36.png
|
def save_excel(self, fd):
from pylon.io.excel import ExcelWriter
ExcelWriter(self).write(fd)
|
9296
|
Train/png/9296.png
|
def pop(self):
char = self.code[self.index]
self.index += 1
return char
|
1590
|
Train/png/1590.png
|
def raise_figure_window(f=0):
if _fun.is_a_number(f):
f = _pylab.figure(f)
f.canvas.manager.window.raise_()
|
137
|
Train/png/137.png
|
def start(builtins=False, profile_threads=True):
if profile_threads:
threading.setprofile(_callback)
_yappi.start(builtins, profile_threads)
|
6185
|
Train/png/6185.png
|
def update_context(self, ctx):
assert isinstance(ctx, dict)
ctx[str(self.context_id)] = self.value
|
312
|
Train/png/312.png
|
def cache_set(self, to_cache):
self.cache.set(self.cache_key, to_cache, self.expire_time)
|
5524
|
Train/png/5524.png
|
def DeleteJob(self, job_id, token=None):
job_urn = self.CRON_JOBS_PATH.Add(job_id)
aff4.FACTORY.Delete(job_urn, token=token)
|
9205
|
Train/png/9205.png
|
def poster(self):
user_model = get_user_model()
return get_object_or_404(user_model, pk=self.kwargs[self.user_pk_url_kwarg])
|
117
|
Train/png/117.png
|
def get_action_cache_key(name, argument):
tokens = [str(name)]
if argument:
tokens.append(str(argument))
return '::'.join(tokens)
|
2127
|
Train/png/2127.png
|
def interpolate_sysenv(line, defaults={}):
map = ChainMap(os.environ, defaults)
return line.format(**map)
|
6179
|
Train/png/6179.png
|
def request(self, name, *args, **kwargs):
return self._session.request(name, self, *args, **kwargs)
|
9583
|
Train/png/9583.png
|
def put(self, robj, w=None, dw=None, pw=None, return_body=None,
if_none_match=None, timeout=None):
raise NotImplementedError
|
2849
|
Train/png/2849.png
|
def async_get_device(self, uid, fields='*'):
return (yield from self._get('/pods/{}'.format(uid),
fields=fields))
|
2715
|
Train/png/2715.png
|
def _init_stub(self, stub_init, **stub_kwargs):
getattr(self.testbed, stub_init, lambda **kwargs: None)(**stub_kwargs)
|
2753
|
Train/png/2753.png
|
def remove(cls, id):
api = Client.instance().api
api.index(id).delete()
|
1452
|
Train/png/1452.png
|
def payments(self):
payments = self.client.subscription_payments.on(self).list()
return payments
|
5119
|
Train/png/5119.png
|
def _condense(self, data):
if data:
return reduce(operator.ior, data.values())
return set()
|
1067
|
Train/png/1067.png
|
def file_length(in_file):
fid = open(in_file)
data = fid.readlines()
fid.close()
return len(data)
|
2787
|
Train/png/2787.png
|
def _handle_actionif(self, _):
obj = _make_object("ActionIf")
obj.BranchOffset = unpack_si16(self._src)
yield obj
|
6593
|
Train/png/6593.png
|
def write_ping(self, data: bytes) -> None:
assert isinstance(data, bytes)
self._write_frame(True, 0x9, data)
|
4208
|
Train/png/4208.png
|
def update_rbac_policy(self, rbac_policy_id, body=None):
return self.put(self.rbac_policy_path % rbac_policy_id, body=body)
|
1494
|
Train/png/1494.png
|
def _process_meta(self, response):
for key in self.META_ENVELOPES:
self.meta[key] = response.get(key)
|
467
|
Train/png/467.png
|
def update(self, other):
assert self.locus == other.locus
self.elements.update(other.elements)
|
5478
|
Train/png/5478.png
|
def send_env_text(self, text, episode_id):
reactor.callFromThread(self._send_env_text, text, episode_id)
|
3260
|
Train/png/3260.png
|
def set_title(self, msg):
self.s.move(0, 0)
self.overwrite_line(msg, curses.A_REVERSE)
|
6404
|
Train/png/6404.png
|
def join_paths(fnames: FilePathList, path: PathOrStr = '.') -> Collection[Path]:
"Join `path` to every file name in `fnames`."
path = Path(path)
return [join_path(o, path) for o in fnames]
|
3460
|
Train/png/3460.png
|
def set_gene_name(self, name):
self._options = self._options._replace(gene_name=name)
|
6737
|
Train/png/6737.png
|
def url_combo_activated(self, valid):
text = to_text_string(self.url_combo.currentText())
self.go_to(self.text_to_url(text))
|
9579
|
Train/png/9579.png
|
def getDate(self):
"returns the GMT response datetime or None"
date = self.headers.get('date')
if date:
date = self.convertTimeString(date)
return date
|
59
|
Train/png/59.png
|
def get_data(self):
"Get the data for this blob"
array = ctypes.POINTER(ctypes.c_char * len(self))
return ctypes.cast(self.data, array).contents.raw
|
5775
|
Train/png/5775.png
|
def used(self, fieldname):
if fieldname in self.unused:
self.unused.remove(fieldname)
|
1224
|
Train/png/1224.png
|
def at_match(self, match, predicate=None, index=None):
return self.at_span(match.span, predicate, index)
|
9064
|
Train/png/9064.png
|
def get_labels(cs):
records = []
for c in cs:
records.extend(c.get('labels', []))
return records
|
8456
|
Train/png/8456.png
|
def plot_target(target, ax):
ax.scatter(target[0], target[1], target[2], c="red", s=80)
|
6197
|
Train/png/6197.png
|
def filesize(self):
if self.kind == 'data':
return len(self._data.data)
return self._data.filesize
|
7186
|
Train/png/7186.png
|
def iddofobject(data, commdct, key):
dtls = data.dtls
i = dtls.index(key)
return commdct[i]
|
6279
|
Train/png/6279.png
|
def _call(self, x):
return sum(fi(xi) for xi, fi in zip(x, self.functionals))
|
2932
|
Train/png/2932.png
|
def msg_(self, label, *msg):
txt = self._unpack_msg(*msg)
return "[" + label + "] " + txt
|
9985
|
Train/png/9985.png
|
def save(self):
with open(self.path, 'w') as f:
f.write(yaml.dump(dict(self.d)))
|
769
|
Train/png/769.png
|
def draw(graph, fname):
ag = networkx.nx_agraph.to_agraph(graph)
ag.draw(fname, prog='dot')
|
9111
|
Train/png/9111.png
|
def _set(self, value):
super(AttachmentsField, self)._set(value)
self._cursor = None
|
9239
|
Train/png/9239.png
|
def on_binop(self, node): # ('left', 'op', 'right')
return op2func(node.op)(self.run(node.left),
self.run(node.right))
|
7215
|
Train/png/7215.png
|
def custom_conf(self, conf):
if conf:
for (key, val) in conf.items():
self.__conf[key] = val
return self
|
8218
|
Train/png/8218.png
|
def relpath(self, path):
return os.path.relpath(path, start=self.path)
|
2819
|
Train/png/2819.png
|
def run(host=DEFAULT_HOST, port=DEFAULT_PORT, path='.'):
path = abspath(path)
c = Clay(path)
c.run(host=host, port=port)
|
1216
|
Train/png/1216.png
|
def get_previous(self):
return BillingCycle.objects.filter(date_range__lt=self.date_range).order_by('date_range').last()
|
6100
|
Train/png/6100.png
|
def step1c(self):
if self.ends(['y']) and self.vowel_in_stem():
self.b[self.k] = 'i'
|
3590
|
Train/png/3590.png
|
def add_consumer(self, ip):
Consumer.objects.get_or_create(key=self, ip=ip)
|
654
|
Train/png/654.png
|
def disable_backup(self):
for dumper in list(self.dumpers.values()):
dumper.set_backup(False)
|
984
|
Train/png/984.png
|
def detokenize(s):
print(s)
s = re.sub("\s+([;:,\.\?!])", "\\1", s)
s = re.sub("\s+(n't)", "\\1", s)
return s
|
8789
|
Train/png/8789.png
|
def result(self):
return {k: torch.stack(v) for k, v in self.accumulants.items()}
|
5353
|
Train/png/5353.png
|
def fromTFExample(bytestr):
example = tf.train.Example()
example.ParseFromString(bytestr)
return example
|
6507
|
Train/png/6507.png
|
def update_metric(self, metric, labels, pre_sliced=False):
self.curr_execgrp.update_metric(metric, labels, pre_sliced)
|
5438
|
Train/png/5438.png
|
def fit_transform(self, input, **fit_kwargs):
self.fit(input, **fit_kwargs)
X = self.transform(input)
return X
|
4446
|
Train/png/4446.png
|
def index(self, value, start=None, stop=None):
return self.__alias__.index(value, start, stop)
|
5048
|
Train/png/5048.png
|
def image_destroy(image):
OPENJPEG.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)]
OPENJPEG.opj_image_destroy(image)
|
4156
|
Train/png/4156.png
|
def close(self, commit=True):
self.data_access.close(commit=commit)
return self
|
9772
|
Train/png/9772.png
|
def fetch_data(self):
for t in [HOURLY, DAILY, MONTHLY, YEARLY]:
self._data[t] = self.get_data_per_period(t)
|
6563
|
Train/png/6563.png
|
def temporary_assignment(obj, attr, value):
original = getattr(obj, attr, None)
setattr(obj, attr, value)
yield
setattr(obj, attr, original)
|
5406
|
Train/png/5406.png
|
def _iter_grouped(self):
for indices in self._group_indices:
yield self._obj.isel(**{self._group_dim: indices})
|
8525
|
Train/png/8525.png
|
def idfn(fixture_params: Iterable[Any]) -> str:
return ":".join((str(item) for item in fixture_params))
|
5760
|
Train/png/5760.png
|
def _add_line_segment(self, x, y):
self._drawing_operations.append(_LineSegment.new(self, x, y))
|
6717
|
Train/png/6717.png
|
def tabify_plugins(self, first, second):
self.tabifyDockWidget(first.dockwidget, second.dockwidget)
|
7240
|
Train/png/7240.png
|
def move_backward(self):
self.at(ardrone.at.pcmd, True, 0, self.speed, 0, 0)
|
6518
|
Train/png/6518.png
|
def custom_grad(self, op, *grads):
return op_handlers[op.type](self, op, *grads)
|
1189
|
Train/png/1189.png
|
def _unpack(struct, bc, offset=0):
return struct.unpack_from(bc, offset), offset + struct.size
|
2739
|
Train/png/2739.png
|
def stop_times(self):
stop_times = set()
for trip in self.trips():
stop_times |= trip.stop_times()
return stop_times
|
3113
|
Train/png/3113.png
|
def send(self, *args):
for frame in args:
self.sock.sendall(self.apply_send_hooks(frame, False).pack())
|
9094
|
Train/png/9094.png
|
def value(self):
return self._sum / tf.cast(self._count, self._dtype)
|
4142
|
Train/png/4142.png
|
def _match_space_at_line(line):
regex = re.compile(r"^{0}$".format(_MDL_COMMENT))
return regex.match(line)
|
3700
|
Train/png/3700.png
|
def length(self):
return sum([shot.length for shot in self.shots if not shot.is_splay])
|
2798
|
Train/png/2798.png
|
def shuffle(self, random=None):
random_.shuffle(self._list, random=random)
for i, elem in enumerate(self._list):
self._dict[elem] = i
|
532
|
Train/png/532.png
|
def resolved_task(cls, task):
for t in cls.tasks:
if t is task or t.execute is task:
return t
|
8812
|
Train/png/8812.png
|
def visit_Str(self, node):
self.result[node] = self.builder.NamedType(pytype_to_ctype(str))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.