Search is not available for this dataset
id int64 0 10.8M | vector listlengths 1.54k 1.54k | ast_depth int64 3 164 | ast_data stringlengths 297 510k | full_path stringlengths 0 319 | code stringlengths 60 56.5k |
|---|---|---|---|---|---|
13,701 | [
0.006499079987406731,
-0.044132720679044724,
0.07161803543567657,
-0.029291629791259766,
-0.0389578677713871,
-0.013962343335151672,
-0.01705016940832138,
0.02543489821255207,
0.012204845435917377,
-0.016293467953801155,
0.042009077966213226,
-0.07913621515035629,
-0.016696227714419365,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class BackendTestCase(TestCase):
def test_cursor_executemany(self):
#4896: Test cursor.executemany
cursor = connection.cursor()
qn = connection.ops.quote_name
opts = models.Square._meta
f1, f2 = opts.get_field('root'), opts.get_field('square')
query = ('INSERT INTO %s... | |
13,702 | [
0.021564947441220284,
-0.020374171435832977,
0.012777023017406464,
-0.02445853129029274,
-0.013574842363595963,
-0.025315890088677406,
-0.03531840443611145,
0.0029040041845291853,
0.007698364555835724,
0.0034621802624315023,
-0.0038104820996522903,
-0.07501886785030365,
-0.003396687563508749... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_unicode_fetches(self):
#6254: fetchone, fetchmany, fetchall return strings as unicode objects
qn = connection.ops.quote_name
models.Person(first_name="John", last_name="Doe").save()
models.Person(first_name="Jane", last_name="Doe").save()
models.Person(first_name="Mary",... | |
13,703 | [
0.01693038083612919,
-0.03522270917892456,
0.06917739659547806,
-0.016625117510557175,
-0.040365222841501236,
-0.002588869072496891,
-0.01100709568709135,
0.03219355642795563,
0.011312359943985939,
-0.012175315991044044,
0.04618871212005615,
-0.061663221567869186,
0.014253455214202404,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cursor_executemany(self):
#4896: Test cursor.executemany
cursor = connection.cursor()
qn = connection.ops.quote_name
opts = models.Square._meta
f1, f2 = opts.get_field('root'), opts.get_field('square')
query = ('INSERT INTO %s (%s, %s) VALUES (%%s, %%s)'
... | |
13,704 | [
0.04206022247672081,
0.010031075216829777,
0.05683315545320511,
-0.060520630329847336,
0.04106921702623367,
0.004600697197020054,
-0.04657737538218498,
0.03726651147007942,
0.012675683945417404,
-0.003845917759463191,
0.04885900020599365,
-0.031965769827365875,
0.013620598241686821,
-0.007... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "Transforms a data dump from pre-v17.12 RCAMP to a version that v17.12 can load. To generate a compatible dump, run the following command:... | class Command(BaseCommand):
help = """Transforms a data dump from pre-v17.12 RCAMP to a version that v17.12 can load. To generate a compatible dump, run the following command:\n\npython manage.py dumpdata --output=old-version-dump.json --indent=4 --exclude=contenttypes --exclude=sessions --exclude=auth --exclude=ad... | |
13,705 | [
0.01261110045015812,
-0.036329224705696106,
0.05023404210805893,
-0.034856703132390976,
-0.01690245047211647,
-0.01869051344692707,
-0.019111234694719315,
-0.004840916488319635,
-0.014662113972008228,
-0.0006646070978604257,
0.003975810017436743,
-0.05099133774638176,
-0.03473048657178879,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "size", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def get_numbers(size, a, b):
current_level = {0}
for _ in range(size - 1):
next_level = set()
for item in current_level:
next_level.add(item + a)
next_level.add(item + b)
current_level = next_level
return sorted(current_level) | |
13,706 | [
0.02803134173154831,
0.01254327967762947,
0.03575984016060829,
-0.060535769909620285,
0.04532727599143982,
-0.0029354628641158342,
-0.007647735066711903,
0.008598266169428825,
-0.009176040068268776,
0.000510599697008729,
0.06396513432264328,
-0.021880846470594406,
-0.00460044527426362,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}, "... | def handle(self, *args, **options):
dump_filename = options.get('input_file')
transformed_filename = options.get('output','transformed-data.json')
original_data = json.load(open(dump_filename))
# Sync users should have been run already. If it hasn't bail out.
auth_users = User.o... | |
13,707 | [
-0.006825647316873074,
-0.02801501378417015,
0.003960237372666597,
-0.021278418600559235,
0.023677609860897064,
-0.029272232204675674,
-0.006804693955928087,
0.04882197454571724,
0.04171869158744812,
0.017244843766093254,
0.016102870926260948,
0.015369493514299393,
0.033861078321933746,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "user_list", "annotation": null, "type_comment": null}}, {"_type":... | def transform_user_list_to_pk(self,user_list,user_pk_lookup):
pk_list = []
for username in user_list.split(','):
if not username:
continue
try:
pk = user_pk_lookup[username]
pk_list.append(pk)
except KeyError:
... | |
13,708 | [
0.03931258246302605,
-0.021261118352413177,
0.0016347045311704278,
-0.05217396467924118,
0.05112684145569801,
-0.0231504887342453,
0.011632153764367104,
-0.009429783560335636,
0.035715945065021515,
0.025472367182374,
-0.020760320127010345,
0.033234722912311554,
-0.017835209146142006,
0.000... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def GraphFn(self, x):
dtype = x.dtype
e = constant_op.constant(
np.random.normal(.3, 0.05, [3, 2, 3, 4]), name="weights", dtype=dtype)
conv = nn.conv2d(
input=x,
filter=e,
data_format="NCHW",
strides=[1, 1, 1, 1],
padding="VALID",
name="conv")
b = ... | |
13,709 | [
0.003389801597222686,
0.0011706543155014515,
0.08041703701019287,
0.013324656523764133,
0.04119139537215233,
-0.00019580710795708,
-0.032814618200063705,
0.0022365988697856665,
-0.0014617472188547254,
-0.0020816284231841564,
0.04501120373606682,
-0.04009682685136795,
0.002078836318105459,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def supported_providers():
return dict(
Openshift=dict(
class_name='ManageIQ::Providers::Openshift::ContainerManager',
authtype='bearer',
default_role='default',
metrics_role='prometheus',
alerts_role='prometheus_alerts',
),
Amazon=... | |
13,710 | [
0.02282177470624447,
-0.005694916937500238,
0.03115888126194477,
-0.0025619231164455414,
-0.010710865259170532,
-0.0002552712394390255,
-0.030758868902921677,
0.023032307624816895,
0.05259113758802414,
0.039559148252010345,
0.014810995198786259,
-0.04568565636873245,
0.013147784397006035,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def endpoint_argument_spec():
return dict(
role=dict(),
hostname=dict(required=True),
port=dict(type='int'),
verify_ssl=dict(default=True, type='bool'),
certificate_authority=dict(),
security_protocol=dict(
choices=[
'ssl-with-validation',
... | |
13,711 | [
0.014973577111959457,
0.029322253540158272,
0.02301316149532795,
-0.03701333701610565,
-0.024034634232521057,
0.04326234012842178,
-0.00823186244815588,
0.02898576855659485,
0.014889455400407314,
0.04710788279771805,
0.06176900863647461,
-0.05672173574566841,
0.016980469226837158,
0.004028... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":... | def main():
zone_id = None
endpoints = []
argument_spec = dict(
manageiq_connection=dict(required=True, type='dict',
options=manageiq_argument_spec()),
state=dict(choices=['absent', 'present'], default='present'),
name=dict(required=True),
zon... | |
13,712 | [
-0.0023561185225844383,
0.0012760595418512821,
0.0696062445640564,
-0.0072259786538779736,
-0.010806072503328323,
-0.029649538919329643,
-0.04210585355758667,
-0.02975918911397457,
-0.018333591520786285,
0.01633794791996479,
0.016129612922668457,
0.02169986627995968,
-0.013805018737912178,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "project", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "sha1", "annotation": null, "type_comment": null}}], "kwarg": n... | def find_git_parent(project, sha1):
base_url = config.githelper_base_url
if not base_url:
log.warning('githelper_base_url not set, --newest disabled')
return None
def refresh(project):
url = '%s/%s.git/refresh' % (base_url, project)
resp = requests.get(url)
if not r... | |
13,713 | [
-0.02105703018605709,
-0.014916804619133472,
0.05412411689758301,
-0.010122922249138355,
-0.009075140580534935,
-0.01032571867108345,
-0.026588866487145424,
-0.01347469724714756,
-0.001308318693190813,
0.01726023107767105,
0.042429521679878235,
-0.0024222908541560173,
-0.00788652803748846,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "project", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "committish", "annotation": null, "type_comment": null}}, {"_ty... | def get_sha1s(project, committish, count):
url = '/'.join((base_url, '%s.git' % project,
'history/?committish=%s&count=%d' % (committish, count)))
resp = requests.get(url)
resp.raise_for_status()
sha1s = resp.json()['sha1s']
if len(sha1s) != count:
... | |
13,714 | [
0.03155948221683502,
0.024315597489476204,
0.07129041850566864,
-0.025574443861842155,
-0.019169790670275688,
0.011384823359549046,
0.017502371221780777,
0.01548159308731556,
-0.043264538049697876,
0.021753735840320587,
-0.020097360014915466,
-0.021035972982645035,
0.03208952024579048,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {... | class Migration(migrations.Migration):
dependencies = [
('lookuperror_a', '0002_a2'),
('lookuperror_c', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='C2',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID'... | |
13,715 | [
-0.029218774288892746,
0.030602194368839264,
-0.0014013085747137666,
0.00958256609737873,
-0.026952829211950302,
0.06707199662923813,
0.009654121473431587,
0.004028016701340675,
0.05194978788495064,
0.042313557118177414,
0.018819276243448257,
-0.052140604704618454,
0.009982087649405003,
0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "endpoint", "annotation": null, "type_comment": null}}], "kwarg"... | def _system_state_change(module, endpoint):
state = module.params['state']
if state == 'absent' and endpoint:
return True
if state == 'present':
if endpoint is None:
return True
return _needs_update(module, endpoint)
return False | |
13,716 | [
0.017658177763223648,
-0.008704256266355515,
-0.006740975193679333,
-0.04475826025009155,
0.010293037630617619,
0.018384478986263275,
-0.050069332122802734,
0.02187979780137539,
0.0436234176158905,
0.06300655752420425,
0.02716817334294319,
-0.05978360027074814,
0.018463917076587677,
-0.027... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
argument_spec = openstack_full_argument_spec(
service=dict(type='str', required=True),
endpoint_interface=dict(type='str', required=True, choices=['admin', 'public', 'internal']),
url=dict(type='str', required=True),
region=dict(type='str'),
enabled=dict(type='boo... | |
13,717 | [
0.014377085492014885,
0.06038128212094307,
0.0346238873898983,
-0.02897707186639309,
0.021051719784736633,
-0.00962806586176157,
-0.005064795725047588,
-0.024878177791833878,
-0.022314822301268578,
-0.02288445644080639,
0.01241432223469019,
0.002513822866603732,
-0.007392868399620056,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "b_material", "annotation": null, "type_comment": null}}, {"_type"... | def import_material_alpha_controller(self, b_material, n_geom):
# find alpha controller
n_matprop = self.find_property(n_geom, NifFormat.NiMaterialProperty)
if not n_matprop:
return
n_alphactrl = self.find_controller(n_matprop,
NifFo... | |
13,718 | [
0.013591492548584938,
0.012617084197700024,
0.04592779278755188,
-0.011080130934715271,
0.02101507969200611,
-0.008719449862837791,
0.021436989307403564,
-0.033250436186790466,
-0.014646265655755997,
0.07473814487457275,
-0.02601771429181099,
-0.053160518407821655,
-0.025435077026486397,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "app_name", "annotation": null, "type_comment": null}}, {"_type": ... | def __init__(self, app_name, app_module):
# Full Python path to the application eg. 'django.contrib.admin'.
self.name = app_name
# Root module for the application eg. <module 'django.contrib.admin'
# from 'django/contrib/admin/__init__.pyc'>.
self.module = app_module
# ... | |
13,719 | [
0.010644511319696903,
0.03010636568069458,
0.01621541939675808,
-0.012661660090088844,
0.01790289580821991,
-0.03862197697162628,
0.01702004298567772,
-0.014337961561977863,
-0.05019962787628174,
-0.016584204509854317,
0.008180349133908749,
0.024339890107512474,
-0.01889749988913536,
-0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "b_material", "annotation": null, "type_comment": null}}, {"_type"... | def import_material_color_controller(
self, b_material, b_channels, n_geom, n_target_color):
# find material color controller with matching target color
n_matprop = self.find_property(n_geom, NifFormat.NiMaterialProperty)
if not n_matprop:
return
for ctrl in n_matprop... | |
13,720 | [
0.012140858918428421,
0.06608673930168152,
0.048968128859996796,
-0.04055046662688255,
-0.008220372721552849,
-0.011867688968777657,
-0.007168165408074856,
-0.02189401537179947,
-0.05560513213276863,
0.026993175968527794,
-0.053824473172426224,
-0.05038456246256828,
0.013152596540749073,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "all_models", "annotation": null, "type_comment": null}}], "kwarg"... | def import_models(self, all_models):
# Dictionary of models for this app, primarily maintained in the
# 'all_models' attribute of the Apps this AppConfig is attached to.
# Injected as a parameter because it gets populated when models are
# imported, which might happen before populate() i... | |
13,721 | [
-0.002456232439726591,
-0.018990468233823776,
-0.013517521321773529,
-0.0027680695056915283,
0.03272778540849686,
-0.019902626052498817,
-0.004156912676990032,
0.03804687783122063,
0.00781928189098835,
0.020067473873496056,
-0.000043444269977044314,
-0.01693536527454853,
0.015286887995898724... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul... | def to_python(self, value):
if isinstance(value, basestring):
if value.startswith(('<=', '>=')):
self.operator = value[0:2]
value = value[2:]
elif value.startswith(('$', '<', '>', '~')):
self.operator = value[0:1]
value = va... | |
13,722 | [
0.054945625364780426,
0.0005378624773584306,
0.030407940968871117,
-0.009433506056666374,
-0.020921602845191956,
0.009826813824474812,
0.01563837006688118,
0.0030378589872270823,
-0.008864090777933598,
0.07213374227285385,
0.06884639710187912,
-0.0184208732098341,
-0.04426175355911255,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "values", "annotation": null, "type_comment": null}}], "kwarg": {"... | def clean(self, values, *args, **kwargs):
cleaned_values = []
prefixed_values = []
if values is None:
# call the mother classe's clean to do other verifications
return super(MultiplePrefixedValueField, self).clean(
values,
*args,
... | |
13,723 | [
0.04938248172402382,
-0.003425474977120757,
-0.024320293217897415,
0.018964728340506554,
0.02758927457034588,
-0.0017851883312687278,
0.010056174360215664,
0.02872530370950699,
0.000515125400852412,
0.03987693414092064,
0.024436214938759804,
-0.014536533504724503,
-0.010438715107738972,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def clean(self, *args, **kwargs):
cleaned_value = super(PrefixedField, self).clean(*args, **kwargs)
self.prefixed_value = self.value_to_string(cleaned_value)
if self.operator is not None:
self.prefixed_value = self.operator + self.prefixed_value
return cleaned_value | |
13,724 | [
0.02897447906434536,
0.02968405745923519,
-0.01992734521627426,
0.021098151803016663,
-0.04380468279123306,
-0.024527782574295998,
0.027437057346105576,
0.011146305128932,
0.0034148492850363255,
0.016840675845742226,
0.033539436757564545,
-0.004822181072086096,
-0.002397785894572735,
-0.04... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "_step", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def clear_fields(_step):
# Clear the input fields and trigger an 'input' event
script = """
$('{selector}')
.prop('disabled', false)
.removeClass('is-disabled')
.attr('aria-disabled', false)
.val('')
.trigger('input');
""".format(selector=... | |
13,725 | [
0.042719002813100815,
-0.003246310167014599,
-0.023966824635863304,
-0.019047588109970093,
-0.014616423286497593,
-0.03709334880113602,
0.03193007782101631,
-0.001274762791581452,
-0.022065918892621994,
0.02887321636080742,
0.05687304213643074,
0.007610044442117214,
-0.03352272883057594,
-... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "_step", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}], "kwarg": nu... | def clear_field(_step, index):
index = int(index) - 1
world.css_fill(SELECTORS['url_inputs'], '', index)
# For some reason ChromeDriver doesn't trigger an 'input' event after filling
# the field with an empty value. That's why we trigger it manually via jQuery.
world.trigger_event(SELECTORS['url_in... | |
13,726 | [
0.009563068859279156,
-0.014195787720382214,
-0.013341710902750492,
-0.019553177058696747,
-0.04058157652616501,
0.004849472548812628,
0.015088685788214207,
-0.0065188040025532246,
-0.01052067056298256,
-0.018841445446014404,
0.05512676015496254,
-0.008767224848270416,
-0.030436182394623756,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "_step", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "link", "annotation": null, "type_comment": null}}, {"_type": "ar... | def i_enter_a_source(_step, link, index):
index = int(index) - 1
if index is not 0 and not world.css_visible(SELECTORS['collapse_bar']):
world.css_click(SELECTORS['collapse_link'])
assert world.css_visible(SELECTORS['collapse_bar'])
world.css_fill(SELECTORS['url_inputs'], link, index)
... | |
13,727 | [
0.013482163660228252,
0.007717875298112631,
-0.019222334027290344,
0.03427219018340111,
-0.027808470651507378,
-0.0371905118227005,
0.024890149012207985,
-0.0033223042264580727,
-0.009158947505056858,
-0.023298336192965508,
0.010877381078898907,
0.0028926958329975605,
-0.022321542724967003,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "_step", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "not_see", "annotation": null, "type_comment": null}}, {"_type": ... | def i_see_button_with_custom_text(_step, not_see, button_type, custom_text, index):
button = button_type.strip()
custom_text = custom_text.strip()
index = int(index.strip()) - 1
if not_see.strip():
assert world.is_css_not_present(TRANSCRIPTS_BUTTONS[button][0])
else:
assert world.cs... | |
13,728 | [
0.00473214965313673,
0.02657749503850937,
-0.023733364418148994,
-0.01947321929037571,
-0.01606026291847229,
0.0012011914514005184,
0.042068932205438614,
0.004617174156010151,
-0.007927258498966694,
-0.01865023747086525,
0.016278110444545746,
0.001029484556056559,
-0.02337028458714485,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def _transcripts_are_downloaded():
world.wait_for_ajax_complete()
request = RequestHandler()
DOWNLOAD_BUTTON = world.css_find(TRANSCRIPTS_BUTTONS["download_to_edit"][0]).first
url = DOWNLOAD_BUTTON['href']
request.connect(url)
return request.status_code.is_success() | |
13,729 | [
0.01609821431338787,
0.001816494856029749,
-0.022197281941771507,
-0.022114301100373268,
-0.043108366429805756,
-0.023400498554110527,
0.03068203665316105,
-0.028566034510731697,
-0.015755919739603996,
-0.026408541947603226,
0.026823444291949272,
0.004281274508684874,
-0.016170823946595192,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "_step", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "a... | def set_value_transcripts_field(_step, value, field_name):
tab = world.css_find('#settings-tab').first
XPATH = './/label[text()="{name}"]'.format(name=field_name)
SELECTOR = '#' + tab.find_by_xpath(XPATH)[0]['for']
element = world.css_find(SELECTOR).first
if element['type'] == 'text':
SCRIPT... | |
13,730 | [
0.003163399640470743,
-0.002559370594099164,
-0.012960782274603844,
-0.02419660985469818,
0.02540171518921852,
-0.024952754378318787,
0.031498126685619354,
0.0021502848248928785,
-0.009912576526403427,
-0.00424444954842329,
0.059735383838415146,
-0.009245042689144611,
0.005694710183888674,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def purchase_order_change(self):
if not self.purchase_id:
return {}
if not self.partner_id:
self.partner_id = self.purchase_id.partner_id.id
new_lines = self.env['account.invoice.line']
for line in self.purchase_id.order_line:
# Load a PO line only on... | |
13,731 | [
0.010373071767389774,
0.038291964679956436,
-0.018172457814216614,
-0.02737058512866497,
0.0239240862429142,
-0.013036276213824749,
0.02569209598004818,
-0.002058948390185833,
-0.0042745559476315975,
-0.01539735309779644,
0.0342412069439888,
-0.030168069526553154,
-0.015106415376067162,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def invoice_line_move_line_get(self):
res = super(AccountInvoice, self).invoice_line_move_line_get()
if self.env.user.company_id.anglo_saxon_accounting:
if self.type in ['in_invoice', 'in_refund']:
for i_line in self.invoice_line_ids:
res.extend(self._ang... | |
13,732 | [
0.009064664132893085,
-0.027517301961779594,
0.009286191314458847,
-0.01614156737923622,
0.022188669070601463,
-0.009160459972918034,
-0.0037031008396297693,
-0.02945716492831707,
-0.013698779046535492,
-0.023996811360120773,
0.042964350432157516,
-0.01912320777773857,
-0.035468339920043945,... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vals", "annotation": null, "type_comment": null}}], "kwarg": null... | def write(self, vals):
result = True
for invoice in self:
purchase_old = invoice.invoice_line_ids.mapped('purchase_line_id.order_id')
result = result and super(AccountInvoice, invoice).write(vals)
purchase_new = invoice.invoice_line_ids.mapped('purchase_line_id.order_... | |
13,733 | [
-0.00950287003070116,
0.03970275819301605,
0.04913163557648659,
-0.06126655638217926,
0.017948690801858902,
0.009582148864865303,
0.014344153925776482,
-0.00822912622243166,
-0.01937570609152317,
-0.009228036738932133,
0.012822003103792667,
-0.06727059185504913,
0.021024703979492188,
-0.03... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StringProperty", "value": {"_type": "Name", "_fields": {"id"... | class Menu(db.Model):
store_name = db.StringProperty(required = True)
menu_group_name = db.StringProperty(required = True)
menu_name = db.StringProperty(required = True)
price = db.IntegerProperty(required = True)
@classmethod
def by_menu_name(cls, store_name ,menu_name):
menuquery = db... | |
13,734 | [
0.05313834547996521,
0.02637398988008499,
0.03713340684771538,
-0.03698702156543732,
-0.024873526766896248,
0.022177573293447495,
0.029838472604751587,
0.034840017557144165,
0.006312923040241003,
-0.0036779639776796103,
0.040500298142433167,
-0.028813766315579414,
-0.013296784833073616,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_field_save_and_delete_methods(self):
p = self.PersonModel(name='Joe')
p.mugshot.save("mug", self.file1)
self.check_dimensions(p, 4, 8, 'mugshot')
self.check_dimensions(p, None, None, 'headshot')
p.headshot.save("head", self.file2)
self.check_dimensions(p, 4, 8, '... | |
13,735 | [
0.022812729701399803,
0.005259895697236061,
0.05115661770105362,
-0.02537982352077961,
-0.021396858617663383,
0.0008237194851972163,
0.018062282353639603,
-0.026729531586170197,
0.0029111371841281652,
0.02573709934949875,
0.018512185662984848,
-0.029614204540848732,
-0.00980523880571127,
-... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_assignment(self):
p = self.PersonModel()
self.check_dimensions(p, None, None, 'mugshot')
self.check_dimensions(p, None, None, 'headshot')
p.mugshot = self.file1
self.check_dimensions(p, 4, 8, 'mugshot')
self.check_dimensions(p, None, None, 'headshot')
p.... | |
13,736 | [
0.0479155108332634,
0.02243296056985855,
-0.03705712407827377,
0.004392447415739298,
0.029756594449281693,
0.04729172959923744,
0.02364586479961872,
0.010390549898147583,
0.02656838856637478,
0.0015219065826386213,
0.04606727510690689,
0.018020298331975937,
-0.004158530384302139,
-0.014693... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul... | def comment(self, value):
# Ensure the number of comments for the parent worksheet is up-to-date
if value is None and self._comment is not None:
self.parent._comment_count -= 1
if value is not None and self._comment is None:
self.parent._comment_count += 1
if va... | |
13,737 | [
0.022199800238013268,
-0.0028101331554353237,
-0.003525850595906377,
0.01925656944513321,
0.02007022686302662,
-0.012877893634140491,
0.04472104460000992,
-0.051109764724969864,
0.0013309834757819772,
0.028086263686418533,
0.02119528502225876,
0.006428901571780443,
-0.004731269553303719,
-... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "worksheet", "annotation": null, "type_comment": null}}, {"_type":... | def __init__(self, worksheet, column=None, row=None, value=None, col_idx=None, style_array=None):
super(Cell, self).__init__(worksheet, style_array)
self.row = row
# _value is the stored value, while value is the displayed value
self._value = None
self._hyperlink = None
s... | |
13,738 | [
-0.005640978459268808,
0.005931085906922817,
0.015762506052851677,
-0.026689887046813965,
-0.011915895156562328,
-0.03455502167344093,
0.014301223680377007,
0.011915895156562328,
0.014494628645479679,
0.0013954705791547894,
0.019587626680731773,
-0.06949685513973236,
0.03977695479989052,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class FixedMenu(Screen):
def okbuttonClick(self):
selection = self["menu"].getCurrent()
selection[1]()
def __init__(self, session, title, list):
Screen.__init__(self, session)
self["menu"] = List(list)
self["actions"] = ActionMap(["OkCancelActions"],
{
"ok": self.okbuttonClick,
"cancel": sel... | |
13,739 | [
-0.009447098709642887,
0.00973485503345728,
-0.012704718858003616,
-0.01769973710179329,
0.011542834341526031,
-0.03361864015460014,
0.0074816676788032055,
0.01563657633960247,
0.017026495188474655,
0.02139170654118061,
0.028471600264310837,
-0.04265310615301132,
0.020989933982491493,
0.00... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}, {"_type": "... | def __init__(self, session, title, list):
Screen.__init__(self, session)
self["menu"] = List(list)
self["actions"] = ActionMap(["OkCancelActions"],
{
"ok": self.okbuttonClick,
"cancel": self.close
})
self["title"] = StaticText(title) | |
13,740 | [
-0.004248614888638258,
0.02631949819624424,
0.04007575660943985,
-0.011364131234586239,
-0.01756662130355835,
0.02008657343685627,
0.045553915202617645,
-0.004041661974042654,
0.002882119035348296,
0.042291369289159775,
0.02739078179001808,
-0.016483163461089134,
-0.017773574218153954,
-0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "factory", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "X", "annotation": null, "type_comment": null}}, {"_type": "arg... | def bench(factory, X, Y, X_test, Y_test, ref_coef):
gc.collect()
# start time
tstart = time()
clf = factory(alpha=alpha).fit(X, Y)
delta = time() - tstart
# stop time
print("duration: %0.3fs" % delta)
print("rmse: %f" % rmse(Y_test, clf.predict(X_test)))
print("mean coef abs diff: ... | |
13,741 | [
-0.003170069307088852,
-0.0543002188205719,
0.017716597765684128,
-0.02115510031580925,
-0.006538268178701401,
-0.04261698201298714,
0.039498042315244675,
-0.02582072652876377,
0.007426654454320669,
-0.009753076359629631,
0.04655400291085243,
-0.023264218121767044,
-0.001360541325993836,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
super(BasketsViewTests, self).setUp()
self.url = reverse('commerce_api:v0:baskets:create')
self._login()
self.course = CourseFactory.create()
# TODO Verify this is the best method to create CourseMode objects.
# TODO Find/create constants for the modes.... | |
13,742 | [
-0.023675400763750076,
0.031892940402030945,
-0.0006746156723238528,
0.05174829810857773,
-0.04057688266038895,
-0.04695102944970131,
-0.02233172208070755,
0.006535165943205357,
-0.021165719255805016,
0.025829728692770004,
-0.0015921484446153045,
-0.0031537588220089674,
0.027251141145825386,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__(self):
if ctypes is None:
warn("IPython GUI event loop requires ctypes, %gui will not be available")
else:
self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int)
self.guihooks = {}
self.aliases = {}
self.apps = {}
self._reset() | |
13,743 | [
0.014605780132114887,
-0.00522827310487628,
0.0023130786139518023,
-0.015893472358584404,
0.021091938018798828,
0.01789655163884163,
-0.025515403598546982,
-0.015297318808734417,
-0.0016319723799824715,
0.039942335337400436,
0.002076107310131192,
-0.06758005172014236,
-0.02716078981757164,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CharField", "value": {"_type": "Name", "_fields": {"id": "mo... | class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_recently(self):
now = timezone.now()
return now - datetime.timedelta(days=1) <= self.pub_date <= n... | |
13,744 | [
0.05875777453184128,
0.011808935552835464,
0.010976916179060936,
0.023962154984474182,
0.01728304848074913,
0.034267716109752655,
-0.003761300817131996,
0.02816241793334484,
-0.004897437524050474,
-0.011877791956067085,
0.0024845816660672426,
0.007172579877078533,
0.05852825194597244,
0.07... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ev", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def handle_key_press(self, ev, editor):
key = ev.key()
if key == Qt.Key_Tab and smart_tab(editor, ev):
return True
elif key == Qt.Key_Backspace and smart_backspace(editor, ev):
return True
elif key in (Qt.Key_Enter, Qt.Key_Return):
ls = get_leading_... | |
13,745 | [
0.0595446340739727,
0.02784385345876217,
0.005214117933064699,
-0.0018772806506603956,
-0.0026417316403239965,
0.01902046799659729,
-0.028240112587809563,
-0.005910874810069799,
-0.012138756923377514,
0.023498203605413437,
-0.01979978010058403,
-0.019046885892748833,
0.05043065920472145,
0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "tw", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "override_tab_stop_width", "ctx": {"_type": "Store", "_fields"... | class Smarts(NullSmarts):
override_tab_stop_width = tw
def __init__(self, *args, **kwargs):
NullSmarts.__init__(self, *args, **kwargs)
c = re.compile
self.escape_scope_pat = c(r'\s+(continue|break|return|pass)(\s|$)')
self.dedent_pat = c(r'\s+(else|elif|except)(\(|\s|$)')
... | |
13,746 | [
0.03258107602596283,
-0.03387664258480072,
0.0452728196978569,
-0.00866109598428011,
0.007005651015788317,
-0.006333876401185989,
-0.012187913991510868,
-0.014791040681302547,
-0.018185902386903763,
0.05926012992858887,
0.028190547600388527,
-0.054029885679483414,
0.01284769270569086,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "start", "annotation": null, "type_comment": null}}, {"_type": "ar... | def _test_one_range(self, start, end, step):
elements = set()
for chunk in utils.make_range(start, end, step):
for item in chunk:
self.assertFalse(item in elements)
elements.add(item)
self.assertTrue(set(range(start, end)) == elements) | |
13,747 | [
0.0019275171216577291,
-0.032290682196617126,
0.06371621042490005,
-0.04763448238372803,
-0.009618501178920269,
-0.040229763835668564,
-0.02148895338177681,
-0.01624712534248829,
0.019516905769705772,
0.022863024845719337,
0.03216345235705376,
-0.027914009988307953,
-0.01581454649567604,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestUtils(testtools.TestCase):
def setUp(self):
super(TestUtils, self).setUp()
def _test_one_range(self, start, end, step):
elements = set()
for chunk in utils.make_range(start, end, step):
for item in chunk:
self.assertFalse(item in elements)
... | |
13,748 | [
-0.015361599624156952,
-0.01671469397842884,
0.03265998139977455,
-0.022432180121541023,
0.005757283419370651,
0.01928822696208954,
-0.015693239867687225,
0.03740907832980156,
0.014459537342190742,
-0.01444627158343792,
0.03873563930392265,
-0.025668995454907417,
0.009577784687280655,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestGetItem(object):
def test_getitem(self):
idx1 = pd.date_range('2011-01-01', '2011-01-31', freq='D', name='idx')
idx2 = pd.date_range('2011-01-01', '2011-01-31', freq='D',
tz='Asia/Tokyo', name='idx')
for idx in [idx1, idx2]:
result = idx[0]... | |
13,749 | [
-0.011121491901576519,
-0.024315163493156433,
0.014433384872972965,
-0.05150502547621727,
0.0035334841813892126,
0.009037335403263569,
-0.00130559247918427,
0.021069148555397987,
0.018817299976944923,
-0.003410710720345378,
0.05423598736524582,
0.005425994284451008,
0.00150098220910877,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_getitem(self):
idx1 = pd.date_range('2011-01-01', '2011-01-31', freq='D', name='idx')
idx2 = pd.date_range('2011-01-01', '2011-01-31', freq='D',
tz='Asia/Tokyo', name='idx')
for idx in [idx1, idx2]:
result = idx[0]
assert result == T... | |
13,750 | [
0.01091983076184988,
0.009787739254534245,
0.06256907433271408,
-0.010473462752997875,
0.006689042784273624,
0.013662725687026978,
-0.015603453852236271,
0.03948734700679779,
0.019484911113977432,
-0.009593666531145573,
0.04484375938773155,
-0.023547502234578133,
-0.00730360671877861,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_dti_business_getitem(self):
rng = pd.bdate_range(START, END)
smaller = rng[:5]
exp = DatetimeIndex(rng.view(np.ndarray)[:5])
tm.assert_index_equal(smaller, exp)
assert smaller.freq == rng.freq
sliced = rng[::5]
assert sliced.freq == BDay() * 5
... | |
13,751 | [
0.02321982942521572,
-0.0017810664139688015,
0.05941392853856087,
-0.013231698423624039,
-0.009351001121103764,
0.02424953319132328,
-0.008649514988064766,
0.039669353514909744,
0.006673770025372505,
-0.006982681341469288,
0.04870500788092613,
-0.030659440904855728,
-0.0037680736277252436,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_dti_custom_getitem(self):
rng = pd.bdate_range(START, END, freq='C')
smaller = rng[:5]
exp = DatetimeIndex(rng.view(np.ndarray)[:5])
tm.assert_index_equal(smaller, exp)
assert smaller.freq == rng.freq
sliced = rng[::5]
assert sliced.freq == CDay() * 5
... | |
13,752 | [
-0.026512565091252327,
-0.032199036329984665,
0.02314685471355915,
-0.0329037681221962,
0.02677987702190876,
-0.006524861324578524,
-0.006385129410773516,
0.020364372059702873,
-0.002103568986058235,
0.02964741364121437,
0.012551548890769482,
-0.0029860048089176416,
-0.01848103106021881,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_where_other(self):
# other is ndarray or Index
i = pd.date_range('20130101', periods=3, tz='US/Eastern')
for arr in [np.nan, pd.NaT]:
result = i.where(notna(i), other=np.nan)
expected = i
tm.assert_index_equal(result, expected)
i2 = i.copy()... | |
13,753 | [
-0.028323592618107796,
-0.020087819546461105,
0.004636996891349554,
-0.03268645331263542,
0.030703336000442505,
0.008259103633463383,
-0.004604917019605637,
0.008334929123520851,
-0.01852465607225895,
0.025757204741239548,
-0.014675074256956577,
-0.012306997552514076,
-0.0020997722167521715,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestWhere(object):
def test_where_other(self):
# other is ndarray or Index
i = pd.date_range('20130101', periods=3, tz='US/Eastern')
for arr in [np.nan, pd.NaT]:
result = i.where(notna(i), other=np.nan)
expected = i
tm.assert_index_equal(result, exp... | |
13,754 | [
-0.008937663398683071,
-0.012943797744810581,
0.040436189621686935,
-0.034555841237306595,
0.03891339153051376,
0.010302325710654259,
0.006120483856648207,
0.03204907849431038,
-0.0004216984088998288,
0.022760000079870224,
0.005168733652681112,
0.024153947830200195,
-0.05130663886666298,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_where_tz(self):
i = pd.date_range('20130101', periods=3, tz='US/Eastern')
result = i.where(notna(i))
expected = i
tm.assert_index_equal(result, expected)
i2 = i.copy()
i2 = Index([pd.NaT, pd.NaT] + i[2:].tolist())
result = i.where(notna(i2))
expe... | |
13,755 | [
-0.018735958263278008,
-0.011010583490133286,
0.014141798950731754,
-0.04278471693396568,
0.017273014411330223,
0.016002561897039413,
0.01231311820447445,
0.016657037660479546,
-0.00009404071897733957,
0.007885784842073917,
0.06252163648605347,
-0.024382412433624268,
0.013192168436944485,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestTake(object):
def test_take(self):
# GH#10295
idx1 = pd.date_range('2011-01-01', '2011-01-31', freq='D', name='idx')
idx2 = pd.date_range('2011-01-01', '2011-01-31', freq='D',
tz='Asia/Tokyo', name='idx')
for idx in [idx1, idx2]:
re... | |
13,756 | [
-0.012397082522511482,
-0.008812913671135902,
0.015981251373887062,
-0.03552784398198128,
0.002554740523919463,
0.011072634719312191,
-0.0006390774506144226,
0.039971962571144104,
0.04034858196973801,
0.012359420768916607,
0.04953811690211296,
-0.05342985689640045,
0.012855304405093193,
-0... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_take_invalid_kwargs(self):
idx = pd.date_range('2011-01-01', '2011-01-31', freq='D', name='idx')
indices = [1, 6, 5, 9, 10, 13, 15, 3]
msg = r"take\(\) got an unexpected keyword argument 'foo'"
tm.assert_raises_regex(TypeError, msg, idx.take,
indi... | |
13,757 | [
-0.02191760018467903,
-0.03835882991552353,
0.026727600023150444,
-0.047615353018045425,
0.012709543108940125,
0.015011557377874851,
0.014175563119351864,
0.021735861897468567,
0.005715659353882074,
0.0018855315865948796,
0.06193630397319794,
0.009420085698366165,
0.0034348478075116873,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_take(self):
# GH#10295
idx1 = pd.date_range('2011-01-01', '2011-01-31', freq='D', name='idx')
idx2 = pd.date_range('2011-01-01', '2011-01-31', freq='D',
tz='Asia/Tokyo', name='idx')
for idx in [idx1, idx2]:
result = idx.take([0])
... | |
13,758 | [
0.004922179970890284,
-0.024235934019088745,
0.04530548304319382,
-0.055661700665950775,
-0.0018584651406854391,
0.014415380544960499,
0.014272536151111126,
0.009945541620254517,
-0.008261168375611305,
0.0209267046302557,
0.03852037340402603,
-0.015534328296780586,
0.009493201039731503,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tz", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def test_take2(self, tz):
dates = [datetime(2010, 1, 1, 14), datetime(2010, 1, 1, 15),
datetime(2010, 1, 1, 17), datetime(2010, 1, 1, 21)]
idx = DatetimeIndex(start='2010-01-01 09:00',
end='2010-02-01 09:00', freq='H', tz=tz,
name... | |
13,759 | [
-0.002700460609048605,
-0.014427592046558857,
0.01873827539384365,
-0.012561305426061153,
0.00926231313496828,
-0.03079059347510338,
0.020422331988811493,
0.027523020282387733,
0.0035597695969045162,
0.022408010438084602,
0.07510390877723694,
0.0037514253053814173,
-0.011625019833445549,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_take_fill_value(self):
# GH#12631
idx = pd.DatetimeIndex(['2011-01-01', '2011-02-01', '2011-03-01'],
name='xxx')
result = idx.take(np.array([1, 0, -1]))
expected = pd.DatetimeIndex(['2011-02-01', '2011-01-01', '2011-03-01'],
... | |
13,760 | [
-0.010274183005094528,
-0.015163627453148365,
0.03500080108642578,
-0.04462729021906853,
0.03327362239360809,
0.016065316274762154,
-0.018148092553019524,
0.05374578759074211,
0.004092528484761715,
-0.00435605039820075,
0.065785251557827,
0.005187890958040953,
0.022123148664832115,
-0.0055... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tz", "annotation": nul... | class TestDatetimeIndex(object):
@pytest.mark.parametrize('null', [None, np.nan, pd.NaT])
@pytest.mark.parametrize('tz', [None, 'UTC', 'US/Eastern'])
def test_insert_nat(self, tz, null):
# GH#16537, GH#18295 (test missing)
idx = pd.DatetimeIndex(['2017-01-01'], tz=tz)
expected = pd.D... | |
13,761 | [
-0.0069157034158706665,
-0.005075632128864527,
0.020364277064800262,
-0.00876812357455492,
-0.004353188443928957,
-0.010280934162437916,
0.03363995626568794,
0.03559117391705513,
0.004763808101415634,
0.0331953763961792,
0.06816907972097397,
0.008335892111063004,
-0.02096940018236637,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_take_fill_value_with_timezone(self):
idx = pd.DatetimeIndex(['2011-01-01', '2011-02-01', '2011-03-01'],
name='xxx', tz='US/Eastern')
result = idx.take(np.array([1, 0, -1]))
expected = pd.DatetimeIndex(['2011-02-01', '2011-01-01', '2011-03-01'],
... | |
13,762 | [
0.001682036672718823,
-0.003974356688559055,
0.034969527274370193,
-0.056855544447898865,
0.017075903713703156,
0.02298031747341156,
0.014899327419698238,
0.03114548698067665,
0.002615499310195446,
-0.01592147722840309,
0.04572013020515442,
0.0002034903591265902,
0.015416414476931095,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_insert(self):
idx = DatetimeIndex(
['2000-01-04', '2000-01-01', '2000-01-02'], name='idx')
result = idx.insert(2, datetime(2000, 1, 5))
exp = DatetimeIndex(['2000-01-04', '2000-01-01', '2000-01-05',
'2000-01-02'], name='idx')
tm.assert_i... | |
13,763 | [
0.0011324360966682434,
0.0053063626401126385,
0.03144511207938194,
-0.07719267904758453,
-0.014708196744322777,
0.047167666256427765,
-0.008748841471970081,
0.047116950154304504,
0.02827524021267891,
0.0120328264310956,
0.0650203749537468,
-0.018397925421595573,
0.00648555438965559,
-0.019... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_delete(self):
idx = date_range(start='2000-01-01', periods=5, freq='M', name='idx')
# prserve freq
expected_0 = date_range(start='2000-02-01', periods=4, freq='M',
name='idx')
expected_4 = date_range(start='2000-01-01', periods=4, freq='M',
... | |
13,764 | [
0.008852136321365833,
-0.023979052901268005,
0.01258569024503231,
-0.08078929036855698,
-0.006334998179227114,
0.03232535347342491,
-0.010387711226940155,
0.03331293910741806,
0.022714462131261826,
0.009610890410840511,
0.06845652312040329,
-0.030542880296707153,
0.001001887139864266,
0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_delete_slice(self):
idx = date_range(start='2000-01-01', periods=10, freq='D', name='idx')
# prserve freq
expected_0_2 = date_range(start='2000-01-04', periods=7, freq='D',
name='idx')
expected_7_9 = date_range(start='2000-01-01', periods=7, fr... | |
13,765 | [
-0.0565481036901474,
-0.024631047621369362,
0.07677492499351501,
-0.03613097593188286,
0.012859256006777287,
0.015537134371697903,
-0.006745671853423119,
0.02821967750787735,
0.0424654483795166,
0.02048509381711483,
0.03197142854332924,
-0.0026472939644008875,
0.01657022535800934,
-0.00136... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_get_loc(self):
idx = pd.date_range('2000-01-01', periods=3)
for method in [None, 'pad', 'backfill', 'nearest']:
assert idx.get_loc(idx[1], method) == 1
assert idx.get_loc(idx[1].to_pydatetime(), method) == 1
assert idx.get_loc(str(idx[1]), method) == 1
... | |
13,766 | [
-0.032602909952402115,
-0.020248832181096077,
0.062457479536533356,
-0.052999939769506454,
-0.0021505123004317284,
0.018686048686504364,
-0.001982108922675252,
0.05413161218166351,
0.0524071604013443,
0.023926764726638794,
0.0555596724152565,
0.008716563694179058,
-0.00006125676009105518,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_get_indexer(self):
idx = pd.date_range('2000-01-01', periods=3)
exp = np.array([0, 1, 2], dtype=np.intp)
tm.assert_numpy_array_equal(idx.get_indexer(idx), exp)
target = idx[0] + pd.to_timedelta(['-1 hour', '12 hours',
'1 day 1 hour'])
... | |
13,767 | [
0.03190562501549721,
-0.01796671375632286,
0.023091977462172508,
0.01651851460337639,
0.02194925956428051,
-0.05530308187007904,
0.03161145746707916,
0.05480526387691498,
0.006318897474557161,
-0.017683861777186394,
0.0033263310324400663,
-0.031679343432188034,
0.0069185420870780945,
-0.03... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def create(self, request, *args, **kwargs):
provider = get_provider()
form = provider.forms['account'](request.DATA)
if form.is_valid():
try:
provider = get_provider()
obj = provider.account_create(request.user, form.data)
except HttpClient... | |
13,768 | [
0.08519314974546432,
0.014598609879612923,
0.00699949124827981,
0.005382228177040815,
0.012592165730893612,
0.012465321458876133,
-0.022140072658658028,
0.04847753047943115,
0.00023332839191425592,
-0.04880040884017944,
0.035770054906606674,
-0.04340376704931259,
0.004903680179268122,
0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def destroy(self, request, *args, **kwargs):
account = self.get_object()
try:
account.cancel(disable_refs=True)
except CantCancel:
return Response(_('Cannot delete shared account'),
status=status.HTTP_409_CONFLICT)
log.info('Account can... | |
13,769 | [
0.04714082553982735,
0.001455100835300982,
-0.008652851916849613,
0.026724981144070625,
0.002874101744964719,
0.0036183136980980635,
0.049628935754299164,
0.05709327012300491,
-0.013351383619010448,
-0.01657259836792946,
0.011818529106676579,
-0.03829914331436157,
-0.02861328050494194,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def update(self, request, *args, **kwargs):
self.object = self.get_object()
form = BangoPaymentAccountForm(request.DATA, account=True)
if form.is_valid():
self.object.get_provider().account_update(self.object,
form.cleaned_data)
... | |
13,770 | [
-0.01661718636751175,
-0.0036373313050717115,
0.01789257489144802,
0.018276428803801537,
-0.013571115210652351,
0.0012452055234462023,
-0.013360614888370037,
0.018610754981637,
0.03316007927060127,
0.012431934475898743,
0.006389320828020573,
-0.05052021145820618,
0.006389320828020573,
0.03... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "attrs", "annotation": null, "type_comment": null}}], "kwarg": nul... | def validate(self, attrs):
if attrs['free'].premium_type not in mkt.ADDON_FREES:
raise ValidationError('Upsell must be from a free app.')
if attrs['premium'].premium_type in mkt.ADDON_FREES:
raise ValidationError('Upsell must be to a premium app.')
return attrs | |
13,771 | [
-0.01730109192430973,
-0.02568843588232994,
0.002952239941805601,
0.01136444229632616,
-0.03694174811244011,
0.0009343642159365118,
0.00936996191740036,
0.024495257064700127,
0.009796933270990849,
-0.006656065583229065,
-0.0017912302864715457,
-0.05905064940452576,
-0.009188645519316196,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "HyperlinkedRelatedField", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fie... | class UpsellSerializer(HyperlinkedModelSerializer):
free = premium = HyperlinkedRelatedField(view_name='app-detail')
class Meta:
model = AddonUpsell
fields = ('free', 'premium', 'created', 'modified', 'url')
view_name = 'app-upsell-detail'
def validate(self, attrs):
if attr... | |
13,772 | [
0.04008512943983078,
0.0045373509638011456,
-0.0013638975797221065,
0.02469044364988804,
0.016981765627861023,
-0.0029531039763242006,
-0.014431099407374859,
-0.004829260520637035,
0.0010145981796085835,
-0.03380482271313667,
0.013274798169732094,
-0.05786043405532837,
0.016539650037884712,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def check(self, request, app, account):
if AllowAppOwner().has_object_permission(request, '', app):
if account.shared or account.user.pk == request.user.pk:
return True
else:
log.info('AddonPaymentAccount access %(account)s denied '
... | |
13,773 | [
0.03773082420229912,
0.0051991925574839115,
-0.030901717022061348,
0.024798201397061348,
-0.04776107892394066,
0.02582256682217121,
-0.04810253530740738,
0.0333772674202919,
-0.015205437317490578,
-0.040142353624105453,
0.01748892106115818,
-0.07166296243667603,
0.008472362533211708,
0.009... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "UpsellPermission", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "targets": [... | class UpsellViewSet(CreateModelMixin, DestroyModelMixin, RetrieveModelMixin,
UpdateModelMixin, MarketplaceView, GenericViewSet):
permission_classes = (UpsellPermission,)
queryset = AddonUpsell.objects.filter()
serializer_class = UpsellSerializer
def pre_save(self, obj):
if n... | |
13,774 | [
0.022771501913666725,
0.014292986132204533,
-0.014005578123033047,
0.021632926538586617,
-0.019344720989465714,
0.025313951075077057,
-0.025535032153129578,
0.004308345727622509,
-0.005527063272893429,
-0.05960385128855705,
0.029138678684830666,
-0.057658325880765915,
-0.007583131082355976,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}], "kwarg": null,... | def pre_save(self, obj):
if not AddonPaymentAccountPermission().check(
self.request,
obj.addon, obj.payment_account):
raise PermissionDenied('Not allowed to alter that object.')
if self.request.method != 'POST':
addon = obj.__class__.objects.get(p... | |
13,775 | [
0.012043186463415623,
-0.03730899095535278,
0.013038670644164085,
-0.006551796570420265,
-0.0235886313021183,
0.011231651529669762,
-0.009646452032029629,
-0.003229911206290126,
0.011924161575734615,
-0.014337127096951008,
0.006600488908588886,
-0.06760631501674652,
-0.004890854004770517,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "HyperlinkedRelatedField", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fie... | class AddonPaymentAccountSerializer(HyperlinkedModelSerializer):
addon = HyperlinkedRelatedField(view_name='app-detail')
payment_account = HyperlinkedRelatedField(
view_name='payment-account-detail')
class Meta:
model = AddonPaymentAccount
fields = ('addon', 'payment_account', 'crea... | |
13,776 | [
-0.035706859081983566,
-0.034801680594682693,
-0.005335781257599592,
0.012410455383360386,
-0.023070108145475388,
-0.04378199204802513,
-0.05469175800681114,
0.0508328452706337,
-0.011808989569544792,
-0.0004183466953691095,
-0.009456719271838665,
-0.0779881626367569,
-0.03899408131837845,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def list(self, request, *args, **kwargs):
if not self.app:
return Response('', status=400)
client = get_client()
res = client.api.bango.debug.get(
data={'seller_product_bango':
self.app.payment_account(PROVIDER_BANGO).account_uri})
filtered = {
... | |
13,777 | [
-0.0011849085567519069,
-0.009102348238229752,
-0.001832564827054739,
-0.005386587232351303,
-0.06273756921291351,
0.004787452518939972,
-0.04079742357134819,
0.04291267693042755,
0.021895142272114754,
-0.03604935109615326,
0.02621566317975521,
-0.05252133682370186,
0.023942889645695686,
-... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Transaction"}}, {"... | class PaymentDebugViewSet(PaymentAppViewSet):
permission_classes = [GroupPermission('Transaction', 'Debug')]
form = PaymentCheckForm
def list(self, request, *args, **kwargs):
if not self.app:
return Response('', status=400)
client = get_client()
res = client.api.bango.d... | |
13,778 | [
-0.009159385226666927,
-0.03038562834262848,
0.002717004157602787,
-0.028413699939846992,
0.05046344920992851,
0.03159567713737488,
0.0102405846118927,
-0.011540264822542667,
0.041051968932151794,
0.00520992511883378,
-0.014655015431344509,
0.0391472652554512,
0.027786267921328545,
0.04129... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "input_param", "annotat... | class TestChannelPad(unittest.TestCase):
@parameterized.expand(TEST_CASES_3D)
def test_shape(self, input_param, input_shape, expected_shape):
net = ChannelPad(**input_param)
with eval_mode(net):
result = net(torch.randn(input_shape))
self.assertEqual(list(result.shape), l... | |
13,779 | [
0.0346456915140152,
0.03635776415467262,
0.014053263701498508,
-0.009339118376374245,
0.031911130994558334,
0.008102621883153915,
-0.020318973809480667,
-0.010956075973808765,
-0.000037084690120536834,
-0.01303077582269907,
0.02929546684026718,
-0.040851958096027374,
0.018083767965435982,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "account.invoice"}}, "targets": [{"_type": "Name", "_fields": {"id": "_inherit", "ctx": {"_type": "Store", "_fields": {}}}}], "type_commen... | class account_invoice(osv.osv):
_inherit = "account.invoice"
def _discount_all(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = {}
for invoice in self.browse(cr, uid, ids):
tot_disc = 0.0
for line in invoice.invoice_line:
tot_disc += line.d... | |
13,780 | [
0.034040648490190506,
0.03129037469625473,
-0.002566317329183221,
0.016079440712928772,
-0.002138095209375024,
-0.04055444896221161,
-0.005931782070547342,
0.011085526086390018,
-0.01616388000547886,
0.027261467650532722,
0.037032172083854675,
-0.04038557410240173,
0.00366702931933105,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def _total_all(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = {}
tot_all = 0.0
for invoice in self.browse(cr, uid, ids):
for line in invoice.invoice_line:
tot_all += line.total_wo_disc
res[invoice.id] = tot_all
return res | |
13,781 | [
0.03723245486617088,
0.02238103374838829,
-0.01518145389854908,
0.026915911585092545,
0.025106849148869514,
-0.006288935896009207,
0.00759072694927454,
0.04109504818916321,
0.0021635405719280243,
0.020364172756671906,
0.03222086280584335,
-0.043197471648454666,
-0.0002007310395129025,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def _discount_all(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = {}
for invoice in self.browse(cr, uid, ids):
tot_disc = 0.0
for line in invoice.invoice_line:
tot_disc += line.disc_amount
res[invoice.id] = tot_disc
return res | |
13,782 | [
0.005903258919715881,
0.025809047743678093,
0.018925849348306656,
-0.02168857306241989,
0.03034275211393833,
-0.0007652099593542516,
0.005599241238087416,
-0.023188002407550812,
0.019870370626449585,
-0.0027597735170274973,
0.03154701739549637,
-0.04134642705321312,
0.017957713454961777,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "account.invoice.line"}}, "targets": [{"_type": "Name", "_fields": {"id": "_inherit", "ctx": {"_type": "Store", "_fields": {}}}}], "type_c... | class account_invoice_line(osv.osv):
_inherit = "account.invoice.line"
def _discount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = {}
for line in self.browse(cr, uid, ids):
discount = line.price_unit * ((line.discount or 0.0)/100.0) * line.quantity
re... | |
13,783 | [
0.08393751084804535,
-0.0022725537419319153,
0.037423647940158844,
-0.014958152547478676,
-0.055536240339279175,
-0.009491587057709694,
0.01682368293404579,
-0.0009172185673378408,
-0.032358452677726746,
0.02978063002228737,
0.0732191950082779,
-0.021391402930021286,
-0.043325502425432205,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def finalize_options (self):
self.egg_name = safe_name(self.distribution.get_name())
self.vtags = self.tags()
self.egg_version = self.tagged_version()
try:
list(
parse_requirements('%s==%s' % (self.egg_name,self.egg_version))
)
except Valu... | |
13,784 | [
0.00968810822814703,
0.040252529084682465,
0.03710649907588959,
-0.07350461930036545,
-0.04233599454164505,
0.0039012867491692305,
0.016219768673181534,
-0.015334296971559525,
-0.020886728540062904,
0.01702190190553665,
0.00891201850026846,
-0.04458613321185112,
-0.03637728467583656,
0.009... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":... | def get_svn_revision():
revision = 0
urlre = re.compile('url="([^"]+)"')
revre = re.compile('committed-rev="(\d+)"')
for base,dirs,files in os.walk(os.curdir):
if '.svn' not in dirs:
dirs[:] = []
continue # no sense walking uncontrolled sub... | |
13,785 | [
0.06336347758769989,
0.026016026735305786,
0.07178111374378204,
-0.04976576939225197,
-0.03908185288310051,
-0.03653806447982788,
0.03427178040146828,
0.013724899850785732,
-0.06969983130693436,
0.006954951211810112,
0.02407349832355976,
-0.009510303847491741,
-0.002905123168602586,
-0.046... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def run(self):
self.mkpath(self.egg_info)
installer = self.distribution.fetch_build_egg
for ep in iter_entry_points('egg_info.writers'):
writer = ep.load(installer=installer)
writer(self, ep.name, os.path.join(self.egg_info,ep.name))
# Get rid of native_libs.txt ... | |
13,786 | [
0.06672213226556778,
0.02100146934390068,
0.0007493929588235915,
-0.0010963911190629005,
-0.019228776916861534,
-0.023537402972579002,
0.030800512060523033,
-0.0005493496428243816,
0.024694574996829033,
0.0017526870360597968,
-0.00026371091371402144,
-0.013405978679656982,
0.0153756355866789... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "item", "annotation": null, "type_comment": null}}], "kwarg": null... | def append(self, item):
if item.endswith('\r'): # Fix older sdists built on Windows
item = item[:-1]
path = convert_path(item)
if sys.version_info >= (3,):
try:
if os.path.exists(path) or os.path.exists(path.encode('utf-8')):
self.... | |
13,787 | [
0.026295648887753487,
0.011415706016123295,
0.03645585849881172,
-0.006399537902325392,
-0.028434641659259796,
-0.011764454655349255,
0.051521800458431244,
-0.020622670650482178,
-0.035897862166166306,
-0.004382607992738485,
0.02462165616452694,
0.007503908593207598,
0.007910782471299171,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def check_broken_egg_info(self):
bei = self.egg_name+'.egg-info'
if self.egg_base != os.curdir:
bei = os.path.join(self.egg_base, bei)
if os.path.exists(bei):
log.warn(
"-"*78+'\n'
"Note: Your current .egg-info directory has a '-' in its na... | |
13,788 | [
0.029456956312060356,
0.03311092033982277,
0.07793454825878143,
-0.03799121454358101,
-0.0494786761701107,
-0.016367757692933083,
0.0372404009103775,
0.03158426284790039,
-0.013739906251430511,
0.026503752917051315,
-0.008734475821256638,
-0.022048920392990112,
0.047851912677288055,
-0.009... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def add_defaults(self):
sdist.add_defaults(self)
self.filelist.append(self.template)
self.filelist.append(self.manifest)
rcfiles = list(walk_revctrl())
if rcfiles:
self.filelist.extend(rcfiles)
elif os.path.exists(self.manifest):
self.read_manifest... | |
13,789 | [
0.0032052770256996155,
0.07012160122394562,
0.03508545458316803,
-0.06662044674158096,
-0.023953281342983246,
-0.0376250222325325,
0.01663045585155487,
0.028379028663039207,
-0.012574547901749611,
0.04948454722762108,
0.003538132645189762,
-0.0003326630685478449,
0.042679496109485626,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def run(self):
self.filelist = FileList()
if not os.path.exists(self.manifest):
self.write_manifest() # it must exist so it'll get in the list
self.filelist.findall()
self.add_defaults()
if os.path.exists(self.template):
self.read_template()
self... | |
13,790 | [
0.029266661033034325,
0.00256367982365191,
0.00788605585694313,
-0.04420746490359306,
-0.021363524720072746,
-0.020133640617132187,
-0.010465393774211407,
0.028105106204748154,
0.0018946462078019977,
-0.002219198737293482,
0.033912885934114456,
-0.012686016038060188,
-0.025781992822885513,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"val... | def get_pkg_info_revision():
# See if we can get a -r### off of PKG-INFO, in case this is an sdist of
# a subversion revision
#
if os.path.exists('PKG-INFO'):
f = open('PKG-INFO','rU')
for line in f:
match = re.match(r"Version:.*-r(\d+)\s*$", line)
if match:
... | |
13,791 | [
0.06121212616562843,
0.03949093818664551,
0.0771113783121109,
-0.01332731544971466,
-0.019125865772366524,
-0.015010765753686428,
0.019242772832512856,
0.027239162474870682,
-0.01801525615155697,
0.049053873866796494,
0.025836287066340446,
-0.026748154312372208,
0.03677871450781822,
0.0092... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cmd", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "basename", "annotation": null, "type_comment": null}}, {"_type": "... | def write_entries(cmd, basename, filename):
ep = cmd.distribution.entry_points
if isinstance(ep,basestring) or ep is None:
data = ep
elif ep is not None:
data = []
for section, contents in ep.items():
if not isinstance(contents,basestring):
contents = Ent... | |
13,792 | [
-0.0046058837324380875,
0.02951926365494728,
-0.0030484360177069902,
-0.04038383066654205,
-0.025705106556415558,
0.06920961290597916,
0.024387488141655922,
-0.005334040615707636,
0.050578031688928604,
0.05302834138274193,
0.03227008134126663,
-0.05178007110953331,
0.012979691848158836,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
module = AnsibleModule(argument_spec=dict(
jid=dict(required=True),
mode=dict(default='status', choices=['status', 'cleanup']),
))
mode = module.params['mode']
jid = module.params['jid']
# setup logging directory
logdir = os.path.expanduser("~/.ansible_async")
... | |
13,793 | [
0.014167624525725842,
0.02881755121052265,
0.0014484134735539556,
-0.03219366446137428,
0.03723372146487236,
-0.015891853719949722,
0.0042864601127803326,
0.007945926859974861,
0.02684011124074459,
0.03055383823812008,
0.04171913117170334,
-0.018098386004567146,
0.021124832332134247,
0.026... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "isLeaf", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_... | class MacFeedResource(resource.Resource):
isLeaf = True
pathFromRoot = '/service/mac_feed'
def render_GET(self, request):
request.setHeader('Content-Type', 'application/rss+xml')
macdb = DbHelper()
items = macdb.fetch_several_latest(5)
output = """<?xml version="1.0" encoding="utf-8"?>
... | |
13,794 | [
0.019777439534664154,
-0.00015970329695846885,
-0.013094708323478699,
-0.02958616428077221,
0.01389466691762209,
-0.030103061348199844,
0.0035813534632325172,
0.007451923098415136,
0.01318085752427578,
0.030964555218815804,
0.028084702789783478,
-0.01057176198810339,
-0.01446079183369875,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def render_GET(self, request):
request.setHeader('Content-Type', 'application/rss+xml')
macdb = DbHelper()
items = macdb.fetch_several_latest(5)
output = """<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="h... | |
13,795 | [
0.03364480286836624,
0.01958630420267582,
0.03366558253765106,
-0.033166833221912384,
0.017622478306293488,
0.006031750235706568,
-0.015835292637348175,
-0.007309795822948217,
0.009995768778026104,
0.04210276156663895,
0.023087941110134125,
-0.05581836774945259,
0.005413508974015713,
0.043... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ABCMeta", "value": {"_type": "Name", "_fields": {"id": "abc", "ctx": {"_type": "Load", "_fields": {}}}}}}, "ta... | class Handler(object):
__metaclass__ = abc.ABCMeta
def __init__(self, frequency, version=2):
self.handler_version = version
self.frequency = frequency
def __repr__(self):
return "%s: [%s]" % (type_utils.obj_name(self), self.list_types())
@abc.abstractmethod
def list_types(... | |
13,796 | [
0.014748676680028439,
0.06274581700563431,
0.018852973356842995,
-0.03315103054046631,
-0.014285877346992493,
-0.00887234602123499,
0.003067566314712167,
0.0057849888689816,
0.04613376408815384,
0.02913198620080948,
0.050225879997015,
0.0158691368997097,
0.03276130557060242,
-0.01873118430... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pdata", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "_ctype", "annotation": null, "type_comment": null}}, {"_type": "... | def walker_handle_handler(pdata, _ctype, _filename, payload):
curcount = pdata['handlercount']
modname = PART_HANDLER_FN_TMPL % (curcount)
frequency = pdata['frequency']
modfname = os.path.join(pdata['handlerdir'], "%s" % (modname))
if not modfname.endswith(".py"):
modfname = "%s.py" % (modf... | |
13,797 | [
0.0056623732671141624,
0.04425070807337761,
0.02796894498169422,
-0.06053246930241585,
-0.012166714295744896,
0.03664511814713478,
-0.03903162106871605,
0.0029552513733506203,
0.06427950412034988,
0.030087804421782494,
0.02324054203927517,
-0.013906409032642841,
0.005754376295953989,
0.008... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mod", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def run_part(mod, data, filename, payload, frequency, headers):
mod_freq = mod.frequency
if not (mod_freq == PER_ALWAYS or
(frequency == PER_INSTANCE and mod_freq == PER_INSTANCE)):
return
# Sanity checks on version (should be an int convertable)
try:
mod_ver = mod.handler_ve... | |
13,798 | [
0.046150583773851395,
0.04213579371571541,
0.021438194438815117,
-0.009262274019420147,
0.008370639756321907,
-0.02905849739909172,
0.029565218836069107,
-0.013009085319936275,
0.002244920004159212,
0.02888309396803379,
0.013350147753953934,
-0.015922730788588524,
-0.01868046261370182,
-0.... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "blob", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "size", "annotation": null, "type_comment": null}}], "kwarg": null... | def _extract_first_or_bytes(blob, size):
# Extract the first line or upto X symbols for text objects
# Extract first X bytes for binary objects
try:
if isinstance(blob, six.string_types):
start = blob.split("\n", 1)[0]
else:
# We want to avoid decoding the whole blob ... | |
13,799 | [
0.008938475511968136,
0.048884134739637375,
0.005537840537726879,
-0.06928794831037521,
-0.0022434748243540525,
-0.04078400880098343,
-0.006618250627070665,
-0.004082533530890942,
0.051198456436395645,
0.030629334971308708,
0.03202265128493309,
-0.018148530274629593,
0.056110482662916183,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": ... | def walker_callback(data, filename, payload, headers):
content_type = headers['Content-Type']
if content_type in data.get('excluded'):
LOG.debug('content_type "%s" is excluded', content_type)
return
if content_type in PART_CONTENT_TYPES:
walker_handle_handler(data, content_type, fil... | |
13,800 | [
0.03152637556195259,
0.03589728847146034,
-0.011793328449130058,
0.022180059924721718,
-0.024970004335045815,
-0.016646670177578926,
0.01621655374765396,
0.018715878948569298,
0.03208436444401741,
0.04247690737247467,
0.044662363827228546,
0.01113652903586626,
0.031898368149995804,
-0.0147... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "msg", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "callback", "annotation": null, "type_comment": null}}, {"_type": "... | def walk(msg, callback, data):
partnum = 0
for part in msg.walk():
# multipart/* are just containers
if part.get_content_maintype() == 'multipart':
continue
ctype = part.get_content_type()
if ctype is None:
ctype = OCTET_TYPE
filename = part.get_... |