common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
5783 | Train/png/5783.png | def get_profile_info(self, obj):
info = self.get_base_info(obj)
info.update({})
return info
|
6540 | Train/png/6540.png | def add_to_path(p):
if p not in os.environ["PATH"]:
os.environ["PATH"] = "{0}{1}{2}".format(
p, os.pathsep, os.environ["PATH"])
|
9095 | Train/png/9095.png | def get(self, **kwargs):
"What kind of arguments should be pass here"
kwargs.setdefault('limit', 1)
return self._first(self.gather(**kwargs))
|
1000 | Train/png/1000.png | def refresh(self):
newuser = self.bugzilla.getuser(self.email)
self.__dict__.update(newuser.__dict__)
|
7923 | Train/png/7923.png | def magnitude(self):
return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2 + self.w ** 2)
|
8109 | Train/png/8109.png | def atan_mgl(x, n=10):
acc = 1 / (1 - z ** -1) # Accumulator filter
return acc(mgl_seq(x)).skip(n-1).take()
|
1641 | Train/png/1641.png | def index_bounds(x):
if isinstance(x, (pd.DataFrame, pd.Series)):
return x.iloc[0], x.iloc[-1]
else:
return x[0], x[-1]
|
9737 | Train/png/9737.png | def _subspans(self, type_: str) -> List[List[int]]:
return self._type_to_spans[type_]
|
8965 | Train/png/8965.png | def get_protocols(self, device):
return self._reg.device_builder(device, self._rv).protocols
|
1761 | Train/png/1761.png | def _transform(xsl_filename, xml, **kwargs):
xslt = _make_xsl(xsl_filename)
xml = xslt(xml, **kwargs)
return xml
|
1869 | Train/png/1869.png | def save(self):
with open(self.store_file_path, 'w') as fh:
fh.write(json.dumps(self.store, indent=4))
|
3029 | Train/png/3029.png | def npartial(func, *args, **kwargs):
def wrapped(self, node):
func(self, *args, **kwargs)
return wrapped
|
6002 | Train/png/6002.png | def keys(self):
keys = []
for val in self.form.scales.values():
keys += val.dtype.fields.keys()
return keys
|
3997 | Train/png/3997.png | def setOutputObject(self, newOutput=output.CalcpkgOutput(True, True)):
self.output = newOutput
|
4211 | Train/png/4211.png | def show_flavor(self, flavor, **_params):
return self.get(self.flavor_path % (flavor), params=_params)
|
8694 | Train/png/8694.png | def close(self):
self.close_event.set()
if self.is_alive():
self.child.join(2)
|
8006 | Train/png/8006.png | def _identify_poly(core):
return core.A, core.dim, core.shape, core.dtype
|
6490 | Train/png/6490.png | def filepattern(self, *args, **kwargs):
return [p.filepattern(*args, **kwargs) for p in self.problems]
|
5553 | Train/png/5553.png | def static(self, *args, **kwargs):
kwargs['api'] = self.api
return static(*args, **kwargs)
|
9923 | Train/png/9923.png | def push(self):
self._refcnt += 1
_app_ctx_stack.push(self)
appcontext_pushed.send(self.app)
|
4491 | Train/png/4491.png | def interpolate(v1, v2, t):
return add(v1, mul(sub(v2, v1), t))
|
1865 | Train/png/1865.png | def wifi_status(self):
return self._info_json.get(CONST.STATUS, {}).get(CONST.WIFI_LINK)
|
8917 | Train/png/8917.png | def average_points_dist(p0, p_list):
return np.mean(list(point_dist(p0, p1) for p1 in p_list))
|
5165 | Train/png/5165.png | def check(self, value, major):
for v in value:
super(DiscreteMulti, self).check(v, major)
|
3611 | Train/png/3611.png | def subn_filter(s, find, replace, count=0):
return re.gsub(find, replace, count, s)
|
7011 | Train/png/7011.png | def get_service(self, service_id):
content = self._fetch("/service/%s" % service_id)
return FastlyService(self, content)
|
3065 | Train/png/3065.png | def taskdir(self):
return os.path.join(self.BASE, self.TAG, self.task_family)
|
4886 | Train/png/4886.png | def _update_xyz(self, change):
self.x, self.y, self.z = self.position.X(), self.position.Y(), self.position.Z()
|
7626 | Train/png/7626.png | def u_string_check(self, original, loc, tokens):
return self.check_strict("Python-2-style unicode string", original, loc, tokens)
|
1004 | Train/png/1004.png | def disable(self):
await self.controller.disable_user(self.username)
self._user_info.disabled = True
|
5794 | Train/png/5794.png | def datetime(self):
return datetime.fromtimestamp(int(self.timestamp) / 1000, tz=pytz.utc)
|
3303 | Train/png/3303.png | def make_file(self, filename, content):
with open(filename, 'w') as fp:
fp.write(content)
|
9380 | Train/png/9380.png | def static_method(cls, f):
setattr(cls, f.__name__, staticmethod(f))
return f
|
8869 | Train/png/8869.png | def fixed_length(cls, l, allow_empty=False):
return cls(l, l, allow_empty=allow_empty)
|
865 | Train/png/865.png | def set_user_timer(self, value, index):
err = self.clock_manager.set_tick(index, value)
return [err]
|
7344 | Train/png/7344.png | def stop_choose(self):
if self.choosed:
self.choosed = False
self.pos = self.pos + Sep(-5, 0)
|
289 | Train/png/289.png | def putURL(self, url, headers, body=None):
return self._load_resource("PUT", url, headers, body)
|
8514 | Train/png/8514.png | def add(self, *args, **kwargs):
return self.cat.select.add(*args, **kwargs)
|
6078 | Train/png/6078.png | def is_finite(value: Any) -> bool:
return isinstance(value, int) or (isinstance(value, float) and isfinite(value))
|
4693 | Train/png/4693.png | def handle_bad_update(operation, ret):
print("Error " + operation)
sys.exit('Return code: ' + str(ret.status_code) + ' Error: ' + ret.text)
|
3866 | Train/png/3866.png | def make_dir(cls, directory_name):
if not os.path.exists(directory_name):
os.makedirs(directory_name)
|
5003 | Train/png/5003.png | def column_vectors(self):
a, b, c, d, e, f, _, _, _ = self
return (a, d), (b, e), (c, f)
|
401 | Train/png/401.png | def add_output_variable(self, var):
assert (isinstance(var, Variable))
self.output_variable_list.append(var)
|
5290 | Train/png/5290.png | def issue(self, test, err):
self.step.setProgress('tests failed', len(self.failures) +
len(self.errors))
|
4956 | Train/png/4956.png | def read_string_from_file(path, encoding="utf8"):
with codecs.open(path, "rb", encoding=encoding) as f:
value = f.read()
return value
|
1507 | Train/png/1507.png | def cleanup(self):
for item in self.server_map:
self.member_del(item, reconfig=False)
self.server_map.clear()
|
9738 | Train/png/9738.png | def x(self):
return scale_dimension(self.X, self.header.x_scale, self.header.x_offset)
|
6743 | Train/png/6743.png | def showEvent(self, event):
QWidget.showEvent(self, event)
self.spinner.start()
|
4077 | Train/png/4077.png | def do_up(self, arg):
print("running up migration")
self.manager.run(arg, Direction.UP)
|
8246 | Train/png/8246.png | def train(self, x):
self.range = scale_continuous.train(x, self.range)
|
2348 | Train/png/2348.png | def time2seconds(t):
return t.hour * 3600 + t.minute * 60 + t.second + float(t.microsecond) / 1e6
|
8314 | Train/png/8314.png | def append(self, data):
index = self.n_blocks # note off by one so use as index
self[index] = data
self.refs.append(data)
|
1291 | Train/png/1291.png | def setgraphval(delta, graph, key, val):
delta.setdefault(graph, {})[key] = val
|
7723 | Train/png/7723.png | def gen_smul(src1, src2, dst):
assert src1.size == src2.size
return ReilBuilder.build(ReilMnemonic.SMUL, src1, src2, dst)
|
3989 | Train/png/3989.png | def start_thread(self, target, args=(), kwargs=None, priority=0):
return self.add_task(target, args, kwargs, priority)
|
2460 | Train/png/2460.png | def get_area(self):
return (self.p2.x-self.p1.x)*(self.p2.y-self.p1.y)
|
6989 | Train/png/6989.png | def build(self, **variables):
return Locator(self.by, self.locator.format(**variables), self.description)
|
4098 | Train/png/4098.png | def getMe(self):
response_str = self._command('getMe')
if (not response_str):
return False
response = json.loads(response_str)
return response
|
3142 | Train/png/3142.png | def scan(self, t, dt=None, aggfunc=None):
return self.data.scan(t, dt, aggfunc)
|
3668 | Train/png/3668.png | def fill(self, filler, size):
return lib.zchunk_fill(self._as_parameter_, filler, size)
|
6028 | Train/png/6028.png | def identify(self, obj):
hash_ = hash(obj)
type_id = self.to_id(type(obj))
return (hash_, TypeId(type_id))
|
3485 | Train/png/3485.png | def open(self):
if self._connection is None:
self._connection = sqlite3.connect(self._dbfile)
|
5045 | Train/png/5045.png | def write(self, fptr):
self._validate(writing=True)
self._write_superbox(fptr, b'ftbl')
|
3435 | Train/png/3435.png | def parse(text, showToc=True):
p = Parser(show_toc=showToc)
return p.parse(text)
|
7728 | Train/png/7728.png | def reset(self):
self._unionSDR = numpy.zeros(shape=(self._numInputs,))
self._activeCellsHistory = []
|
3951 | Train/png/3951.png | def fast_distance(r1: 'Region', r2: 'Region'):
return abs(r1.x - r2.x) + abs(r1.y - r2.y)
|
2391 | Train/png/2391.png | def set_password(self, password):
self.password = Security.hash(password)
self.save()
|
3069 | Train/png/3069.png | def haversine(x):
y = .5*x
y = np.sin(y)
return y*y
|
30 | Train/png/30.png | def factorial(n):
f = 1
while (n > 0):
f = f * n
n = n - 1
return f
|
2310 | Train/png/2310.png | def display_char(self, x, y, char):
self.send_cmd("T"+str(x+1)+","+str(y+1)+","+char)
|
9190 | Train/png/9190.png | def _my_hash(arg_list):
# type: (List[Any]) -> int
res = 0
for arg in arg_list:
res = res * 31 + hash(arg)
return res
|
9685 | Train/png/9685.png | def get_jobs(self):
url_jenkins = urijoin(self.base_url, "api", "json")
response = self.fetch(url_jenkins)
return response.text
|
6604 | Train/png/6604.png | def gen_send_version_url(ip, port):
return '{0}:{1}{2}{3}/{4}/{5}'.format(BASE_URL.format(ip), port, API_ROOT_URL, VERSION_API, NNI_EXP_ID, NNI_TRIAL_JOB_ID)
|
647 | Train/png/647.png | def save_to_file(self, fname):
with open(fname, 'w') as f:
f.write(str(self))
|
66 | Train/png/66.png | def put_ops(self, key, time, ops):
if self._store.get(key) is None:
self._store[key] = ops
|
914 | Train/png/914.png | def done(self, fid=0):
self._checkid(fid)
self._fitids[fid] = {}
self._fitproxy.done(fid)
|
6087 | Train/png/6087.png | def render_form(form, **kwargs):
renderer_cls = get_form_renderer(**kwargs)
return renderer_cls(form, **kwargs).render()
|
6283 | Train/png/6283.png | def _dist(self, x1, x2):
return self.tspace._dist(x1.tensor, x2.tensor)
|
3792 | Train/png/3792.png | def get_client_sock(addr):
"Get a client socket"
s = _socket.create_connection(addr)
s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True)
s.setblocking(False)
return s
|
3754 | Train/png/3754.png | def exit_with_error(message):
click.secho(message, err=True, bg='red', fg='white')
sys.exit(0)
|
7504 | Train/png/7504.png | def prepare(self, context):
if __debug__:
log.debug("Assigning thread local request context.")
self.local.context = context
|
5574 | Train/png/5574.png | def append(self, event):
self._events.append(event)
self._events_by_baseclass[event.baseclass].append(event)
|
7000 | Train/png/7000.png | def pause():
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(
["osascript", "-e", PAUSE], stdout=subprocess.PIPE).communicate()
|
2172 | Train/png/2172.png | def display_animation(anim, **kwargs):
from IPython.display import HTML
return HTML(anim_to_html(anim, **kwargs))
|
849 | Train/png/849.png | def filter_items(self, items):
items = self._filter_active(items)
items = self._filter_in_nav(items)
return items
|
9703 | Train/png/9703.png | def cb_list_messages(self, option, optname, value, parser): # FIXME
self.linter.msgs_store.list_messages()
sys.exit(0)
|
7293 | Train/png/7293.png | def get_variance(seq):
m = get_mean(seq)
return sum((v-m)**2 for v in seq)/float(len(seq))
|
3628 | Train/png/3628.png | def touch(fname, times=None):
with io.open(fname, 'a'):
os.utime(fname, times)
|
7085 | Train/png/7085.png | def critical(self, msg, indent=0, **kwargs):
return self.logger.critical(self._indent(msg, indent), **kwargs)
|
4687 | Train/png/4687.png | def fetch_host_ip(host: str) -> str:
try:
ip = socket.gethostbyname(host)
except socket.gaierror:
return ''
return ip
|
3994 | Train/png/3994.png | def AddHeader(self, header, value):
self.user_headers.append((header, value))
return self
|
7008 | Train/png/7008.png | def get_event_log(self, object_id):
content = self._fetch("/event_log/%s" % object_id, method="GET")
return FastlyEventLog(self, content)
|
4349 | Train/png/4349.png | def get(cls, id):
client = cls._new_api_client()
return client.make_request(cls, 'get', url_params={'id': id})
|
1124 | Train/png/1124.png | def add_geo_facet(self, *args, **kwargs):
self.facets.append(GeoDistanceFacet(*args, **kwargs))
|
8054 | Train/png/8054.png | def debug(*args):
for i in args:
click.echo('D:%s' % str(i), err=True)
|
10011 | Train/png/10011.png | def __update_count(self):
self._ntypes = self.count_types()
self._nvars = self.count_vars()
self._nfuns = self.count_funs()
|
5248 | Train/png/5248.png | def get_load(jid):
conn, mdb = _get_conn(ret=None)
return mdb.jobs.find_one({'jid': jid}, {'_id': 0})
|
8787 | Train/png/8787.png | def makedir(self, path, class_id=None):
return self.create_dir_entry(path, dir_type='storage', class_id=class_id)
|
4320 | Train/png/4320.png | def generate_token(self):
response = self._make_request()
self.auth = response
self.token = response['token']
|
7187 | Train/png/7187.png | def fsliceafter(astr, sub):
findex = astr.find(sub)
return astr[findex + len(sub):]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.