common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
2547 | Train/png/2547.png | def reset(self):
"Resets the values."
self.zf = zipfile.ZipFile(self.file_name, 'r')
self._doc = None
|
5694 | Train/png/5694.png | def is_collecting(self) -> bool:
return self.orders and self.orders[0].ability.id in {AbilityId.HARVEST_GATHER, AbilityId.HARVEST_RETURN}
|
3735 | Train/png/3735.png | def _makeTextWidgets(self):
self.prompt = urwid.Edit(self.promptText, multiline=False)
return [self.prompt]
|
5571 | Train/png/5571.png | def write_file(self, filename="paths.dat"):
with zopen(filename, "wt") as f:
f.write(str(self) + "\n")
|
6958 | Train/png/6958.png | def matrix(self):
result = np.identity(4, float)
result[0:3, 0:3] = self.r
return result
|
8811 | Train/png/8811.png | def visit_Yield(self, node):
self.generic_visit(node)
self.combine(self.current, node.value)
|
2503 | Train/png/2503.png | def status_bar(self):
print("")
self.msg.template(78)
print("| Repository Status")
self.msg.template(78)
|
448 | Train/png/448.png | def upi(self):
parameter = 'UPI'
if parameter not in self._by:
self._populate(by=parameter)
return self._by[parameter]
|
755 | Train/png/755.png | def setKey(self, key, value):
data = self.getDictionary()
data[key] = value
self.setDictionary(data)
|
4296 | Train/png/4296.png | def is_vowel(char):
if is_letter(char, strict=True):
return char in chart.vowels
return False
|
201 | Train/png/201.png | def restart(self):
self.initGrid()
self.win.clear()
self.current_gen = 1
self.start
|
536 | Train/png/536.png | def soap_attribute(self, name, value):
setattr(self, name, value)
self._attributes.add(name)
|
5632 | Train/png/5632.png | def configure(self, options, conf):
super(S3Logging, self).configure(options, conf)
self.options = options
|
8495 | Train/png/8495.png | def rect(self):
CheckParent(self)
val = _fitz.Annot_rect(self)
val = Rect(val)
return val
|
4631 | Train/png/4631.png | def create(gc: GroupControl, name, slaves):
click.echo("Creating group %s with slaves: %s" % (name, slaves))
click.echo(await gc.create(name, slaves))
|
9760 | Train/png/9760.png | def save_subsection(self, subsection_id):
Article.objects.filter(parent_id=self.parent.id).update(
subsection_id=subsection_id)
|
2441 | Train/png/2441.png | def visit_Str(self, node: AST, dfltChaining: bool = True) -> str:
return repr(node.s)
|
7014 | Train/png/7014.png | def delete_service(self, service_id):
content = self._fetch("/service/%s" % service_id, method="DELETE")
return self._status(content)
|
8302 | Train/png/8302.png | def Send(self, usb, timeout_ms=None):
usb.BulkWrite(self.Pack(), timeout_ms)
usb.BulkWrite(self.data, timeout_ms)
|
8118 | Train/png/8118.png | def add_task(self, func, *args, **kargs):
self.tasks.put((func, args, kargs))
|
8063 | Train/png/8063.png | def write(self):
with open(self.path, 'w') as file_:
file_.write(self.content)
|
4428 | Train/png/4428.png | def hincrby(self, hashkey, attribute, increment=1):
return self._hincrby(hashkey, attribute, 'HINCRBY', long, increment)
|
6516 | Train/png/6516.png | def train_cb(self, param):
if param.nbatch % self.frequent == 0:
self._process_batch(param, 'train')
|
5172 | Train/png/5172.png | def get_all_comments(chebi_ids):
all_comments = [get_comments(chebi_id) for chebi_id in chebi_ids]
return [x for sublist in all_comments for x in sublist]
|
4210 | Train/png/4210.png | def delete_dscp_marking_rule(self, rule, policy):
return self.delete(self.qos_dscp_marking_rule_path %
(policy, rule))
|
8398 | Train/png/8398.png | def send_up(self, count):
for i in range(count):
self.interface.send_key(Key.UP)
|
2585 | Train/png/2585.png | def _saturation(color, **kwargs):
s = colorsys.rgb_to_hls(*[x / 255.0 for x in color.value[:3]])[2]
return NumberValue((s * 100, '%'))
|
1450 | Train/png/1450.png | def create_payment(self, data):
return OrderPayments(self.client).on(self).create(data)
|
5813 | Train/png/5813.png | def get_label(self, x, w):
scores = np.dot(x, w)
return np.argmax(scores, axis=1).transpose()
|
9019 | Train/png/9019.png | def dump(data, **kwds):
if _usedefaultyamlloader:
return yaml.safe_dump(data, **kwds)
else:
return odyldo.safe_dump(data, **kwds)
|
5573 | Train/png/5573.png | def products(self):
return [self._all_comp[i] for i in range(len(self._all_comp))
if self._coeffs[i] > 0]
|
5297 | Train/png/5297.png | def lock_status(account_id, resource_id, parent_id):
return output(
Client(BASE_URL, account_id).lock_status(resource_id, parent_id))
|
677 | Train/png/677.png | def cmd(send, msg, _):
if not msg:
msg = textutils.gen_word()
send(textutils.gen_slogan(msg))
|
3038 | Train/png/3038.png | def _regexp(expr, item):
reg = re.compile(expr)
return reg.search(item) is not None
|
4616 | Train/png/4616.png | def decrypt_from(self, f, mac_bytes=10):
ctx = DecryptionContext(self.curve, f, self, mac_bytes)
yield ctx
ctx.read()
|
1113 | Train/png/1113.png | def unmount(self):
self._data = await self._handler.unmount(
system_id=self.node.system_id, id=self.id)
|
1403 | Train/png/1403.png | def _construct_regex(cls, fmt):
return re.compile(fmt.format(**vars(cls)), flags=re.U)
|
4584 | Train/png/4584.png | def datetime(anon, obj, field, val):
return anon.faker.datetime(field=field)
|
7140 | Train/png/7140.png | def roles(self):
result = AuthGroup.objects(creator=self.client).only('role')
return json.loads(result.to_json())
|
4743 | Train/png/4743.png | def pauseMovie(self):
if self.state == self.PLAYING:
self.sendRtspRequest(self.PAUSE)
|
6948 | Train/png/6948.png | def _bend_angle_low(a, b, deriv):
result = _bend_cos_low(a, b, deriv)
return _cos_to_angle(result, deriv)
|
5707 | Train/png/5707.png | def join_filter(sep, seq, pred=bool):
return sep.join([text_type(i) for i in seq if pred(i)])
|
8745 | Train/png/8745.png | def _float_generator(descriptor, bitwidth):
'Helper to create floating point values'
return gen.IterValueGenerator(descriptor.name, values.get_floats(bitwidth))
|
6942 | Train/png/6942.png | def _id(self):
return (self.__class__, self.number_of_needles, self.needle_positions,
self.left_end_needle)
|
1842 | Train/png/1842.png | def set(self, key, value):
return DatastoreLegacy.store[self.domain].set(key, value)
|
1692 | Train/png/1692.png | def error(self, msg, pos=None):
self.log(msg, 'error: ' + self.location(pos))
|
7649 | Train/png/7649.png | def fixpath(path):
return os.path.normpath(os.path.realpath(os.path.expanduser(path)))
|
9292 | Train/png/9292.png | def services(cls):
return cls.json_get('%s/services' % cls.api_url, empty_key=True,
send_key=False)
|
4685 | Train/png/4685.png | def decode(self, session_data):
pickled = decodebytes(utf8(session_data))
return pickle.loads(pickled)
|
2589 | Train/png/2589.png | def emergency(self):
self.send(at.REF(at.REF.input.select))
|
2058 | Train/png/2058.png | def date(ctx, year, month, day):
return _date(conversions.to_integer(year, ctx), conversions.to_integer(month, ctx), conversions.to_integer(day, ctx))
|
2641 | Train/png/2641.png | def disenriched(self, thresh=0.05, idx=True):
return self.downregulated(thresh=thresh, idx=idx)
|
6526 | Train/png/6526.png | def get_all_trials(self):
response = requests.get(urljoin(self._path, "trials"))
return self._deserialize(response)
|
1928 | Train/png/1928.png | def getheader(self, name, default=None):
return self.response.headers.get(name, default)
|
9327 | Train/png/9327.png | def releases(self):
return self._h._get_resources(
resource=('apps', self.name, 'releases'),
obj=Release, app=self
)
|
2247 | Train/png/2247.png | def value2pickle(self):
return {key: s.get_edgecolor() for key, s in self.ax.spines.items()}
|
2708 | Train/png/2708.png | def _stripped_codes(codes):
return tuple([
code.strip() for code in codes.split(',')
if code.strip()
])
|
29 | Train/png/29.png | def permute(x: SYM, perm: List[int]) -> SYM:
x_s = []
for i in perm:
x_s.append(x[i])
return ca.vertcat(*x_s)
|
212 | Train/png/212.png | def disable(self):
core_napps_manager = CoreNAppsManager(base_path=self._enabled)
core_napps_manager.disable(self.user, self.napp)
|
9197 | Train/png/9197.png | def set_goal(self, x: int, y: int) -> None:
lib.TCOD_dijkstra_compute(self._path_c, x, y)
|
1783 | Train/png/1783.png | def run_version(args: dict) -> int:
version = environ.package_settings.get('version', 'unknown')
print('VERSION: {}'.format(version))
return 0
|
2668 | Train/png/2668.png | def to_datetime(time):
if type(time) == IntType or type(time) == LongType:
time = datetime.fromtimestamp(time // 1000)
return time
|
5305 | Train/png/5305.png | def addfield(self, pkt, buf, val):
self.set_endianess(pkt)
return self.fld.addfield(pkt, buf, val)
|
6831 | Train/png/6831.png | def _username():
if pwd:
username = pwd.getpwuid(os.getuid()).pw_name
else:
username = getpass.getuser()
return username
|
1995 | Train/png/1995.png | def dir_type(arg):
if not os.path.isdir(arg):
raise argparse.ArgumentTypeError(
"{0} is not a valid directory".format(repr(arg)))
return arg
|
9874 | Train/png/9874.png | def inspect(obj):
"Open the inspector windows for a given object"
from gui.tools.inspector import InspectorTool
inspector = InspectorTool()
inspector.show(obj)
return inspector
|
2319 | Train/png/2319.png | def stop(self):
self.reconnect = False
self.logger.debug("Shutting down.")
if self.transport:
self.transport.close()
|
8724 | Train/png/8724.png | def manifest_path_is_old(self, path):
mtime = os.path.getmtime(path)
return (time.time() - mtime) > 24*60*60
|
7361 | Train/png/7361.png | def _persist(self) -> None:
if self._store:
self._store.save(self._key, self._snapshot)
|
9695 | Train/png/9695.png | def du_handler(self, args):
for src, size in self.s3handler().size(args[1:]):
message('%s\t%s' % (size, src))
|
6115 | Train/png/6115.png | def not_as_alias_handler(names_list):
list_ = list()
for alias in names_list:
list_.append(alias.name)
return list_
|
5695 | Train/png/5695.png | def distance2_to(self, other: "Point2"):
assert isinstance(other, Point2)
return (self[0] - other[0]) ** 2 + (self[1] - other[1]) ** 2
|
3961 | Train/png/3961.png | def dispatch(argdict):
cmd = argdict['command']
ftc = getattr(THIS_MODULE, 'do_'+cmd)
ftc(argdict)
|
5386 | Train/png/5386.png | def dist_sq(self, other):
dx = self.x - other.x
dy = self.y - other.y
return dx**2 + dy**2
|
2198 | Train/png/2198.png | def _sort_layers(self):
self._layers = OrderedDict(
sorted(self._layers.items(), key=lambda t: t[0]))
|
2870 | Train/png/2870.png | def update(self, value):
self.update_internal(value)
self.emit('changed', self.get_widget_value())
|
3089 | Train/png/3089.png | def execute(self, *args):
command, kwargs = self.parse(*args)
return self._commands.execute(command, **kwargs)
|
2031 | Train/png/2031.png | def scramble_string(self, length):
return fake.text(length) if length > 5 else ''.join([fake.random_letter() for n in range(0, length)])
|
3764 | Train/png/3764.png | def vectorize_dialogues(self, dialogues):
return np.array([self.vectorize_dialogue(d) for d in dialogues])
|
9998 | Train/png/9998.png | def op_add(self, text):
self._attempting(text)
return terminal("+")(text).retyped(TokenType.op_add)
|
2467 | Train/png/2467.png | def doFindAll(self, WHAT={}, SORT=[], SKIP=None, MAX=None):
self._preFind(WHAT, SORT, SKIP, MAX)
return self._doAction('-findall')
|
2164 | Train/png/2164.png | def blank_object(obj: T, fieldlist: Sequence[str]) -> None:
for f in fieldlist:
setattr(obj, f, None)
|
10052 | Train/png/10052.png | def turn_on_switch(self, device_id, name):
msg = "!%sF1|Turn On|%s" % (device_id, name)
self._send_message(msg)
|
4380 | Train/png/4380.png | def get_tasks():
from paver.tasks import environment
for tsk in environment.get_tasks():
print(tsk.shortname)
|
6230 | Train/png/6230.png | def do_eos(self, _: argparse.Namespace) -> None:
if self._script_dir:
self._script_dir.pop()
|
4748 | Train/png/4748.png | def is_special_string(obj):
import bs4
return isinstance(obj, (bs4.Comment, bs4.Declaration, bs4.CData, bs4.ProcessingInstruction))
|
5764 | Train/png/5764.png | def _right(self):
left, _, width, _ = self._extents
return left + width
|
2638 | Train/png/2638.png | def newline(self):
self.write(self.term.move_down)
self.write(self.term.clear_bol)
|
3358 | Train/png/3358.png | def export_original_data(self):
return {key: self.get_original_field_value(key) for key in self.__original_data__.keys()}
|
2346 | Train/png/2346.png | def indent(self, code, level=1):
lines = code.split('\n')
lines = tuple(self.indent_space*level + line for line in lines)
return '\n'.join(lines)
|
5501 | Train/png/5501.png | def Proxy(f):
def Wrapped(self, *args):
return getattr(self, f)(*args)
return Wrapped
|
1230 | Train/png/1230.png | def all(self, components_in_and=True):
self.components_in_and = components_in_and
return [obj for obj in iter(self)]
|
4586 | Train/png/4586.png | def decimal(anon, obj, field, val):
return anon.faker.decimal(field=field)
|
4048 | Train/png/4048.png | def slugify(cls, s):
slug = re.sub("[^0-9a-zA-Z-]", "-", s)
return re.sub("-{2,}", "-", slug).strip('-')
|
6043 | Train/png/6043.png | def is_in_shard(self, s):
return self.compute_shard(s, self._nshards) == self._shard
|
2362 | Train/png/2362.png | def crunch_dir(name, n=50):
if len(name) > n + 3:
name = "..." + name[-n:]
return name
|
5638 | Train/png/5638.png | def cwd(self, new_path):
old_cwd = self._cwd
self._cwd = new_path
return old_cwd
|
5681 | Train/png/5681.png | def start_recording(self):
self._recording = True
self._stop_recording.clear()
self._source.start()
|
2154 | Train/png/2154.png | def quaternion(vector, angle):
return N.cos(angle/2)+vector*N.sin(angle/2)
|
6767 | Train/png/6767.png | def load_figure(self, fig, fmt):
self.figcanvas.load_figure(fig, fmt)
self.scale_image()
self.figcanvas.repaint()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.