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 |
|---|---|---|---|---|---|
20,601 | [
0.01658031716942787,
0.015592371113598347,
0.02044619433581829,
-0.029380666092038155,
-0.03807888925075531,
0.033590178936719894,
0.012231205590069294,
0.026330919936299324,
-0.027898747473955154,
0.0018940113950520754,
-0.02308787778019905,
0.031356558203697205,
0.006335743237286806,
-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": "category", "annotation": null, "type_comment": null}}, {"_type": ... | def register_outputs(self, category, name, outputs, target_dir=None):
outputs_registry = self.bento_context.outputs_registry
# waf -> bento nodes translations
nodes = [self.bento_context.build_node.make_node(n.bldpath()) for n in outputs]
from_node = self.bento_context.build_node.find_n... | |
20,602 | [
0.0009988953825086355,
-0.007898744195699692,
0.037238698452711105,
-0.05505708232522011,
-0.014355751685798168,
0.010122961364686489,
-0.0035026802215725183,
0.0050368355587124825,
-0.003296277718618512,
0.03487277030944824,
0.000047701683797640726,
-0.033936258405447006,
0.0390131436288356... | 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 apply_register_outputs(self):
for x in self.features:
if x == "cprogram" and "cxx" in self.features:
x = "cxxprogram"
if x == "cshlib" and "cxx" in self.features:
x = "cxxshlib"
if x in waflib.Task.classes:
if issubclass(waflib.Task.classes[x], waflib... | |
20,603 | [
-0.011536302976310253,
0.04472823813557625,
0.04790974408388138,
0.003916728775948286,
-0.03120015189051628,
-0.026775451377034187,
0.003519040299579501,
-0.0015239148633554578,
-0.04411332681775093,
0.041118964552879333,
0.02970297262072563,
0.021201131865382195,
-0.01341446116566658,
-0.... | 12 | {"_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": "local_node", "annotati... | class BuildWafContext(BuildContext):
def pre_recurse(self, local_node):
super(BuildWafContext, self).pre_recurse(local_node)
self._old_path = self.waf_context.path
# Gymnastic to make a *waf* node from a *bento* node
self.waf_context.path = self.waf_context.path.make_node(self.local_... | |
20,604 | [
0.0040666828863322735,
0.012308333069086075,
0.03758673742413521,
0.010870556347072124,
-0.04420412331819534,
-0.03828456997871399,
0.005351056810468435,
-0.016723932698369026,
-0.05034023895859718,
0.07247839868068695,
0.013872441835701466,
0.006731683854013681,
-0.005745091941207647,
-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": "global_context", "annotation": null, "type_comment": null}}, {"_t... | def __init__(self, global_context, cmd_argv, options_context, pkg, run_node):
super(BuildWafContext, self).__init__(global_context, cmd_argv, options_context, pkg, run_node)
o, a = options_context.parser.parse_args(cmd_argv)
if o.jobs:
jobs = int(o.jobs)
else:
jo... | |
20,605 | [
0.007065813057124615,
0.014008528552949429,
0.06184433028101921,
-0.026564503088593483,
-0.028066296130418777,
-0.02311776578426361,
0.021406706422567368,
-0.02932189404964447,
-0.026145970448851585,
0.03513211011886597,
0.034319665282964706,
0.0008601458393968642,
-0.003714475780725479,
-... | 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 compile(self):
super(BuildWafContext, self).compile()
reg = self.builder_registry
for category in ("extensions", "compiled_libraries"):
for name, extension in self._node_pkg.iter_category(category):
builder = reg.builder(category, name)
self.pre_r... | |
20,606 | [
-0.027095649391412735,
-0.01260954700410366,
0.043481193482875824,
-0.005643973592668772,
-0.04320657625794411,
-0.03862961009144783,
-0.011265062727034092,
-0.003858956042677164,
-0.014623412862420082,
0.02535640262067318,
0.0042479983530938625,
-0.03565457835793495,
0.03975096717476845,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "extension", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kw", "annotation": null, "type_comment": null}}, "... | def _default_extension_builder(extension, **kw):
if not "features" in kw:
kw["features"] = "c cshlib pyext bento"
if not "source" in kw:
kw["source"] = extension.sources[:]
if not "name" in kw:
kw["name"] = extension.name
re... | |
20,607 | [
0.056917205452919006,
0.0162676852196455,
0.019605908542871475,
-0.019655145704746246,
-0.04978778213262558,
-0.013027934357523918,
0.004414037801325321,
-0.005632637068629265,
0.009074256755411625,
0.021920017898082733,
0.028163185343146324,
0.050378620624542236,
-0.0062628621235489845,
-... | 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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def rename(self, path, dest):
parent_dir = os.path.dirname(dest)
if parent_dir != '' and not self.exists(parent_dir):
self.mkdir(parent_dir)
if not isinstance(path, (list, tuple)):
path = [path]
else:
warnings.warn("Renaming multiple files at once is n... | |
20,608 | [
-0.04579133540391922,
-0.014967682771384716,
0.03188960254192352,
-0.027670225128531456,
-0.016255702823400497,
-0.05858270823955536,
-0.022962290793657303,
-0.01359083317220211,
-0.045924581587314606,
0.023250984027981758,
-0.005310307256877422,
-0.045280572026968,
0.01980886235833168,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "library", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kw", "annotation": null, "type_comment": null}}, "va... | def _default_library_builder(library, **kw):
if not "features" in kw:
kw["features"] = "c cstlib pyext bento"
if not "source" in kw:
kw["source"] = library.sources[:]
if not "name" in kw:
kw["name"] = library.base_name
if no... | |
20,609 | [
0.05719155818223953,
0.006580887362360954,
0.06923865526914597,
-0.002620565239340067,
0.03969968855381012,
-0.013258237391710281,
0.013033158145844936,
0.01261515449732542,
-0.008751294575631618,
0.0004247030592523515,
0.05689145252108574,
0.022422177717089653,
0.015294668264687061,
-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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def chown(self, path, owner, group, recursive=False):
if owner is None:
owner = ''
if group is None:
group = ''
ownership = "%s:%s" % (owner, group)
if recursive:
cmd = load_hadoop_cmd() + ['fs', '-chown', '-R', ownership, path]
else:
... | |
20,610 | [
0.053572867065668106,
0.02322085201740265,
0.04563944786787033,
-0.005016885232180357,
0.0035460826475173235,
0.020624663680791855,
-0.005977920722216368,
0.052369482815265656,
0.02339913137257099,
0.038731131702661514,
0.023332277312874794,
-0.015911409631371498,
0.01086945366114378,
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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def remove(self, path, recursive=True, skip_trash=False):
if recursive:
cmd = load_hadoop_cmd() + ['fs', '-rm', '-r']
else:
cmd = load_hadoop_cmd() + ['fs', '-rm']
if skip_trash:
cmd = cmd + ['-skipTrash']
cmd = cmd + [path]
self.call_check(c... | |
20,611 | [
0.049153223633766174,
0.009648007340729237,
0.07488124817609787,
0.005965486168861389,
0.03894936293363571,
0.005082078278064728,
0.024775130674242973,
0.022313499823212624,
0.028944022953510284,
-0.0064965239726006985,
0.03795677050948143,
-0.0005152180092409253,
0.0427212193608284,
-0.04... | 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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def mkdir(self, path, parents=True, raise_if_exists=False):
if parents and raise_if_exists:
raise NotImplementedError("HdfsClient.mkdir can't raise with -p")
try:
cmd = (load_hadoop_cmd() + ['fs', '-mkdir'] +
(['-p'] if parents else []) +
[pa... | |
20,612 | [
0.02933715470135212,
0.022887637838721275,
0.056718502193689346,
-0.01299216877669096,
0.014144700020551682,
-0.007025782950222492,
-0.007811599876731634,
0.029593273997306824,
0.00545997079461813,
0.05182897299528122,
0.038394421339035034,
-0.005276613403111696,
0.009301740676164627,
-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": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def count(self, path):
cmd = load_hadoop_cmd() + ['fs', '-count', path]
stdout = self.call_check(cmd)
lines = stdout.split('\n')
for line in stdout.split('\n'):
if line.startswith("OpenJDK 64-Bit Server VM warning") or line.startswith("It's highly recommended") or not line:
... | |
20,613 | [
0.0013810188975185156,
0.007676675915718079,
0.051170386373996735,
-0.031981490552425385,
-0.013508265838027,
-0.001147587550804019,
-0.019378993660211563,
-0.009264567866921425,
-0.016136115416884422,
0.07058292627334595,
0.02592066302895546,
-0.010041740722954273,
0.03318918123841286,
-0... | 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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def listdir(self, path, ignore_directories=False, ignore_files=False,
include_size=False, include_type=False, include_time=False, recursive=False):
if not path:
path = "." # default to current/home catalog
if recursive:
cmd = load_hadoop_cmd() + ['fs'] + self.re... | |
20,614 | [
0.05586880445480347,
0.031967587769031525,
0.045212939381599426,
-0.006937768775969744,
0.004113391973078251,
0.022881459444761276,
-0.0026167018804699183,
0.0533938929438591,
0.022446058690547943,
0.03558829054236412,
0.021174229681491852,
-0.012752661481499672,
0.01277557760477066,
0.015... | 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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def remove(self, path, recursive=True, skip_trash=False):
if recursive:
cmd = load_hadoop_cmd() + ['fs', '-rmr']
else:
cmd = load_hadoop_cmd() + ['fs', '-rm']
if skip_trash:
cmd = cmd + ['-skipTrash']
cmd = cmd + [path]
self.call_check(cmd) | |
20,615 | [
0.005482127889990807,
-0.04936881735920906,
0.05786067619919777,
-0.05559266358613968,
0.037290334701538086,
0.010298356413841248,
0.011445548385381699,
-0.00046027786447666585,
-0.0010581858223304152,
-0.006685360800474882,
0.003111923346295953,
-0.022205419838428497,
-0.005864525213837624,... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["deft_aliyun_1"]}}, {"_type": "... | def test():
global deft_aliyun_1
global deft_aliyun_2
global deft_aliyun_3
global deft_aliyun_4
global deft_aliyun_5
#get the default value
deft_aliyun_1 = conf_ops.get_global_config_default_value('aliyun', 'upload.ecs.image.format')
deft_aliyun_2 = conf_ops.get_global_config_default_va... | |
20,616 | [
-0.006141207180917263,
-0.0030492055229842663,
0.043031245470047,
-0.004445420578122139,
0.04116962477564812,
0.008997831493616104,
0.014507799409329891,
0.025549132376909256,
0.023088371381163597,
0.047589004039764404,
0.05708968639373779,
-0.0090780733153224,
0.01582377217710018,
0.00692... | 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": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def exists(self, path):
cmd = load_hadoop_cmd() + ['fs', '-test', '-e', path]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
stdout, stderr = p.communicate()
if p.returncode == 0:
return True
elif p.returncode == 1:
... | |
20,617 | [
0.05580051243305206,
-0.0182266216725111,
0.0629623532295227,
0.04446522891521454,
0.02558167465031147,
0.022631924599409103,
0.016384638845920563,
-0.018123574554920197,
0.018780505284667015,
0.0688876137137413,
0.021150609478354454,
-0.06378673762083054,
-0.02498914860188961,
0.051730114... | 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_show_answer_doesnt_write_to_csm(self):
self.basic_setup()
self.submit_question_answer('p1', {'2_1': u'Correct'})
# Now fetch the state entry for that problem.
student_module = StudentModule.objects.get(
course_id=self.course.id,
student=self.student_user... | |
20,618 | [
0.014775687828660011,
-0.03191841393709183,
0.05129396542906761,
0.006491053383797407,
0.0016715682577341795,
-0.04372920095920563,
0.04238706827163696,
0.022169632837176323,
0.00542344618588686,
0.019473159685730934,
0.030210241675376892,
-0.010657773353159428,
-0.024426858872175217,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
super(TestSubmittingProblems, self).setUp(create_user=False)
# Create course
self.course = CourseFactory.create(display_name=self.COURSE_NAME, number=self.COURSE_SLUG)
assert self.course, "Couldn't load course %r" % self.COURSE_NAME
# create a test student
... | |
20,619 | [
0.008071470074355602,
-0.00783742219209671,
0.04691067337989807,
-0.06705139577388763,
0.023594500496983528,
-0.027984468266367912,
-0.0037921990733593702,
-0.022633008658885956,
0.0503011979162693,
0.01814183034002781,
0.05839797109365463,
-0.03919343650341034,
0.0015687496634200215,
0.03... | 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_three_files(self):
# Open the test files, and arrange to close them later.
filenames = "prog1.py prog2.py prog3.py"
fileobjs = [
open(os.path.join(settings.COMMON_TEST_DATA_ROOT, "capa", filename))
for filename in filenames.split()
]
for fileobj i... | |
20,620 | [
0.009285271167755127,
-0.04049444943666458,
0.04290786013007164,
0.0081420773640275,
0.028224175795912743,
-0.006487622391432524,
0.028300387784838676,
0.02217795141041279,
0.014150193892419338,
0.04910650849342346,
0.025582127273082733,
-0.03251750022172928,
-0.022241462022066116,
0.01817... | 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_one_student(self):
# Basic test to make sure we have simple behavior right for a student
# Throw in a non-ASCII answer
self.submit_question_answer('p1', {'2_1': u'ⓤⓝⓘⓒⓞⓓⓔ'})
self.submit_question_answer('p2', {'2_1': 'Correct'})
distributions = grades.answer_distributio... | |
20,621 | [
0.014937682077288628,
-0.04371429979801178,
0.05203336104750633,
-0.027965642511844635,
0.020588362589478493,
0.009810211136937141,
0.019855868071317673,
0.0203921590000391,
0.007750066928565502,
0.039999499917030334,
0.037331122905015945,
-0.021909471601247787,
-0.036598626524209976,
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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_multiple_students(self):
# Our test class is based around making requests for a particular user,
# so we're going to cheat by creating another user and copying and
# modifying StudentModule entries to make them from other users. It's
# a little hacky, but it seemed the simpler w... | |
20,622 | [
0.006259213667362928,
-0.017090046778321266,
0.037076711654663086,
0.007109308149665594,
0.030477458611130714,
-0.0029643105808645487,
0.008223876357078552,
-0.0031862796749919653,
0.018676888197660446,
0.0485372431576252,
0.04599325731396675,
-0.02384042553603649,
-0.019344370812177658,
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_other_data_types(self):
# We'll submit one problem, and then muck with the student_answers
# dict inside its state to try different data types (str, int, float,
# none)
self.submit_question_answer('p1', {'2_1': u'Correct'})
# Now fetch the state entry for that problem.
... | |
20,623 | [
0.02732585184276104,
-0.02064371109008789,
0.0447218157351017,
0.022597335278987885,
-0.005123597104102373,
0.027724042534828186,
0.007329201325774193,
-0.007235875353217125,
0.00613773986697197,
0.0523621067404747,
0.04619014635682106,
-0.007578070741146803,
-0.01933714561164379,
0.025708... | 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_broken_state(self):
# Missing or broken state for a problem should be skipped without
# causing the whole answer_distribution call to explode.
# Submit p1
self.submit_question_answer('p1', {'2_1': u'Correct'})
# Now fetch the StudentModule entry for p1 so we can corrup... | |
20,624 | [
0.023051811382174492,
-0.002623215550556779,
0.025026937946677208,
-0.009446823969483376,
0.031394124031066895,
0.012701885774731636,
0.006259982939809561,
-0.013449055142700672,
0.000944519997574389,
0.03321331739425659,
0.04347878322005272,
-0.04293302446603775,
-0.031757961958646774,
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_missing_content(self):
# If there's a StudentModule entry for content that no longer exists,
# we just quietly ignore it (because we can't display a meaningful url
# or name for it).
self.submit_question_answer('p1', {'2_1': 'Incorrect'})
# Now fetch the state entry for... | |
20,625 | [
0.02014191634953022,
0.0072746267542243,
-0.0024461387656629086,
-0.0018720317166298628,
0.03120226413011551,
-0.009576261974871159,
0.016121864318847656,
0.06698697060346603,
0.03468075394630432,
0.008821200579404831,
0.030702361837029457,
-0.029994165524840355,
0.001662437105551362,
-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": "callback", "annotation": null, "type_comment": null}}], "kwarg": ... | def get_access_token(self, callback):
if not self.is_authorized():
callback(access_token=None)
else:
if self.access_token and time.time() < self.access_token_expires:
callback(access_token=self.access_token)
else:
self.forget_access_tok... | |
20,626 | [
-0.0002893720811698586,
0.014318560250103474,
-0.01633957214653492,
-0.04375183582305908,
-0.012505773454904556,
0.016413062810897827,
-0.011115563102066517,
0.013326426967978477,
-0.013865362852811813,
-0.00040649890433996916,
0.04838179051876068,
-0.050023093819618225,
-0.00790031719952821... | 12 | {"_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": "webservice", "annotati... | class OAuthManager(object):
def __init__(self, webservice):
self.webservice = webservice
@property
def setting(self):
config = get_config()
return config.setting
@property
def persist(self):
config = get_config()
return config.persist
@property
def... | |
20,627 | [
-0.007333178073167801,
0.01793619804084301,
-0.006161573808640242,
-0.026371749117970467,
0.009458042681217194,
0.025498371571302414,
0.006150922738015652,
0.05010206252336502,
-0.0017427614657208323,
0.026627371087670326,
0.021834444254636765,
-0.027649862691760063,
-0.027436843141913414,
... | 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": "callback", "annotation": null, "type_comment": null}}], "kwarg": ... | def refresh_access_token(self, callback):
log.debug("OAuth: refreshing access_token with a refresh_token %s", self.refresh_token)
path = "/oauth2/token"
url = QUrl()
url_query = QUrlQuery()
url_query.addQueryItem("grant_type", "refresh_token")
url_query.addQueryItem("refr... | |
20,628 | [
0.022887295112013817,
0.03451919183135033,
-0.01600128971040249,
-0.02853480912744999,
0.03259705752134323,
0.007406170014292002,
0.029248179867863655,
0.045100852847099304,
0.033746376633644104,
0.0062469434924423695,
0.0443478487432003,
-0.036897093057632446,
-0.003180442377924919,
-0.06... | 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": "callback", "annotation": null, "type_comment": null}}, {"_type": ... | def on_refresh_access_token_finished(self, callback, data, http, error):
access_token = None
try:
if error:
log.error("OAuth: access_token refresh failed: %s", data)
if self.webservice.http_response_code(http) == 400:
response = load_json(d... | |
20,629 | [
0.005884792655706406,
-0.01988440379500389,
-0.03210825473070145,
-0.021639518439769745,
-0.02469548024237156,
-0.01139791402965784,
-0.014422903768718243,
0.029857579618692398,
0.0019603068940341473,
0.021825354546308517,
0.06215167045593262,
-0.02161886915564537,
-0.007077237591147423,
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": "authorization_code", "annotation": null, "type_comment": null}}, ... | def exchange_authorization_code(self, authorization_code, scopes, callback):
log.debug("OAuth: exchanging authorization_code %s for an access_token", authorization_code)
path = "/oauth2/token"
url = QUrl()
url_query = QUrlQuery()
url_query.addQueryItem("grant_type", "authorizatio... | |
20,630 | [
0.021616308018565178,
-0.011182594113051891,
-0.01664739102125168,
-0.002518613589927554,
-0.004452797584235668,
0.003853187896311283,
-0.007772156037390232,
0.029469424858689308,
0.0275061447173357,
0.03203990310430527,
0.08387451618909836,
-0.04367789626121521,
-0.019126789644360542,
-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": "scopes", "annotation": null, "type_comment": null}}, {"_type": "a... | def on_exchange_authorization_code_finished(self, scopes, callback, data, http, error):
successful = False
try:
if error:
log.error("OAuth: authorization_code exchange failed: %s", data)
else:
self.set_refresh_token(data["refresh_token"], scopes)
... | |
20,631 | [
0.008554433472454548,
0.033732227981090546,
0.005952746141701937,
-0.0545879490673542,
-0.03601200133562088,
0.020306885242462158,
-0.0016412269324064255,
0.01491352915763855,
0.04897294566035271,
-0.01020093820989132,
0.007931717671453953,
-0.035252079367637634,
0.02290329709649086,
0.019... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "cp_mgmt_run_script", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Store", "_fields":... | class TestCheckpointRunScript(object):
module = cp_mgmt_run_script
@pytest.fixture(autouse=True)
def module_mock(self, mocker):
return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
@pytest.fixture
def connection_mock(self, mocker):
connection_... | |
20,632 | [
0.04509732872247696,
-0.0005747698596678674,
-0.018768446519970894,
-0.011462237685918808,
0.01577301137149334,
0.012766523286700249,
0.03585679829120636,
0.04200241342186928,
0.028849026188254356,
-0.001345735159702599,
0.04965127259492874,
-0.030860720202326775,
-0.021476497873663902,
-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": "callback", "annotation": null, "type_comment": null}}, {"_type": ... | def on_fetch_username_finished(self, callback, data, http, error):
successful = False
try:
if error:
log.error("OAuth: username fetching failed: %s", data)
else:
self.username = data["sub"]
log.debug("OAuth: got username %s", self.u... | |
20,633 | [
0.03445533663034439,
0.003028860315680504,
0.022500956431031227,
-0.01515175774693489,
0.019458675757050514,
-0.023467328399419785,
0.008035204373300076,
0.03257031366229057,
0.02961154654622078,
-0.012109476141631603,
0.042257893830537796,
0.014543301425874233,
-0.023670148104429245,
-0.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": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_pop_keyheap():
heap1 = KeyHeap(keyval_list)
heap2 = KeyHeap()
heap3 = KeyHeap()
heap2.update(keyval_dict)
heap3['b'] = -2
heap3['a'] = 10
heap3['c'] = 3
expected = [('b', -2), ('c', 3), ('a', 10)]
assert(expected == [i for i in pop_heap(heap1)])
assert(expected == [i fo... | |
20,634 | [
-0.011004573665559292,
-0.02491779439151287,
0.017864033579826355,
-0.02056071348488331,
0.0174283254891634,
-0.03212464228272438,
-0.009255853481590748,
0.004507224075496197,
0.01648625358939171,
-0.0027585034258663654,
0.04112142696976662,
0.0313238799571991,
0.011257755570113659,
-0.038... | 9 | {"_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 test_pop_heap():
heap1 = Heap(num_list)
heap2 = Heap()
heap3 = Heap()
heap2.extend(num_list)
for i in num_list:
heap3.push(i)
expected = [-2, 3, 10]
assert(expected == [i for i in pop_heap(heap1)])
assert(expected == [i for i in pop_heap(heap2)])
assert(expected == [i fo... | |
20,635 | [
0.02836042270064354,
-0.0037477838341146708,
-0.05106629431247711,
-0.04782259836792946,
-0.00262180482968688,
-0.008805099874734879,
-0.016130812466144562,
0.002603997476398945,
0.04913761094212532,
0.028623424470424652,
0.026716656982898712,
0.02603723481297493,
0.028667258098721504,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_RXParamSetupAns(device, cmd_payload):
assert len(cmd_payload) == 1, 'WRONG MAC CMD PAYLOAD OF RXParamSetupAns'
status = cmd_payload[0]
channel_ack = status & 0b1
RX2DataRate_ack = status >> 1 & 0b1
RX1DRoffset_ack = status >> 2 & 0b1
rfu = status >> 3
if channel_ack & RX1DRoffset... | |
20,636 | [
0.019200921058654785,
0.006508407648652792,
-0.041533034294843674,
-0.017132095992565155,
-0.0104447640478611,
-0.002205813303589821,
-0.022231467068195343,
-0.01680779457092285,
0.029030628502368927,
0.05640619993209839,
0.022477488964796066,
0.03480096906423569,
0.03983324393630028,
0.03... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_LinkADRAns(device, cmd_payload):
assert len(cmd_payload) == 1, 'WRONG MAC CMD PAYLOAD OF LinkADRAns'
cmd_payload = cmd_payload[0]
channel_mask_ack = cmd_payload & 0b1
data_rate_ack = cmd_payload >> 1 & 0b1
power_ack = cmd_payload >> 2 & 0b1
rfu = cmd_payload >> 3
if channel_mask_... | |
20,637 | [
0.05208844318985939,
-0.005071555729955435,
-0.03461749479174614,
-0.03651751950383186,
0.0028297603130340576,
0.004332979675382376,
-0.005731930024921894,
-0.006852827500551939,
0.0433761402964592,
0.039552923291921616,
0.030354030430316925,
0.03913584351539612,
0.015107501298189163,
0.03... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_NewChannelAns(device, cmd_payload):
assert len(cmd_payload) == 1, 'WRONG MAC CMD PAYLOAD OF NewChannelAns'
# logger.info(ConstLog.mac_cmd+'analyze_NewChannelAns')
status = cmd_payload[0]
ch_ack = status & 0b1
dr_ack = status >> 1 & 0b1
rfu = status >> 2
if ch_ack & dr_ack == 1:
... | |
20,638 | [
0.02806765027344227,
0.02077195793390274,
-0.02316826768219471,
-0.011038439348340034,
0.0038287548813968897,
-0.004558323882520199,
-0.01997714303433895,
-0.010504608042538166,
0.01608610898256302,
0.01178580243140459,
0.037629157304763794,
0.04719066247344017,
0.01951448991894722,
0.0373... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_PingSlotInfoReq(device, cmd_payload):
assert len(cmd_payload) == 1, "WRONG MAC CMD PAYLOAD OF PingSlotInfoReq"
datr = cmd_payload[0] & 0b1111
periodicity = cmd_payload[0] >> 4 & 0b111
rfu = cmd_payload[0] >> 7
Logger.info(action=Action.mac_cmd_get, type=IDType.device, id=hexlify(device.d... | |
20,639 | [
0.020071906968951225,
0.009537308476865292,
-0.023522304370999336,
-0.02808462269604206,
0.00825917162001133,
0.00008136122050927952,
-0.03874531760811806,
-0.005582535173743963,
0.04154231399297714,
0.02317841164767742,
0.04346811771392822,
0.04041893035173416,
0.008700501173734665,
0.040... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_PingSlotFreqAns(device, cmd_payload):
assert len(cmd_payload) == 1, "WRONG MAC CMD PAYLOAD OF PingSlotFreqAns"
status = cmd_payload[0]
ch_ack = status & 0b1
dr_ack = status >> 1 & 0b1
rfu = status >> 2
if ch_ack & dr_ack == 1:
Logger.info(action=Action.mac_cmd_get, type=IDTyp... | |
20,640 | [
0.048845529556274414,
0.008196445181965828,
-0.005485357716679573,
-0.03926482051610947,
-0.016703058034181595,
0.0026708808727562428,
0.008328553289175034,
-0.014083871617913246,
0.03912696987390518,
0.0016542230732738972,
0.013704778626561165,
0.022653665393590927,
0.011958654038608074,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_BeaconTimingReq(device, cmd_payload):
assert len(cmd_payload) == 0, "WRONG MAC CMD PAYLOAD OF BeaconTimingReq"
Logger.info(action=Action.mac_cmd_get, type=IDType.device, id=hexlify(device.dev_eui).decode(),
msg='BeaconTimingReq: %s' % cmd_payload)
##action ---- get the next beaco... | |
20,641 | [
0.04231743514537811,
0.005191566422581673,
-0.011470782570540905,
-0.03424415737390518,
-0.01832185685634613,
-0.0009138502646237612,
-0.030588755384087563,
-0.002333682030439377,
0.04929184913635254,
0.04281080141663551,
0.014262791723012924,
0.013163928873836994,
0.018265793099999428,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd_payload", "annotation": null, "type_comment": null}}], "kwa... | def analyze_BeaconFreqAns(device, cmd_payload):
assert len(cmd_payload) == 1, "WRONG MAC CMD PAYLOAD OF BeaconFreqAns"
status = cmd_payload[0]
freq_ack = status & 0b1
rfu = status >> 1
if freq_ack == 1:
Logger.info(action=Action.mac_cmd_get, type=IDType.device, id=hexlify(device.dev_eui).dec... | |
20,642 | [
0.029934968799352646,
-0.0221740510314703,
-0.02540314756333828,
-0.003211772767826915,
-0.011142460629343987,
0.03506271913647652,
-0.06291887164115906,
0.022257203236222267,
0.007629259489476681,
0.004753562156111002,
0.009971393272280693,
-0.018376745283603668,
-0.007525318302214146,
-0... | 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": "nodes", "annotation": ... | class QDBE(Charge):
def __init__(self, nodes, name, value, superComponent, **kwargs):
super(QDBE, self).__init__(nodes, name, value, superComponent,**kwargs)
for v in self.variableDict:
variableExpr = "".join((v, "=", self.variableDict[v]))
exec (variableExpr)
self... | |
20,643 | [
0.04109303280711174,
0.01297159492969513,
-0.017132295295596123,
-0.04380972683429718,
-0.02530684694647789,
0.02856198325753212,
0.0010937134502455592,
0.005246765445917845,
0.024462468922138214,
0.013779260218143463,
0.0037813421804457903,
-0.007776838261634111,
0.004732796456664801,
-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 reloadParams(self):
for v in self.variableDict:
variableExpr = "".join((v, "=", self.variableDict[v]))
exec(variableExpr)
self.UT = eval(self.paramDict.get("ut", "0.026"))
self.TF = eval(self.paramDict.get("tf", "2.67E-13"))
self.QTF = eval(self.paramDict.ge... | |
20,644 | [
0.009865101426839828,
0.01147261168807745,
-0.009027729742228985,
0.007554687559604645,
0.003945429343730211,
-0.007511902134865522,
-0.01940014399588108,
0.035524144768714905,
-0.013080122880637646,
0.03043879009783268,
0.013141244649887085,
-0.021881699562072754,
0.0011949364561587572,
-... | 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": "nodes", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, nodes, name, value, superComponent, **kwargs):
super(QDBE, self).__init__(nodes, name, value, superComponent,**kwargs)
for v in self.variableDict:
variableExpr = "".join((v, "=", self.variableDict[v]))
exec (variableExpr)
self.UT = eval(self.paramDict... | |
20,645 | [
0.019154991954565048,
0.01844472438097,
-0.012174406088888645,
0.008811740204691887,
0.02295047603547573,
0.007824026048183441,
0.006653196644037962,
0.026967918500304222,
-0.03276102617383003,
0.03613479062914848,
-0.004808169323951006,
-0.019965138286352158,
0.008506547659635544,
-0.0407... | 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": "nodes", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, nodes, name, value, superComponent, **kwargs):
super(QDBC, self).__init__(nodes, name, value, superComponent,**kwargs)
for v in self.variableDict:
variableExpr = "".join((v, "=", self.variableDict[v]))
exec(variableExpr)
self.TR = eval(self.paramDict.... | |
20,646 | [
0.03791901469230652,
-0.011235036887228489,
-0.03231678530573845,
0.01891057938337326,
-0.005342300049960613,
0.029356656596064568,
-0.03691599518060684,
0.027717575430870056,
-0.02232328988611698,
0.004596151411533356,
-0.0007572335307486355,
-0.008238211274147034,
0.011467443779110909,
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}}, {"_type": "arg", "_fields": {"arg": "nodes", "annotation": ... | class QDBC(Charge):
def __init__(self, nodes, name, value, superComponent, **kwargs):
super(QDBC, self).__init__(nodes, name, value, superComponent,**kwargs)
for v in self.variableDict:
variableExpr = "".join((v, "=", self.variableDict[v]))
exec(variableExpr)
self.... | |
20,647 | [
0.034170325845479965,
-0.02164980210363865,
-0.019651159644126892,
0.0020937384106218815,
-0.030534086748957634,
0.0405917689204216,
-0.040308088064193726,
0.013629446737468243,
-0.012062769383192062,
-0.019676949828863144,
0.022707147523760796,
-0.023854754865169525,
0.021765852347016335,
... | 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}}, {"_type": "arg", "_fields": {"arg": "nodes", "annotation": ... | class QDBEP(Charge):
def __init__(self, nodes, name, value, superComponent, **kwargs):
self.PCS = ParasitTransportCurrent(['0','0','0'], "0", "0", None,**kwargs)
super(QDBEP, self).__init__(nodes, name, value, superComponent,**kwargs)
if self.PCS.name == "0":
print (name+" ERRO... | |
20,648 | [
0.02705356292426586,
-0.0022178057115525007,
0.008101405575871468,
0.01609283685684204,
-0.001564072328619659,
0.00837023090571165,
0.007074983324855566,
0.022544635459780693,
-0.02117607370018959,
0.0037177265621721745,
0.016716022044420242,
-0.017351428046822548,
0.01599508337676525,
-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": "nodes", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, nodes, name, value, superComponent, **kwargs):
self.PCS = ParasitTransportCurrent(['0','0','0'], "0", "0", None,**kwargs)
super(QDBEP, self).__init__(nodes, name, value, superComponent,**kwargs)
if self.PCS.name == "0":
print (name+" ERROR: ParasitCurrentSource ha... | |
20,649 | [
0.020034464076161385,
-0.0011632031528279185,
0.018307145684957504,
0.028464267030358315,
0.005178915336728096,
-0.05561479926109314,
-0.06296198815107346,
0.045323871076107025,
-0.016664976254105568,
0.05347389727830887,
0.0035610743798315525,
-0.051819562911987305,
0.007943233475089073,
... | 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": "env", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def __call__(self, env, start_response):
req = Request(env)
if self.check_character(req):
return HTTPBadRequest(
request=req,
body=("Object/Container name contains forbidden chars from %s"
% self.forbidden_chars))(env, start_response)
... | |
20,650 | [
0.03101491928100586,
-0.01184302568435669,
0.02971673011779785,
-0.011075913906097412,
-0.029386281967163086,
-0.01870572566986084,
0.002479836344718933,
-0.0210188627243042,
-0.010072767734527588,
0.08416986465454102,
-0.017938613891601562,
-0.03988981246948242,
-0.0009212717413902283,
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": "app", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def __init__(self, app, conf):
self.app = app
self.conf = conf
self.forbidden_chars = self.conf.get('forbidden_chars',
FORBIDDEN_CHARS)
self.maximum_length = self.conf.get('maximum_length', MAX_LENGTH)
self.forbidden_regexp = self.conf... | |
20,651 | [
0.05102354288101196,
-0.010049066506326199,
-0.01485367026180029,
-0.008424974977970123,
-0.0029182895086705685,
-0.03365478664636612,
-0.0023473198525607586,
-0.027474215254187584,
-0.016184523701667786,
0.04773024469614029,
0.028399044647812843,
-0.00660915020853281,
-0.022038020193576813,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "i", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parentsize", "annotation": null, "type_comment": null}}], "kwarg": n... | def normalize(i, parentsize):
if isinstance(i, slice):
i = (i.start, i.stop, i.step)
if not isinstance(i, (tuple, list, Tuple)):
if (i < 0) == True:
i += parentsize
i = (i, i+1, 1)
i = list(i)
if len(i) == 2:
i.append(1)
start, stop, step = i
start = s... | |
20,652 | [
0.02565181814134121,
0.03124437853693962,
-0.031036389991641045,
0.011081123724579811,
0.025744257494807243,
-0.011924629099667072,
0.012733470648527145,
-0.06248875707387924,
-0.034641511738300323,
0.021376516669988632,
0.003096706001088023,
-0.02232401631772518,
0.05897607281804085,
0.04... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parent", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __new__(cls, parent, rowslice, colslice):
rowslice = normalize(rowslice, parent.shape[0])
colslice = normalize(colslice, parent.shape[1])
if not (len(rowslice) == len(colslice) == 3):
raise IndexError()
if ((0 > rowslice[0]) == True or
(parent.shape[0] < rowsl... | |
20,653 | [
0.004481081385165453,
-0.04823814705014229,
-0.013475175015628338,
-0.05304919183254242,
-0.03212328627705574,
-0.005832856521010399,
-0.002412173431366682,
0.000694514368660748,
0.0064661684446036816,
0.0393611378967762,
0.052325405180454254,
-0.022501202300190926,
-0.005540149286389351,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "s", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "var... | def slice_of_slice(s, t):
start1, stop1, step1 = s
start2, stop2, step2 = t
start = start1 + start2*step1
step = step1 * step2
stop = start1 + step1*stop2
if stop > stop1:
raise IndexError()
return start, stop, step | |
20,654 | [
0.02982618845999241,
-0.03567266836762428,
0.04471644386649132,
-0.01193275861442089,
0.005235569551587105,
-0.029460782185196877,
-0.00932924821972847,
0.038938477635383606,
0.0053754509426653385,
0.029095377773046494,
0.022438155487179756,
0.01236667763441801,
0.002968916203826666,
-0.00... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "worker", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def parallel(worker):
def wrapper(self, args):
pool = Pool(len(args))
results = pool.map(partial(worker, self), args)
pool.close()
pool.join()
return list(chain.from_iterable(results))
return wrapper | |
20,655 | [
0.013265404850244522,
-0.024935150519013405,
-0.011955535970628262,
-0.017159288749098778,
-0.029793575406074524,
-0.005665185395628214,
-0.02404205873608589,
-0.002369672991335392,
-0.03372318297624588,
0.016837775707244873,
0.03362791985273361,
-0.06177820637822151,
0.005724724847823381,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2000}}, "targets": [{"_type": "Name", "_fields": {"id": "MAT_APT_MAX_LIMIT", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": ... | class Collector(object):
MAT_APT_MAX_LIMIT = 2000
def __init__(self, params, count_url, find_url):
self.params = params
self.params['limit'] = self.MAT_APT_MAX_LIMIT
self.count_url = count_url
self.find_url = find_url
def collect(self):
self.params['filter'] = str(s... | |
20,656 | [
0.03981791436672211,
0.023253481835126877,
-0.027705315500497818,
-0.025129126384854317,
0.01865476183593273,
-0.01656443439424038,
-0.05608857423067093,
0.012553264386951923,
-0.0682915672659874,
0.03568245843052864,
0.022439949214458466,
-0.047365691512823105,
0.0023050098679959774,
0.00... | 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 collect(self):
self.params['filter'] = str(self.params.filter)
n_pages = self.count()
if n_pages:
pages = range(1, n_pages + 1)
params = [self.get_find_params(n) for n in pages]
data = self.find(params)
return data | |
20,657 | [
0.007492531090974808,
0.008097987622022629,
0.021517012268304825,
0.01750003732740879,
0.002448025858029723,
0.05691296234726906,
0.007707933895289898,
0.016929510980844498,
0.03357958048582077,
0.018117137253284454,
0.014053589664399624,
-0.05202273279428482,
0.0005421460373327136,
0.0127... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "current_group_members", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "new_group_members", "annotation": null, "type_co... | def compare_group_members(current_group_members, new_group_members):
# If new_attached_policies is None it means we want to remove all policies
if len(current_group_members) > 0 and new_group_members is None:
return False
if set(current_group_members) == set(new_group_members):
return True
... | |
20,658 | [
-0.0015114863635972142,
-0.03023545816540718,
0.021845633164048195,
-0.003298048861324787,
0.016286803409457207,
0.05038478970527649,
-0.0016963031375780702,
-0.019897177815437317,
0.020688021555542946,
0.042086657136678696,
0.017169339582324028,
-0.05606969818472862,
-0.01789141446352005,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "current_attached_policies", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "new_attached_policies", "annotation": null, ... | def compare_attached_group_policies(current_attached_policies, new_attached_policies):
# If new_attached_policies is None it means we want to remove all policies
if len(current_attached_policies) > 0 and new_attached_policies is None:
return False
current_attached_policies_arn_list = []
for po... | |
20,659 | [
0.026623012498021126,
-0.03444264084100723,
0.012948740273714066,
-0.012616204097867012,
-0.0035672015510499477,
0.025192102417349815,
-0.06130749732255936,
-0.05921151489019394,
0.045829471200704575,
0.028638381510972977,
0.001039803959429264,
-0.04635346680879593,
-0.005436455365270376,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_typ... | def convert_friendly_names_to_arns(connection, module, policy_names):
if not any([not policy.startswith('arn:') for policy in policy_names if policy is not None]):
return policy_names
allpolicies = {}
paginator = connection.get_paginator('list_policies')
policies = paginator.paginate().build_fu... | |
20,660 | [
-0.003279924625530839,
0.011136563494801521,
0.05271134153008461,
-0.017182864248752594,
0.004005028400570154,
0.056845564395189285,
0.023771781474351883,
0.0213429257273674,
0.025012049823999405,
0.026265235617756844,
0.03196271136403084,
-0.04059290140867233,
0.014275988563895226,
0.0106... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwar... | def create_or_update_group(connection, module):
params = dict()
params['GroupName'] = module.params.get('name')
managed_policies = module.params.get('managed_policy')
users = module.params.get('users')
purge_users = module.params.get('purge_users')
purge_policy = module.params.get('purge_policy... | |
20,661 | [
0.01176032517105341,
0.03263381868600845,
0.04195776581764221,
-0.0003347694000694901,
-0.04361921548843384,
0.05157928541302681,
-0.025318486616015434,
0.030005257576704025,
0.02648397907614708,
0.010997794568538666,
0.0286661796271801,
-0.04659494012594223,
0.02304949425160885,
0.0170732... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwar... | def destroy_group(connection, module):
params = dict()
params['GroupName'] = module.params.get('name')
try:
group = get_group(connection, module, params['GroupName'])
except ClientError as e:
module.fail_json(msg=e.message, exception=traceback.format_exc(),
**c... | |
20,662 | [
0.018567852675914764,
0.021130124107003212,
0.02000410482287407,
0.032447781413793564,
-0.00904263649135828,
0.03217202425003052,
-0.0422142893075943,
0.042490050196647644,
-0.004716648254543543,
-0.04862571507692337,
0.019636424258351326,
-0.040536750108003616,
0.008002790622413158,
-0.02... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_typ... | def get_group(connection, module, name):
try:
paginator = connection.get_paginator('get_group')
return paginator.paginate(GroupName=name).build_full_result()
except ClientError as e:
if e.response['Error']['Code'] == 'NoSuchEntity':
return None
else:
raise | |
20,663 | [
0.0005563690210692585,
0.017705323174595833,
0.013984798453748226,
0.010838765650987625,
-0.037599191069602966,
0.030946016311645508,
-0.07020849734544754,
0.014203652739524841,
0.02794771082699299,
0.0021639231126755476,
0.018274344503879547,
-0.06692568212747574,
0.011074034497141838,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_typ... | def get_attached_policy_list(connection, module, name):
try:
paginator = connection.get_paginator('list_attached_group_policies')
return paginator.paginate(GroupName=name).build_full_result()['AttachedPolicies']
except ClientError as e:
if e.response['Error']['Code'] == 'NoSuchEntity':
... | |
20,664 | [
0.035337209701538086,
0.02224099077284336,
0.040327321738004684,
0.006034421268850565,
-0.006587623618543148,
0.06552625447511673,
0.008213360793888569,
0.036556512117385864,
0.03504367545247078,
0.05279130861163139,
0.037143584340810776,
-0.07324850559234619,
0.031905096024274826,
0.00498... | 10 | {"_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 = ec2_argument_spec()
argument_spec.update(
dict(
name=dict(required=True, type='str'),
managed_policy=dict(default=[], type='list'),
users=dict(default=[], type='list'),
state=dict(choices=['present', 'absent'], required=True),
... | |
20,665 | [
0.017013510689139366,
0.02584330551326275,
0.008183714002370834,
-0.051471251994371414,
-0.003895340021699667,
0.03049510158598423,
-0.021546855568885803,
0.03023666888475418,
-0.030064379796385765,
0.036202166229486465,
-0.005109436810016632,
-0.023022077977657318,
0.0012450551148504019,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "dsk", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "keys", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def _toposort(dsk, keys=None, returncycle=False):
# Stack-based depth-first search traversal. This is based on Tarjan's
# method for topological sorting (see wikipedia for pseudocode)
if keys is None:
keys = dsk
elif not isinstance(keys, list):
keys = [keys]
if not returncycle:
... | |
20,666 | [
0.007411044556647539,
0.024630313739180565,
0.021291589364409447,
-0.04221349209547043,
0.020332716405391693,
0.013666820712387562,
-0.006602356676012278,
0.01939694955945015,
0.003832601709291339,
-0.00030018918914720416,
0.05083179473876953,
-0.02576247602701187,
0.027587801218032837,
-0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "d", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "task", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def _get_task(d, task, maxdepth=1000):
# non-recursive. DAG property is checked upon reaching maxdepth.
_iter = lambda *args: iter(args)
# We construct a nested heirarchy of tuples to mimic the execution stack
# of frames that Python would maintain for a recursive implementation.
# A frame is asso... | |
20,667 | [
0.04427548497915268,
0.0372450165450573,
0.08069753646850586,
-0.039173103868961334,
-0.010334081016480923,
-0.004729106090962887,
0.028357001021504402,
-0.006754186004400253,
0.013332023285329342,
0.017094146460294724,
0.026334859430789948,
-0.04474575072526932,
0.02254922315478325,
0.025... | 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": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,... | def forwards(self, orm):
# Removing M2M table for field assignments on 'Test'
db.delete_table(db.shorten_name(u'exams_test_assignments'))
# Adding field 'Assignment.test'
db.add_column(u'exams_assignment', 'test',
self.gf('django.db.models.fields.related.ForeignKey... | |
20,668 | [
0.012945675291121006,
0.01459186989814043,
0.07058882713317871,
-0.0382707342505455,
0.0009440926369279623,
-0.029473470523953438,
-0.002866024849936366,
-0.028735974803566933,
-0.0009309230954386294,
0.031843990087509155,
0.005850575864315033,
-0.05683980882167816,
0.004283398389816284,
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}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": nu... | class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field assignments on 'Test'
db.delete_table(db.shorten_name(u'exams_test_assignments'))
# Adding field 'Assignment.test'
db.add_column(u'exams_assignment', 'test',
self.gf('dja... | |
20,669 | [
0.04941916838288307,
0.027574462816119194,
0.08909774571657181,
-0.026762746274471283,
-0.00023967251763679087,
0.005195578094571829,
0.04464436694979668,
-0.010641832835972309,
-0.007776953279972076,
0.0177741888910532,
0.017237024381756783,
-0.02289515919983387,
0.0358826145529747,
0.016... | 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": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,... | def backwards(self, orm):
# Adding M2M table for field assignments on 'Test'
m2m_table_name = db.shorten_name(u'exams_test_assignments')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('test', models.For... | |
20,670 | [
0.06100389361381531,
0.013907181099057198,
0.0014424434630200267,
-0.03299755975604057,
0.017885232344269753,
-0.011464892886579037,
0.012232773937284946,
0.030587267130613327,
-0.030587267130613327,
-0.018045207485556602,
-0.012531394138932228,
-0.054178282618522644,
-0.00691626314073801,
... | 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": "node", "annotation": null, "type_comment": null}}], "kwarg": null... | def select(self, node):
if SCons.Util.is_Dict(self.function):
key = node.scanner_key()
try:
return self.function[key]
except KeyError:
return None
else:
return self | |
20,671 | [
0.01132346410304308,
0.03706665337085724,
0.06860426813364029,
-0.073337122797966,
-0.0050756544806063175,
-0.0010919844498857856,
0.020490605384111404,
-0.02250317484140396,
-0.04078216478228569,
0.015050034038722515,
-0.012064355425536633,
-0.0031736663077026606,
0.03719934821128845,
-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": "node", "annotation": null, "type_comment": null}}, {"_type": "arg... | def scan(self, node, path=()):
# cache the includes list in node so we only scan it once:
if node.includes is not None:
includes = node.includes
else:
includes = self.find_include_names (node)
# Intern the names of the include files. Saves some memory
... | |
20,672 | [
0.0556376650929451,
0.05658213421702385,
0.05168807879090309,
-0.012331727892160416,
-0.023053569719195366,
0.004703550599515438,
-0.007110330741852522,
-0.007636226713657379,
-0.025650853291153908,
0.10414890199899673,
-0.001469021080993116,
-0.0027985188644379377,
0.011805832386016846,
-... | 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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg... | def __init__(self, name, suffixes, path_variable, regex, *args, **kw):
self.cre = re.compile(regex, re.M)
def _scan(node, env, path=(), self=self):
node = node.rfile()
if not node.exists():
return []
return self.scan(node, path)
kw['function... | |
20,673 | [
0.0077537973411381245,
-0.008224697783589363,
-0.01638518087565899,
-0.027890125289559364,
0.012585874646902084,
0.0034728879109025,
0.008133728057146072,
0.01841861382126808,
-0.0038768986705690622,
-0.0062287235632538795,
0.016620632261037827,
0.035852618515491486,
0.016085518524050713,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment"... | def wrapper(*args, **kwargs):
# NOTE(dtantsur): this code could be written simpler, but then unit
# testing decorated functions is pretty hard, as we usually pass a Mock
# object instead of TaskManager there.
if len(args) > 1:
task = args[1] if isinstance(args[1], TaskManager... | |
20,674 | [
0.014393122866749763,
-0.021807102486491203,
0.0493975467979908,
-0.051745668053627014,
0.0012848090846091509,
-0.002702787285670638,
0.021839715540409088,
-0.01808924227952957,
-0.01192541979253292,
0.023807356134057045,
-0.011034002527594566,
-0.0026987106539309025,
0.06139906123280525,
... | 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": "include", "annotation": null, "type_comment": null}}, {"_type": "... | def find_include(self, include, source_dir, path):
if include[0] == '"':
paths = (source_dir,) + tuple(path)
else:
paths = tuple(path) + (source_dir,)
n = SCons.Node.FS.find_file(include[1], paths)
i = SCons.Util.silent_intern(include[1])
return n, i | |
20,675 | [
-0.0030585993081331253,
0.03616924211382866,
0.06593109667301178,
-0.01715601421892643,
-0.007823513820767403,
0.01536844577640295,
0.003105029696598649,
0.023981275036931038,
0.02809036150574684,
0.035263851284980774,
0.019930226728320122,
0.0012267768615856767,
-0.010081189684569836,
-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 portgroups(self):
try:
if self._portgroups is None:
self._portgroups = objects.Portgroup.list_by_node_id(
self.context, self.node.id)
except Exception:
with excutils.save_and_reraise_exception():
self.release_resources()
... | |
20,676 | [
0.016820227727293968,
0.047403570264577866,
0.05782943218946457,
-0.009883862920105457,
0.007825486361980438,
-0.007971643470227718,
-0.021521609276533127,
0.011978779919445515,
0.03515074402093887,
0.023738322779536247,
0.019280536100268364,
-0.024188974872231483,
0.007922924123704433,
-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 ports(self):
try:
if self._ports is None:
self._ports = objects.Port.list_by_node_id(self.context,
self.node.id)
except Exception:
with excutils.save_and_reraise_exception():
self.relea... | |
20,677 | [
0.002397013595327735,
0.05965900793671608,
0.03164002671837807,
-0.02903463877737522,
-0.03585722669959068,
-0.016758395358920097,
0.01568753644824028,
0.05506645515561104,
0.016614878550171852,
-0.0008272940176539123,
0.01308214757591486,
0.008042484521865845,
-0.025744782760739326,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def volume_targets(self):
try:
if self._volume_targets is None:
self._volume_targets = objects.VolumeTarget.list_by_node_id(
self.context, self.node.id)
except Exception:
with excutils.save_and_reraise_exception():
self.release_... | |
20,678 | [
-0.0022426526993513107,
0.02470298856496811,
-0.014143362641334534,
-0.0258750282227993,
-0.026213116943836212,
0.000928334251511842,
0.029864471405744553,
0.033312972635030746,
0.03660369664430618,
0.008063406683504581,
0.021141791716217995,
0.01812153495848179,
0.021153060719370842,
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 volume_connectors(self):
try:
if self._volume_connectors is None:
self._volume_connectors = \
objects.VolumeConnector.list_by_node_id(
self.context, self.node.id)
except Exception:
with excutils.save_and_reraise_exce... | |
20,679 | [
0.017443114891648293,
0.025501903146505356,
-0.004542599897831678,
-0.013231898657977581,
-0.009425381198525429,
0.01588297076523304,
0.045185524970293045,
0.020317064598202705,
0.04574858397245407,
0.026792248710989952,
0.030874429270625114,
0.013513428159058094,
-0.010885816998779774,
-0... | 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": "exc_type", "annotation": null, "type_comment": null}}, {"_type": ... | def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is None and self._spawn_method is not None:
# Spawn a worker to complete the task
# The linked callback below will be called whenever:
# - background task finished with no errors.
# - background task h... | |
20,680 | [
-0.0024657591711729765,
0.040294814854860306,
0.016189424321055412,
0.014414716511964798,
-0.025829026475548744,
0.011956936679780483,
0.029544422402977943,
0.04775114357471466,
0.0022120014764368534,
-0.02197318524122238,
0.033834364265203476,
0.001836950657889247,
-0.015091403387486935,
... | 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 _lock(self):
self._debug_timer.restart()
if self._patient:
stop_after = tenacity.stop_never
elif self._retry:
stop_after = tenacity.stop_after_attempt(
CONF.conductor.node_locked_retry_attempts)
else:
stop_after = tenacity.stop_aft... | |
20,681 | [
-0.02686353214085102,
0.009148063138127327,
0.0016529508866369724,
-0.0348174162209034,
-0.04233307018876076,
0.031136279925704002,
-0.03749062493443489,
0.023664450272917747,
0.012993535958230495,
0.04261792078614235,
-0.009619160555303097,
-0.03286729007959366,
0.002916972152888775,
0.05... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "model_base", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def model(model_base):
class MyAuth(Authorizer):
def authorize(self, session, auth_token, uri, path, method):
if auth_token == '1' and uri == '/' and method == 'GET':
return True
if auth_token == '2':
return False
class model(model_base):
... | |
20,682 | [
-0.002972494810819626,
0.05367409437894821,
-0.006061672233045101,
-0.014013606123626232,
0.003340045688673854,
-0.03325460106134415,
-0.004101401194930077,
0.042542554438114166,
-0.007759407162666321,
0.0005535141099244356,
0.026743700727820396,
0.03283454477787018,
-0.007368519902229309,
... | 10 | {"_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 reserve_node():
self.node = objects.Node.reserve(self.context, CONF.host,
self.node_id)
LOG.debug("Node %(node)s successfully reserved for %(purpose)s "
"(took %(time).2f seconds)",
{'node': self.node.uu... | |
20,683 | [
-0.034754250198602676,
0.00817092228680849,
0.02526974491775036,
0.005574372131377459,
0.020961644127964973,
0.01798938773572445,
-0.009651483967900276,
0.00693526491522789,
0.030345959588885307,
-0.0010888533433899283,
0.039563294500112534,
-0.01310241874307394,
-0.01670920103788376,
0.06... | 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": "app", "annotation": nu... | class TestAuthorizationHook(object):
def test_without_header(self, app, model, client):
resp = client.get('/')
assert resp.status_code == 401
assert resp.headers.get('WWW-Authenticate') == 'Basic realm="test"'
assert resp.body == json.dumps(
{'error': 'Authorization head... | |
20,684 | [
0.05307173728942871,
0.03352350741624832,
0.030458377674221992,
-0.05645838379859924,
0.03354493901133537,
0.016054416075348854,
0.0024354911874979734,
0.016375932842493057,
-0.023406436666846275,
-0.02912943996489048,
0.0029177668038755655,
-0.03613851219415665,
0.023492176085710526,
-0.0... | 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 _iLocIndexer(_IndexerBase):
@property
def _meta_indexer(self):
return self.obj._meta.iloc
def __getitem__(self, key):
# dataframe
msg = (
"'DataFrame.iloc' only supports selecting columns. "
"It must be used like 'df.iloc[:, column_indexer]'."
... | |
20,685 | [
0.04607636481523514,
-0.01386159285902977,
0.037200648337602615,
-0.023553961887955666,
0.038747988641262054,
0.010858247987926006,
0.01068094838410616,
0.0339985117316246,
-0.016483474522829056,
-0.033633168786764145,
-0.0158817321062088,
-0.031269174069166183,
0.04023085534572601,
-0.023... | 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": "key", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __getitem__(self, key):
if isinstance(key, tuple):
# multi-dimensional selection
if len(key) > self.obj.ndim:
# raise from pandas
msg = "Too many indexers"
raise pd.core.indexing.IndexingError(msg)
iindexer = key[0]
... | |
20,686 | [
0.07404115796089172,
-0.011485771276056767,
0.0030940163414925337,
-0.0390751026570797,
0.051108747720718384,
0.029585156589746475,
-0.026493584737181664,
0.040425218641757965,
-0.019645169377326965,
-0.040699154138565063,
0.003727494738996029,
-0.040112148970365524,
0.03823372721672058,
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": "key", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __getitem__(self, key):
# dataframe
msg = (
"'DataFrame.iloc' only supports selecting columns. "
"It must be used like 'df.iloc[:, column_indexer]'."
)
if not isinstance(key, tuple):
raise NotImplementedError(msg)
if len(key) > 2:
... | |
20,687 | [
0.04104853793978691,
0.03535379469394684,
0.03679680824279785,
-0.032596610486507416,
-0.018707619979977608,
0.019094141200184822,
0.015615452080965042,
-0.020807718858122826,
-0.02576807141304016,
-0.009096129797399044,
-0.003981166984885931,
-0.04550641402602196,
0.05694743990898132,
-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": "iindexer", "annotation": null, "type_comment": null}}, {"_type": ... | def _loc_element(self, iindexer, cindexer):
name = "loc-%s" % tokenize(iindexer, self.obj)
part = self._get_partitions(iindexer)
if iindexer < self.obj.divisions[0] or iindexer > self.obj.divisions[-1]:
raise KeyError("the label [%s] is not in the index" % str(iindexer))
ds... | |
20,688 | [
0.03171441704034805,
0.02248193882405758,
0.04527996852993965,
-0.04422633349895477,
-0.01522502675652504,
0.002897496335208416,
0.00862005166709423,
-0.015106492675840855,
-0.0020364790689200163,
-0.000041543473344063386,
0.008646393194794655,
-0.058160655200481415,
0.04035422205924988,
-... | 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": "iindexer", "annotation": null, "type_comment": null}}, {"_type": ... | def _loc_list(self, iindexer, cindexer):
name = "loc-%s" % tokenize(iindexer, self.obj)
parts = self._get_partitions(iindexer)
meta = self._make_meta(iindexer, cindexer)
if len(iindexer):
dsk = {}
divisions = []
items = sorted(parts.items())
... | |
20,689 | [
0.0024182330816984177,
-0.00468624709174037,
0.045148205012083054,
-0.025213245302438736,
-0.004762829281389713,
-0.014456379227340221,
0.017625708132982254,
-0.03659455105662346,
-0.033413439989089966,
-0.02483622543513775,
0.01221782062202692,
-0.01755501702427864,
-0.05301850661635399,
... | 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 StudentBatch(Document):
def autoname(self):
prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
if not prog_abb:
prog_abb = self.program
self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
def validate(self):
validate_duplicate_student(self.st... | |
20,690 | [
0.0365472137928009,
0.010901105590164661,
0.034373700618743896,
-0.04677077382802963,
-0.01819310523569584,
0.021024039015173912,
0.005209051072597504,
-0.0067821647971868515,
-0.015482923947274685,
0.00411894079297781,
0.018689526244997978,
-0.03426636755466461,
0.04218224436044693,
-0.05... | 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": "iindexer", "annotation": null, "type_comment": null}}, {"_type": ... | def _loc_slice(self, iindexer, cindexer):
name = "loc-%s" % tokenize(iindexer, cindexer, self)
assert isinstance(iindexer, slice)
assert iindexer.step in (None, 1)
if iindexer.start is not None:
start = self._get_partitions(iindexer.start)
else:
start = ... | |
20,691 | [
0.010010694153606892,
-0.011259058490395546,
0.06111041083931923,
0.0004937727353535593,
-0.03733203932642937,
-0.03928186744451523,
-0.028938276693224907,
-0.039923883974552155,
-0.0033289717976003885,
0.06168109178543091,
-0.04144569858908653,
-0.00946379080414772,
0.0026468297000974417,
... | 12 | {"_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 location(self):
if self._location is None:
split_location = []
if self.city:
split_location.append(self.city)
if self.state_prov:
if self.postalcode:
split_location.append(self.state_prov + ' ' + self.postalcode)
... | |
20,692 | [
0.0327630415558815,
-0.004899146500974894,
0.021975498646497726,
-0.015203841961920261,
-0.06420708447694778,
0.028806040063500404,
0.02116289921104908,
-0.0016752489609643817,
-0.05506829172372818,
0.002137488219887018,
0.0050345794297754765,
-0.017147012054920197,
-0.005455600097775459,
... | 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": "kw", "annotation": null, "type_comment": null}}, "varar... | def __init__(self, *args, **kw):
# store set of affected references referenced keys for cache clearing
# keys must be model properties
self._affected_references = {
'key': set(),
}
self._location = None
self._city_state_country = None
super(Team, self)... | |
20,693 | [
0.009467466734349728,
0.017069367691874504,
-0.009635033085942268,
-0.044103316962718964,
0.01600811816751957,
-0.02698926255106926,
0.038383737206459045,
-0.03775815665721893,
-0.03688681498169899,
0.022721922025084496,
-0.013058960437774658,
-0.03389297425746918,
0.006456868257373571,
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_meta_translated_fields(self):
assert not hasattr(UntranslatedModel._meta, 'translated_fields')
eq_(set(TranslatedModel._meta.translated_fields),
set([TranslatedModel._meta.get_field('no_locale'),
TranslatedModel._meta.get_field('name'),
TranslatedM... | |
20,694 | [
-0.012644312344491482,
-0.01066790521144867,
0.04609661176800728,
0.027916014194488525,
-0.020174598321318626,
-0.01618659682571888,
-0.016784796491265297,
-0.01778179593384266,
-0.02011595107614994,
0.05470600351691246,
-0.07619429379701614,
-0.006580203305929899,
-0.005726887844502926,
-... | 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 city_state_country(self):
if not self._city_state_country and self.nl:
self._city_state_country = self.nl.city_state_country
if not self._city_state_country:
location_parts = []
if self.city:
location_parts.append(self.city)
if self.st... | |
20,695 | [
0.016646599397063255,
0.02332359366118908,
-0.021946894004940987,
-0.033132582902908325,
-0.004494352266192436,
-0.029438437893986702,
0.025308337062597275,
-0.01101360097527504,
-0.0383869893848896,
0.0016663807909935713,
0.014673328958451748,
-0.019939206540584564,
0.005509668495506048,
... | 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_create_translation(self):
o = TranslatedModel.objects.create(name='english name')
def get_model():
return TranslatedModel.objects.get(id=o.id)
self.trans_eq(o.name, 'english name', 'en-US')
eq_(o.description, None)
# Make sure the translation id is stored ... | |
20,696 | [
0.030831225216388702,
-0.009503854438662529,
-0.029997948557138443,
-0.037857770919799805,
-0.004794154316186905,
-0.005055960733443499,
0.03299323841929436,
0.010787551291286945,
-0.041528694331645966,
-0.0007847155211493373,
0.015381831675767899,
-0.00016063795192167163,
-0.022138126194477... | 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_update_translation(self):
o = TranslatedModel.objects.get(id=1)
translation_id = o.name.autoid
o.name = 'new name'
o.save()
o = TranslatedModel.objects.get(id=1)
self.trans_eq(o.name, 'new name', 'en-US')
# Make sure it was an update, not an insert.
... | |
20,697 | [
0.046680524945259094,
0.02538418397307396,
-0.02446112222969532,
-0.02197764813899994,
0.020340314134955406,
0.0042334445752203465,
0.026812730357050896,
0.026219334453344345,
-0.043757498264312744,
0.02949400432407856,
0.014483270235359669,
-0.014428325928747654,
0.007609760854393244,
-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_create_with_dict(self):
# Set translations with a dict.
strings = {'en-US': 'right language', 'de': 'wrong language'}
o = TranslatedModel.objects.create(name=strings)
# Make sure we get the English text since we're in en-US.
self.trans_eq(o.name, 'right language', 'en-U... | |
20,698 | [
0.026544945314526558,
0.012555349618196487,
-0.02133157290518284,
-0.04541780799627304,
-0.0030420825351029634,
0.02795642614364624,
0.033898305147886276,
0.02754664234817028,
-0.05272563919425011,
0.02793366089463234,
0.0060727824456989765,
-0.017358936369419098,
-0.034217026084661484,
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_update_with_dict(self):
def get_model():
return TranslatedModel.objects.get(id=1)
# There's existing en-US and de strings.
strings = {'de': None, 'fr': 'oui'}
# Don't try checking that the model's name value is en-US. It will be
# one of the other locales,... | |
20,699 | [
0.00005773517113993876,
0.02563645876944065,
-0.013579238206148148,
-0.02376961149275303,
-0.00885266438126564,
-0.005874031223356724,
0.020380746573209763,
-0.012782557867467403,
-0.06963223963975906,
0.016207093372941017,
-0.000060568512708414346,
-0.0254462081938982,
-0.005879976321011782... | 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_dict_bad_locale(self):
m = TranslatedModel.objects.get(id=1)
m.name = {'de': 'oof', 'xxx': 'bam', 'es': 'si'}
m.save()
ts = Translation.objects.filter(id=m.name_id)
eq_(sorted(ts.values_list('locale', flat=True)),
['de', 'en-US', 'es']) | |
20,700 | [
-0.00543024018406868,
-0.015204672701656818,
-0.006042175926268101,
-0.05340930446982384,
0.029527274891734123,
0.023507151752710342,
0.015513396821916103,
0.01597648300230503,
-0.06677266210317612,
0.0070841205306351185,
0.00451509328559041,
0.009912255220115185,
0.0017076313961297274,
-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_dict_with_hidden_locale(self):
with self.settings(HIDDEN_LANGUAGES=('xxx',)):
o = TranslatedModel.objects.get(id=1)
o.name = {'en-US': 'active language', 'xxx': 'hidden language',
'de': 'another language'}
o.save()
ts = Translation.objec... |