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,001
[ -0.005614607594907284, -0.016941942274570465, 0.00032297620782628655, -0.02557644434273243, 0.000031152041628956795, 0.03386208042502403, -0.01952575147151947, -0.0376778319478035, 0.01528481487184763, 0.03748159483075142, -0.023701274767518044, -0.007397109176963568, 0.018969742581248283, ...
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": "port_num", "annotation": null, "type_comment": null}}, {"_type": ...
def add_port(self, port_num, port_conf=None): # add port specific vlans or fall back to defaults port_conf = copy.copy(port_conf) if port_conf else {} port = self.ports.setdefault(port_num, Port(port_num, port_conf)) port_conf.setdefault('mirror', None) if port_conf['mirror'] i...
13,002
[ -0.0030060880817472935, -0.02843477576971054, 0.0497540682554245, -0.029982801526784897, 0.011440448462963104, 0.009193096309900284, -0.018304716795682907, 0.0029161260463297367, -0.012248408980667591, 0.012479254975914955, -0.014285284094512463, -0.016295000910758972, -0.007685808464884758,...
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 set_defaults(self): # Offset for tables used by faucet self.__dict__.setdefault('table_offset', 0) # The table for internally associating vlans self.__dict__.setdefault('vlan_table', self.table_offset) # Table for applying ACLs. self.__dict__.setdefault('acl_table', s...
13,003
[ -0.011875537224113941, 0.003988303709775209, -0.013741213828325272, -0.0059712836518883705, 0.011227576993405819, 0.023706387728452682, -0.03816258907318115, -0.02987317554652691, 0.009803183376789093, 0.03682198375463486, -0.034453582018613815, 0.023259518668055534, 0.026231195777654648, ...
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": "port_num", "annotation": null, "type_comment": null}}], "kwarg": ...
def get_native_vlan(self, port_num): if port_num not in self.ports: return None port = self.ports[port_num] for vlan in self.vlans.values(): if port in vlan.untagged: return vlan return None
13,004
[ 0.00022814830299466848, 0.04902619868516922, 0.06710883975028992, 0.004596206359565258, 0.025286689400672913, 0.010715415701270103, 0.006345847155898809, -0.0573422834277153, -0.038220129907131195, 0.00138626538682729, 0.004073429387062788, 0.01799803040921688, -0.006635942962020636, 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": "success", "annotation": null, "type_comment": null}}, {"_type": "...
def get_score(self, success, count_graded, count_required): self.peer_grading.use_for_single_location_local = True self.peer_grading.graded = True # Patch for external grading service. with patch('xmodule.peer_grading_module.PeerGradingModule.query_data_for_location') as mock_query_data...
13,005
[ -0.0006661112420260906, 0.009641828946769238, 0.013731516897678375, 0.0019348367350175977, -0.004532953724265099, 0.027307730168104172, -0.05104345455765724, 0.027437150478363037, 0.026362959295511246, 0.03424466773867607, 0.03424466773867607, -0.03975798189640045, 0.009881257079541683, -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 _policy_exists(self): uri = 'https://{0}:{1}/mgmt/tm/asm/policies/'.format( self.client.provider['server'], self.client.provider['server_port'], ) query = "?$filter=contains(name,'{0}')+and+contains(partition,'{1}')&$select=name,partition".format( self.wan...
13,006
[ 0.0010092700831592083, 0.02633398026227951, 0.006341137457638979, -0.03489949554204941, 0.004465356003493071, 0.04183159023523331, -0.06533695757389069, -0.02759556844830513, 0.02948131039738655, 0.02026508003473282, 0.03646652027964592, -0.05160557106137276, 0.022310180589556694, -0.02743...
16
{"_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 ModuleParameters(Parameters): def _policy_exists(self): uri = 'https://{0}:{1}/mgmt/tm/asm/policies/'.format( self.client.provider['server'], self.client.provider['server_port'], ) query = "?$filter=contains(name,'{0}')+and+contains(partition,'{1}')&$select=name...
13,007
[ 0.044490132480859756, 0.014890036545693874, 0.03772302716970444, -0.048089660704135895, 0.02843625098466873, -0.02980407141149044, -0.013066276907920837, -0.03445945680141449, 0.0035575309302657843, 0.02283298969268799, 0.006143189966678619, -0.014434097334742546, 0.02853223867714405, -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 file(self): if self._values['file'] is not None: return self._values['file'] if self.binary: result = next(tempfile._get_candidate_names()) + '.plc' else: result = next(tempfile._get_candidate_names()) + '.xml' self._values['file'] = result ...
13,008
[ 0.05040198192000389, 0.023808671161532402, 0.01425967738032341, -0.007715773303061724, 0.03376375883817673, 0.010860095731914043, -0.06511416286230087, -0.024203162640333176, 0.022300325334072113, -0.015002247877418995, 0.03501684591174126, -0.005633094348013401, 0.02436560019850731, -0.05...
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 name(self): if self._policy_exists(): return self._values['name'] else: raise F5ModuleError( "The specified ASM policy {0} on partition {1} does not exist on device.".format( self._values['name'], self._values['partition'] )...
13,009
[ -0.0005417397478595376, 0.035120002925395966, 0.032552678138017654, -0.040304504334926605, -0.007920071482658386, 0.03177998960018158, -0.04090271517634392, -0.026520712301135063, 0.035319406539201736, 0.038385242223739624, 0.032278500497341156, -0.018108362331986427, -0.01656298339366913, ...
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}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an...
class ModuleManager(object): def __init__(self, *args, **kwargs): self.module = kwargs.get('module', None) self.client = F5RestClient(**self.module.params) self.want = ModuleParameters(params=self.module.params) self.changes = UsableChanges() def _set_changed_options(self): ...
13,010
[ 0.029851067811250687, 0.04374215751886368, -0.006860288791358471, -0.012504255399107933, -0.005697961896657944, 0.012436049990355968, -0.027668505907058716, 0.006445375271141529, 0.01303852815181017, 0.0018756382633000612, 0.010117079131305218, 0.0275548305362463, -0.00855973083525896, -0....
15
{"_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 fulldest(self): result = None if os.path.isdir(self.dest): result = os.path.join(self.dest, self.file) else: if os.path.exists(os.path.dirname(self.dest)): result = self.dest else: try: # os.path.exists()...
13,011
[ 0.021528223529458046, 0.05074251815676689, 0.03300914168357849, -0.03594864159822464, 0.021540271118283272, 0.020841537043452263, -0.03934593126177788, -0.007089736871421337, 0.044646669179201126, -0.0019425998907536268, 0.0312984474003315, -0.061874065548181534, 0.018408017233014107, -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 exec_module(self): if not module_provisioned(self.client, 'asm'): raise F5ModuleError( "ASM must be provisioned to use this module." ) result = dict() self.export() reportable = ReportableChanges(params=self.changes.to_return()) chang...
13,012
[ 0.036690570414066315, 0.058186572045087814, 0.015448661521077156, -0.011745302006602287, -0.006002872250974178, 0.016858860850334167, 0.03346363082528114, -0.0015864733140915632, 0.006568222306668758, 0.020848071202635765, 0.027213020250201225, 0.014457711018621922, 0.02020014077425003, 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 create(self): self._set_changed_options() if self.module.check_mode: return True if self.want.binary: self.export_binary() return True self.create_on_device() if not self.want.inline: self.execute() return True
13,013
[ -0.018150756135582924, 0.006385048385709524, -0.003035588189959526, -0.03171001374721527, -0.007939460687339306, 0.0202073622494936, -0.029581665992736816, 0.011245576664805412, 0.05232391506433487, 0.012447257526218891, 0.037138503044843674, -0.012094524689018726, 0.00032283953623846173, ...
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": "task_id", "annotation": null, "type_comment": null}}], "kwarg": n...
def wait_for_task(self, task_id): uri = "https://{0}:{1}/mgmt/tm/asm/tasks/export-policy/{2}".format( self.client.provider['server'], self.client.provider['server_port'], task_id ) while True: resp = self.client.api.get(uri) try: ...
13,014
[ 0.03530336171388626, 0.025858690962195396, -0.009048138745129108, -0.0096489442512393, -0.006374551448971033, 0.01562095619738102, -0.019538210704922676, -0.0038902189116925, 0.032419491559267044, 0.013638296164572239, 0.04763190075755119, 0.03708174452185631, 0.015212408266961575, -0.0366...
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 create_on_device(self): self._set_policy_link() params = self.changes.api_params() uri = "https://{0}:{1}/mgmt/tm/asm/tasks/export-policy/".format( self.client.provider['server'], self.client.provider['server_port'], ) resp = self.client.api.post(uri, ...
13,015
[ 0.028835603967308998, 0.019114606082439423, 0.012850102037191391, 0.008978072553873062, -0.0028331924695521593, 0.014531129971146584, -0.03455235809087753, 0.004725135397166014, 0.00483216717839241, 0.00894659198820591, 0.0024318236391991377, 0.01342303678393364, 0.011622385121881962, -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 export_binary_on_device(self): full_name = fq_name(self.want.partition, self.want.name) cmd = 'tmsh save asm policy {0} bin-file {1}'.format(full_name, self.want.file) uri = "https://{0}:{1}/mgmt/tm/util/bash/".format( self.client.provider['server'], self.client.provi...
13,016
[ -0.01736304722726345, -0.012333371676504612, -0.01035198476165533, 0.008321825414896011, -0.007846292108297348, 0.04048125818371773, -0.026922475546598434, 0.003118398366495967, 0.03036094456911087, 0.030312173068523407, 0.04287111759185791, -0.015192665159702301, 0.009029028005897999, -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 _set_policy_link(self): policy_link = None uri = 'https://{0}:{1}/mgmt/tm/asm/policies/'.format( self.client.provider['server'], self.client.provider['server_port'], ) query = "?$filter=contains(name,'{0}')+and+contains(partition,'{1}')&$select=name,partition"...
13,017
[ 0.007277341093868017, 0.011641287244856358, -0.005418054293841124, 0.016386311501264572, -0.01021532155573368, 0.007283487822860479, 0.006416844669729471, 0.002563050016760826, 0.0341002456843853, 0.013202473521232605, 0.01834086701273918, -0.006976167671382427, -0.0037554523441940546, -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 _move_binary_to_download(self): name = '{0}~{1}'.format(self.client.provider['user'], self.want.file) move_path = '/var/tmp/{0} {1}/{2}'.format( self.want.file, '/ts/var/rest', name ) params = dict( command='run', utilCmdArg...
13,018
[ 0.005960559472441673, 0.00776613038033247, -0.022645775228738785, -0.0036328956484794617, 0.019023755565285683, 0.005835474468767643, -0.020546527579426765, 0.016783107072114944, 0.0058028437197208405, 0.003877626731991768, 0.00038375178701244295, 0.02338540554046631, -0.0042691961862146854,...
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": "dest", "annotation": null, "type_comment": null}}], "kwarg": null...
def download_from_device(self, dest): url = 'https://{0}:{1}/mgmt/tm/asm/file-transfer/downloads/{2}'.format( self.client.provider['server'], self.client.provider['server_port'], self.want.file ) try: download_file(self.client, url, dest) e...
13,019
[ 0.038194525986909866, 0.030842527747154236, 0.00141842570155859, -0.0007922170334495604, -0.04081703722476959, 0.01876104436814785, -0.012462533079087734, -0.010938338935375214, 0.0437757670879364, 0.037544503808021545, 0.010764624923467636, -0.029833870008587837, 0.019310202449560165, -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 ArgumentSpec(object): def __init__(self): self.supports_check_mode = True argument_spec = dict( name=dict( required=True, ), dest=dict( type='path' ), file=dict(), inline=dict( ...
13,020
[ 0.03984323516488075, 0.008359336294233799, 0.004827883560210466, -0.010236520320177078, -0.003833562368527055, 0.0523265115916729, -0.04148577153682709, 0.012682726606726646, 0.03275686502456665, 0.004033013246953487, 0.031607091426849365, -0.01296430453658104, 0.013785571791231632, -0.061...
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 remove_temp_policy_from_device(self): name = '{0}~{1}'.format(self.client.provider['user'], self.want.file) tpath_name = '/ts/var/rest/{0}'.format(name) uri = "https://{0}:{1}/mgmt/tm/util/unix-rm/".format( self.client.provider['server'], self.client.provider['server_...
13,021
[ 0.033802203834056854, 0.03815588727593422, 0.01778162084519863, 0.012333401478827, -0.02729613520205021, 0.04294983297586441, 0.010865867137908936, 0.017842769622802734, 0.04493100196123123, 0.06554985791444778, 0.028372326865792274, -0.010468410328030586, 0.03893857076764107, -0.023920806...
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 __init__(self): self.supports_check_mode = True argument_spec = dict( name=dict( required=True, ), dest=dict( type='path' ), file=dict(), inline=dict( type='bool' ), ...
13,022
[ 0.031956326216459274, 0.0449899397790432, 0.011835253797471523, -0.023556377738714218, -0.02344224788248539, 0.0589822456240654, -0.02668353170156479, -0.008377122692763805, 0.05405184254050255, 0.04060735926032066, 0.019984116777777672, -0.0737278088927269, -0.0025351066142320633, 0.01523...
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(): spec = ArgumentSpec() module = AnsibleModule( argument_spec=spec.argument_spec, supports_check_mode=spec.supports_check_mode, mutually_exclusive=spec.mutually_exclusive, ) try: mm = ModuleManager(module=module) results = mm.exec_module() modu...
13,023
[ -0.0034293802455067635, -0.00484791025519371, -0.02340119145810604, -0.0011580613208934665, 0.0377383716404438, -0.01875983364880085, 0.009628995321691036, 0.016998061910271645, 0.05875813215970993, 0.02099546231329441, -0.033947523683309555, -0.061139561235904694, -0.01225950289517641, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "b", "annotation": null, "type_comment": null}}], "kwarg": null, "var...
def forward(a, b): if isinstance(b, (int, Fraction)): return monomorphic_operator(a, b) elif isinstance(b, float): return fallback_operator(float(a), b) elif isinstance(b, complex): return fallback_operator(complex(a), b) ...
13,024
[ 0.008395127952098846, -0.014597631990909576, 0.021366167813539505, 0.0014724244829267263, 0.02540583908557892, -0.021973906084895134, -0.009801267646253109, 0.010128969326615334, 0.051717326045036316, 0.028408780694007874, -0.04261317104101181, -0.06949664652347565, -0.007888679392635822, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "b", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}], "kwarg": null, "var...
def reverse(b, a): if isinstance(a, numbers.Rational): # Includes ints. return monomorphic_operator(a, b) elif isinstance(a, numbers.Real): return fallback_operator(float(a), float(b)) elif isinstance(a, numbers.Complex): ...
13,025
[ 0.050528448075056076, -0.03684772551059723, 0.015058550983667374, -0.020850300788879395, -0.013705110177397728, 0.03933513164520264, 0.037603702396154404, 0.04994317889213562, 0.06047806888818741, 0.004444406367838383, 0.024813078343868256, -0.02545931562781334, -0.014046519063413143, -0.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_init(self): ec2_operator = EC2InstanceStateSensor( task_id="task_test", target_state="stopped", instance_id="i-123abc", aws_conn_id="aws_conn_test", region_name="region-test", ) self.assertEqual(ec2_operator.task_id, "task_test...
13,026
[ 0.025093208998441696, -0.01053150650113821, 0.0011215530103072524, -0.03352334350347519, -0.020200278609991074, 0.06714528799057007, 0.009089509025216103, 0.02202434279024601, 0.05989832803606987, -0.009705747477710247, 0.026744725182652473, -0.029209677129983902, -0.022418735548853874, 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 TestEC2InstanceStateSensor(unittest.TestCase): def test_init(self): ec2_operator = EC2InstanceStateSensor( task_id="task_test", target_state="stopped", instance_id="i-123abc", aws_conn_id="aws_conn_test", region_name="region-test", ) ...
13,027
[ 0.058939140290021896, -0.010437647812068462, 0.04568149521946907, 0.008679728023707867, -0.03213086351752281, 0.03017762117087841, -0.009058169089257717, 0.0390404649078846, 0.019166206941008568, 0.007788560353219509, 0.01052310224622488, -0.015625951811671257, -0.034377094358205795, 0.008...
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_init_invalid_target_state(self): invalid_target_state = "target_state_test" with self.assertRaises(ValueError) as cm: EC2InstanceStateSensor( task_id="task_test", target_state=invalid_target_state, instance_id="i-123abc", )...
13,028
[ 0.03400273248553276, -0.004588603973388672, 0.01616600528359413, -0.04946279525756836, 0.007324117701500654, 0.04289756342768669, 0.04103859141469002, 0.04346231371164322, 0.03284969925880432, 0.003379683243110776, 0.042285751551389694, -0.019178010523319244, -0.02141348458826542, -0.02054...
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_running(self): # create instance ec2_hook = EC2Hook() instances = ec2_hook.conn.create_instances( MaxCount=1, MinCount=1, ) instance_id = instances[0].instance_id # stop instance ec2_hook.get_instance(instance_id=instance_id).stop(...
13,029
[ 0.040086109191179276, 0.004983349237591028, -0.005540777463465929, -0.02919340878725052, 0.0014468770241364837, 0.04481358826160431, 0.03721063211560249, 0.05458533763885498, 0.06438145786523819, 0.004587361589074135, 0.05750955268740654, -0.0462513267993927, -0.04754285514354706, -0.00214...
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_terminated(self): # create instance ec2_hook = EC2Hook() instances = ec2_hook.conn.create_instances( MaxCount=1, MinCount=1, ) instance_id = instances[0].instance_id # start instance ec2_hook.get_instance(instance_id=instance_id).s...
13,030
[ 0.054867953062057495, -0.029316475614905357, -0.02433473989367485, -0.04635079205036163, -0.019284134730696678, 0.04194299131631851, 0.020787836983799934, 0.056429050862789154, 0.04178228974342346, -0.013039747253060341, 0.05349051579833031, -0.020787836983799934, -0.04644262418150902, -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_stopped(self): # create instance ec2_hook = EC2Hook() instances = ec2_hook.conn.create_instances( MaxCount=1, MinCount=1, ) instance_id = instances[0].instance_id # start instance ec2_hook.get_instance(instance_id=instance_id).star...
13,031
[ -0.01595141738653183, -0.054595693945884705, 0.04542999342083931, -0.039164550602436066, -0.011196987703442574, 0.03772548958659172, 0.009874160401523113, 0.027962027117609978, -0.006835531443357468, -0.004909405950456858, 0.003830111352726817, -0.039186690002679825, -0.025349581614136696, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "regressiontests.templates.alternate_urls"}}, "targets": [{"_type": "Name", "_fields": {"id": "urls", "ctx": {"_type": "Store", "_fields":...
class CacheMiddlewareTest(TestCase): urls = 'regressiontests.templates.alternate_urls' def setUp(self): self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES self.CACHE_MIDDLEWARE_SECONDS = settings.CACHE_MIDDLEWARE_SECONDS settings.CACHE_MIDDLEWARE_SECONDS = 2.0 settings.M...
13,032
[ -0.02335129678249359, -0.06946410238742828, 0.03488495945930481, -0.01890603080391884, -0.00116933963727206, -0.004789309576153755, -0.01676531322300434, 0.018622057512402534, -0.015815095975995064, 0.023853709921240807, -0.022652287036180496, -0.04845011606812477, 0.0037926742807030678, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "regressiontests.templates.urls"}}, "targets": [{"_type": "Name", "_fields": {"id": "urls", "ctx": {"_type": "Store", "_fields": {}}}}], "...
class CustomURLConfTest(TestCase): urls = 'regressiontests.templates.urls' def setUp(self): self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES settings.MIDDLEWARE_CLASSES = list(settings.MIDDLEWARE_CLASSES) + [ 'regressiontests.templates.response.CustomURLConfMiddleware' ...
13,033
[ 0.01805046759545803, -0.05931033194065094, 0.014317486435174942, -0.04173518344759941, 0.00341996643692255, 0.029910214245319366, 0.002940301550552249, 0.026269979774951935, 0.06311286985874176, -0.01867649517953396, 0.03283167630434036, -0.06566335260868073, -0.023360108956694603, -0.0272...
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_middleware_caching(self): response = self.client.get('/template_response_view/') self.assertEqual(response.status_code, 200) time.sleep(1.0) response2 = self.client.get('/template_response_view/') self.assertEqual(response2.status_code, 200) self.assertEqual(r...
13,034
[ 0.018799763172864914, 0.022801460698246956, 0.1026124432682991, -0.02926754765212536, -0.010409107431769371, 0.0017808141419664025, -0.0007437172462232411, -0.01894058659672737, -0.03541678190231323, -0.006917890626937151, -0.0419180765748024, -0.005098937079310417, 0.01842423714697361, 0....
11
{"_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 = [ ("djasana", "0019_adds_project_is_template"), ] operations = [ migrations.AddField( model_name="project", name="default_view", field=models.CharField( blank=True, cho...
13,035
[ 0.03625711426138878, 0.022477218881249428, -0.015006721019744873, -0.01966208964586258, 0.016704561188817024, -0.024996595457196236, 0.008319418877363205, 0.0007941512740217149, -0.0014390569413080812, -0.018358586356043816, 0.035972315818071365, 0.010165136307477951, -0.012783097103238106, ...
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": "size", "annotation": null, "type_comment": null}}], "kwarg": null...
def read(self, size=None): if not size: size = self._size contents = BytesIO() while True: blocks = GzipFile.read(self, size) if not blocks: contents.flush() break contents.write(blocks) ...
13,036
[ 0.04889174923300743, 0.04213140904903412, 0.01098555326461792, -0.03315786272287369, 0.037161752581596375, -0.010874893516302109, 0.032011017203330994, 0.03259449824690819, 0.0008588751079514623, 0.00039108371129259467, 0.04062240570783615, 0.022152187302708626, -0.014486444182693958, 0.03...
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": "encoding", "annotation": null, "type_comment": null}}], "kwarg": ...
def open(self, encoding=None): # Note: In >= Python3.5, GzipFile is already using a # buffered reader in the backend which has a variable self._buffer # See https://github.com/nltk/nltk/issues/1308 if sys.version.startswith('2.7') or sys.version.startswith('3.4'): stream = Bu...
13,037
[ 0.06487903743982315, 0.030628379434347153, -0.009312274865806103, -0.02499372325837612, 0.046767644584178925, -0.01108819805085659, 0.006283647380769253, 0.015827344730496407, -0.009900894947350025, -0.0006203781231306493, 0.043064869940280914, -0.006494946777820587, 0.006570410914719105, ...
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": "encoding", "annotation": null, "type_comment": null}}], "kwarg": ...
def open(self, encoding=None): data = self._zipfile.read(self._entry) stream = BytesIO(data) if self._entry.endswith('.gz'): # Note: In >= Python3.5, GzipFile is already using a # buffered reader in the backend which has a variable self._buffer # See https://g...
13,038
[ 0.051960330456495285, 0.02755264937877655, -0.03577969968318939, -0.024111416190862656, 0.08587127923965454, -0.007201519329100847, 0.0011074329959228635, -0.009583034552633762, 0.008221355266869068, -0.015815995633602142, -0.0032532180193811655, -0.008409368805587292, 0.03707870841026306, ...
8
{"_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": "_path", "annotation": ...
class LazyLoader(object): @py3_data def __init__(self, _path): self._path = _path def __load(self): resource = load(self._path) # This is where the magic happens! Transform ourselves into # the object by modifying our own __dict__ and __class__ to # match that of `...
13,039
[ 0.02210748754441738, 0.06291306018829346, -0.02311529591679573, -0.020563608035445213, 0.0369887612760067, 0.008067838847637177, 0.015084982849657536, 0.02245057001709938, 0.015138589777052402, -0.009005960077047348, 0.04189915582537651, 0.04275686666369438, -0.000877142942044884, 0.059782...
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": "name", "annotation": null, "type_comment": null}}], "kwarg": null...
def read(self, name): assert self.fp is None self.fp = open(self.filename, 'rb') value = zipfile.ZipFile.read(self, name) # Ensure that _fileRefCnt needs to be set for Python2and3 compatible code. # Since we only opened one file here, we add 1. self._fileRefCnt += 1 ...
13,040
[ 0.051527682691812515, 0.06440013647079468, -0.04096469655632973, -0.019185638055205345, 0.020255187526345253, 0.01041154470294714, 0.05591946095228195, 0.01034528948366642, 0.02568812109529972, 0.021788524463772774, 0.03774658218026161, 0.020444488152861595, 0.0149547653272748, 0.066141709...
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": "filename", "annotation": null, "type_comment": null}}], "kwarg": ...
def __init__(self, filename): if not isinstance(filename, string_types): raise TypeError('ReopenableZipFile filename must be a string') zipfile.ZipFile.__init__(self, filename) assert self.filename == filename self.close() # After closing a ZipFile object, the _fileRe...
13,041
[ 0.10147929936647415, 0.05390792340040207, 0.02761598862707615, -0.0004810040700249374, -0.007566024083644152, 0.03199009597301483, 0.026244645938277245, -0.014623706229031086, -0.0347091369330883, 0.030382316559553146, 0.0007181811961345375, -0.00886052381247282, 0.0002717192692216486, 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 _check_bom(self): # Normalize our encoding name enc = re.sub('[ -]', '', self.encoding.lower()) # Look up our encoding in the BOM table. bom_info = self._BOM_TABLE.get(enc) if bom_info: # Read a prefix, to check against the BOM(s) bytes = self.stream...
13,042
[ 0.0068110148422420025, 0.028792761266231537, -0.01005020085722208, -0.00430255476385355, -0.014712665230035782, -0.00497056869789958, 0.03856484964489937, -0.020405778661370277, 0.0075962720438838005, 0.049776576459407806, -0.018355386331677437, 0.027658501639962196, -0.05906878784298897, ...
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": "theme", "annotation": null, "type_comment": null}}], "kwarg": nul...
def update_theme(self, theme): Widget.update_theme(self, theme) if theme: patch = theme['button'][('image_down' if self._down else 'image_up')] label = self.elements['label'] label.font_name = self.theme['font'] label.font_size = self.theme['font_size'] label.color = theme['font_color'] ...
13,043
[ 0.027000607922673225, 0.03694562986493111, 0.0069945016875863075, 0.01020769588649273, -0.006499693728983402, 0.017385460436344147, 0.037238847464323044, -0.009718997403979301, -0.02131948433816433, 0.049993887543678284, 0.007892485707998276, 0.014392179436981678, -0.03909590467810631, -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 update_elements(self): if self._dirty and self.theme: patch = self.theme['button'][('image_down' if self._down else 'image_up')] label = self.elements['label'] font = label.document.get_font() height = font.ascent - font.descent left = 0 if self.halign == 'center': left = self...
13,044
[ 0.04314817860722542, 0.018972473219037056, -0.0013405700447037816, 0.06030292809009552, 0.022812411189079285, 0.01621180772781372, 0.038990139961242676, 0.05089621618390083, 0.024471083655953407, -0.0014982005814090371, 0.026970451697707176, 0.0381721630692482, 0.01927921548485756, -0.0101...
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": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def on_mouse_press(self, x, y, button, modifiers): if button == pyglet.window.mouse.LEFT and self.active_region.hit_test(x, y): self.shapes['frame'].patch = self.theme['button']['image_down'] self._down = True return pyglet.event.EVENT_HANDLED Widget.on_mouse_press(self, x, y, button, modifiers) retur...
13,045
[ 0.054169926792383194, 0.02079455554485321, -0.000854890386108309, 0.04631822928786278, 0.008445666171610355, 0.02030806615948677, 0.0431503988802433, 0.04774375632405281, 0.018429994583129883, -0.0037900847382843494, 0.022299274802207947, 0.022898901253938675, 0.01902961917221546, -0.00561...
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": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def on_mouse_release(self, x, y, button, modifiers): if button == pyglet.window.mouse.LEFT and self._down: self.shapes['frame'].patch = self.theme['button']['image_up'] self._down = False if self.active_region.hit_test(x, y): if self.action: self.action(self) return pyglet.event.EVENT_HANDLED ...
13,046
[ 0.04458975791931152, 0.013750801794230938, -0.0055307126604020596, 0.05413159728050232, 0.013911361806094646, 0.024244533851742744, 0.02585013210773468, 0.04527787119150162, 0.010614151135087013, 0.009564777836203575, -0.005757216364145279, 0.03903897479176521, 0.022833900526165962, -0.002...
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": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def on_mouse_drag(self, x, y, dx, dy, button, modifiers): if button == pyglet.window.mouse.LEFT and self._down: if self.active_region.hit_test(x, y): self.shapes['frame'].patch = self.theme['button']['image_down'] else: self.shapes['frame'].patch = self.theme['button']['image_up'] return pyglet.e...
13,047
[ -0.011427571065723896, 0.05860169231891632, 0.08433631807565689, -0.02983096055686474, -0.015939563512802124, 0.0026023779064416885, 0.014734758995473385, 0.03619232773780823, -0.04997529089450836, 0.06399921327829361, 0.024204522371292114, 0.028240617364645004, -0.03551763668656349, -0.01...
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 execute(self): # TODO(John Sirois): Is there a way to avoid a naive re-resolve for each target, ie bulk # resolve and then post-resolve analyze the results locally to create a separate NODE_PATH # for each target participating in the bulk resolve? This is unlikely since versions are often # unconst...
13,048
[ 0.001989233074709773, 0.027021192014217377, 0.04597338289022446, 0.017071913927793503, -0.008934427052736282, -0.0001696607214398682, -0.005911664105951786, 0.03469172492623329, -0.017171531915664673, -0.0019254155922681093, 0.000812503625638783, -0.02079511061310768, 0.011611641384661198, ...
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": "new_quotas", "annotation": null, "type_comment": null}}], "kwarg"...
def _check_quotas(self, new_quotas): # Add a tenant to conduct the test test_tenant = data_utils.rand_name('test_tenant_') test_description = data_utils.rand_name('desc_') tenant = self.identity_admin_client.create_tenant( name=test_tenant, description=test_descri...
13,049
[ -0.023664850741624832, 0.01819906011223793, 0.025689218193292618, -0.04741067811846733, 0.03811883181333542, 0.009276662021875381, 0.01476775761693716, 0.007616681046783924, 0.002859418513253331, 0.05830177292227745, 0.024575816467404366, 0.04239024594426155, -0.02178218960762024, -0.04688...
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": "node_path", "annotation": null, "type_comment": null}}, {"_type":...
def _resolve_remote_module(self, node_path, node_remote_module): with pushd(node_path): package = '{}@{}'.format(node_remote_module.package_name, node_remote_module.version) result, npm_install = self.execute_npm(args=['install', package], workunit_name=node_...
13,050
[ -0.030109556391835213, 0.027323996648192406, 0.04984237253665924, -0.05681690201163292, -0.0007947349222376943, -0.005281399004161358, 0.0067884717136621475, -0.0011741610942408442, -0.020275043323636055, 0.04114547371864319, 0.020955486223101616, 0.030853789299726486, -0.03344797343015671, ...
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": "node_path", "annotation": null, "type_comment": null}}, {"_type":...
def _resolve_local_module(self, node_path, node_paths, node_module): _copy_sources(buildroot=get_buildroot(), node_module=node_module, dest_dir=node_path) self._emit_package_descriptor(node_module, node_path, node_paths) with pushd(node_path): # TODO(John Sirois): Handle dev dependency resolution. ...
13,051
[ -0.00897265411913395, -0.0005168224452063441, 0.011564480140805244, 0.04522119089961052, -0.012595039792358875, 0.0024267511907964945, 0.016032295301556587, 0.04536929354071617, 0.0238818246871233, 0.018710514530539513, 0.0238818246871233, -0.05272514373064041, -0.011675558984279633, 0.012...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fie...
def yieldExceptionInteraction(): def yield_raise(): try: raise KeyError("caught") except KeyError: yield from sys.exc_info() yield from sys.exc_info() yield from sys.exc_info() g = yield_raise() print("Initial yield from catch in generator", next(...
13,052
[ -0.006233156658709049, -0.0014850988518446684, 0.05216476321220398, -0.029978768900036812, 0.0347268283367157, -0.022058242931962013, 0.002193049294874072, 0.0177147276699543, -0.012924086302518845, 0.0391555093228817, 0.01916256546974182, 0.015564261935651302, -0.012061771005392075, -0.08...
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": "npm_package", "annotation": null, "type_comment": null}}, {"_type...
def _emit_package_descriptor(self, npm_package, node_path, node_paths): def render_dep(target): return node_paths.node_path(target) if self.is_node_module(target) else target.version dependencies = {dep.package_name: render_dep(dep) for dep in npm_package.dependencies} package = { 'name': npm_p...
13,053
[ -0.010497692972421646, -0.017308905720710754, 0.016208812594413757, 0.0022192029282450676, 0.03136434406042099, -0.012639363296329975, -0.0003315272624604404, 0.05200864002108574, -0.0023230682127177715, 0.025442570447921753, 0.003578227013349533, -0.03473484143614769, -0.009157686494290829,...
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": "r", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _handle_digest_auth_401(self, r, kwargs): self.auth = auth_compat.HTTPDigestAuth(self.username, self.password) try: self.auth.init_per_thread_state() except AttributeError: # If we're not on requests 2.8.0+ this method does not exist and # is not relevant....
13,054
[ -0.0018668913980945945, -0.014174546115100384, 0.025283701717853546, 0.012641850858926773, 0.046026941388845444, -0.04434443265199661, 0.012284606695175171, 0.08292685449123383, -0.00027315531042404473, 0.01774699240922928, 0.036346763372421265, -0.028164707124233246, -0.0053039309568703175,...
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": "r", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _handle_basic_auth_401(self, r, kwargs): if self.pos is not None: r.request.body.seek(self.pos) # Consume content and release the original connection # to allow our new request to reuse the same one. r.content r.raw.release_conn() prep = r.request.copy() ...
13,055
[ -0.011720594950020313, -0.028585167601704597, -0.0018486165208742023, -0.015657542273402214, 0.057531315833330154, -0.041760966181755066, -0.03650418296456337, 0.031066909432411194, 0.008189751766622066, 0.011438579298555851, -0.018026478588581085, -0.025674758478999138, 0.022437212988734245...
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": "request", "annotation": null, "type_comment": null}}], "kwarg": n...
def __call__(self, request): if self.auth is not None: return self.auth(request) try: self.pos = request.body.tell() except AttributeError: pass request.register_hook('response', self.handle_401) return request
13,056
[ 0.0005601436132565141, -0.011195329017937183, 0.025275491178035736, 0.014158620499074459, 0.032348766922950745, -0.04164300113916397, 0.004378550220280886, 0.0733882486820221, 0.01796080730855465, 0.0014054513303562999, 0.025710027664899826, -0.05856575071811676, -0.011563477106392384, 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": "r", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _handle_basic_auth_407(self, r, kwargs): if self.pos is not None: r.request.body.seek(self.pos) r.content r.raw.release_conn() prep = r.request.copy() if not hasattr(prep, '_cookies'): prep._cookies = cookies.RequestsCookieJar() cookies.extrac...
13,057
[ -0.0179511159658432, -0.028646646067500114, 0.01213960349559784, 0.007144050672650337, 0.0354560948908329, -0.0072144935838878155, 0.0055943140760064125, 0.04780702665448189, 0.02667425386607647, 0.010225913487374783, 0.005115891806781292, -0.06832929700613022, -0.01817418448626995, -0.004...
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": "r", "annotation": null, "type_comment": null}}], "kwarg": {"_type...
def handle_407(self, r, **kwargs): proxy_authenticate = r.headers.get('Proxy-Authenticate', '').lower() if 'basic' in proxy_authenticate: return self._handle_basic_auth_407(r, kwargs) if 'digest' in proxy_authenticate: return self._handle_digest_auth_407(r, kwargs)
13,058
[ 0.00047293322859331965, -0.014311239123344421, 0.008812964893877506, 0.031477466225624084, 0.0345018208026886, -0.00025083229411393404, 0.01939215138554573, 0.0634872242808342, 0.015811318531632423, 0.011625613085925579, 0.019428445026278496, -0.0375019796192646, -0.013161985203623772, 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": "r", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _handle_digest_auth_407(self, r, kwargs): self.proxy_auth = http_proxy_digest.HTTPProxyDigestAuth( username=self.proxy_username, password=self.proxy_password) try: self.auth.init_per_thread_state() except AttributeError: pass return s...
13,059
[ 0.0032362830825150013, -0.0318150669336319, 0.03400612249970436, -0.004549800418317318, 0.05790654942393303, -0.0007084609242156148, -0.011072671040892601, 0.0030546262860298157, -0.0036359275691211224, -0.002177085028961301, -0.011894318275153637, 0.033871978521347046, -0.012643302790820599...
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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class TestTranspose(unittest.TestCase): def setUp(self): self.x = numpy.random.uniform(-1, 1, self.in_shape).astype(self.dtype) def check_forward(self, x_data): axes = self.axes x = chainer.Variable(x_data) y = functions.transpose(x, axes) self.assertEqual(y.data.dtype,...
13,060
[ 0.015531928278505802, -0.03430364280939102, 0.012911510653793812, -0.006646330934017897, 0.03749578818678856, -0.0331125445663929, -0.017294753342866898, 0.023536112159490585, 0.01188716571778059, -0.02116582542657852, -0.010975975543260574, -0.04402301087975502, 0.018926559016108513, -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": "request", "annotation": null, "type_comment": null}}], "kwarg": n...
def __call__(self, request): if self.proxy_auth is not None: request = self.proxy_auth(request) try: self.pos = request.body.tell() except AttributeError: pass request.register_hook('response', self.handle_407) return super(GuessProxyAuth, se...
13,061
[ 0.047717463225126266, -0.021915243938565254, 0.08023062348365784, -0.010742872022092342, 0.008101445622742176, -0.004090988542884588, 0.0018965114140883088, -0.0035433759912848473, -0.01749139279127121, -0.0022025303915143013, 0.01101667806506157, 0.038118135184049606, 0.018715467303991318, ...
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_create_port_duplicated_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() uuid = data_utils.rand_uuid() self.create_port(node_id=node_id, address=address, uuid=uuid) self.assertRaises(lib_exc.Conflict, self.create_port, node_id=node_id,...
13,062
[ 0.042262062430381775, -0.004342067986726761, 0.03619309887290001, 0.02381240949034691, -0.012711722403764725, 0.016816549003124237, -0.007310343440622091, -0.0012855170061811805, -0.0000022521546725329245, 0.01763310097157955, 0.013263446278870106, 0.062057919800281525, -0.038113098591566086...
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_port_by_mac_not_allowed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() extra = {'key': 'value'} self.create_port(node_id=node_id, address=address, extra=extra) patch = [{'path': '/extra/key', 'op': 'replace', ...
13,063
[ 0.015022140927612782, -0.0006066634086892009, 0.03237849101424217, -0.011260828003287315, 0.013589260168373585, 0.02183988131582737, -0.0010233833454549313, 0.013046151958405972, 0.016200801357626915, 0.017471905797719955, 0.017032796517014503, 0.03975089639425278, -0.0163741335272789, -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_update_port_nonexistent(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() extra = {'key': 'value'} _, port = self.create_port(node_id=node_id, address=address, extra=extra) port_id = port['uuid'] _, bo...
13,064
[ 0.02926710806787014, 0.0032175870146602392, 0.05984342098236084, 0.005015106871724129, 0.0013052475405856967, -0.0010439340258017182, 0.005041501950472593, -0.0006097314180806279, -0.01693522371351719, 0.019395265728235245, 0.01826554723083973, 0.02183419093489647, -0.03032291866838932, -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_port_malformed_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() self.create_port(node_id=node_id, address=address) new_address = data_utils.rand_mac_address() self.assertRaises(lib_exc.BadRequest, self.client.update_port, ...
13,065
[ 0.029403015971183777, 0.002678524237126112, 0.03249574452638626, 0.006489207968115807, -0.000297019345453009, 0.0018722055247053504, -0.006958640180528164, 0.0033219223842024803, -0.01268018875271082, 0.03589774668216705, 0.022510649636387825, 0.013155143707990646, -0.028408924117684364, -...
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_port_replace_node_id_with_malformed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] patch = [{'path': '/node_uuid', 'op': 'replace', ...
13,066
[ 0.006407382898032665, 0.004283071495592594, 0.03454015776515007, -0.013342972844839096, 0.008210176602005959, 0.017430836334824562, -0.015972526744008064, -0.004926105961203575, 0.013802283443510532, 0.009249366819858551, -0.00457014050334692, 0.01826907880604267, 0.0022793288808315992, -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_update_port_add_nonexistent_property(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id, ...
13,067
[ 0.009523430839180946, -0.014425031840801239, 0.010961457155644894, -0.008857574313879013, 0.007005484774708748, 0.01351857092231512, -0.004067881498485804, 0.0066305906511843204, 0.0027025952003896236, 0.022046014666557312, 0.012444247491657734, 0.042346253991127014, -0.004856837913393974, ...
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_port_replace_node_id_with_nonexistent(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] patch = [{'path': '/node_uuid', 'op': 'replace'...
13,068
[ 0.0356886200606823, -0.027620287612080574, 0.04510931670665741, 0.004615797195583582, -0.012629691511392593, 0.02968321368098259, 0.002442561788484454, -0.0007116378401406109, -0.015529248863458633, 0.014463404193520546, 0.020468810573220253, 0.040502116084098816, -0.0035127047449350357, 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_update_port_replace_mac_with_duplicated(self): node_id = self.node['uuid'] address1 = data_utils.rand_mac_address() address2 = data_utils.rand_mac_address() _, port1 = self.create_port(node_id=node_id, address=address1) _, port2 = self.create_port(node_id=node_id, addr...
13,069
[ 0.012556873261928558, 0.003039467381313443, 0.01847151294350624, -0.010644003748893738, -0.005342538934201002, 0.0254423376172781, -0.01896439865231514, -0.01202878076583147, 0.008660721592605114, 0.014070739038288593, 0.014516684226691723, 0.02884560264647007, 0.003244836814701557, -0.005...
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_port_replace_nonexistent_property(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] patch = [{'path': '/nonexistent', ' op': 'replace', 'value': 'value'}...
13,070
[ 0.03693802282214165, 0.007105190306901932, 0.03034835122525692, 0.01780780218541622, -0.010355197824537754, 0.010657785460352898, -0.011487097479403019, -0.001028935774229467, -0.010685802437365055, 0.029631108045578003, 0.02651558257639408, 0.024946613237261772, -0.027098342776298523, 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 test_update_port_replace_mac_with_malformed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] patch = [{'path': '/address', 'op': 'replace', ...
13,071
[ 0.04205968603491783, 0.0123271020129323, 0.04342817887663841, -0.009873442351818085, -0.01379181444644928, 0.029379772022366524, -0.009803948923945427, 0.005286862142384052, 0.009322838857769966, 0.021564410999417305, 0.03992142155766487, 0.018773972988128662, -0.019019873812794685, -0.009...
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_port_remove_mandatory_field_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] self.assertRaises(lib_exc.BadRequest, self.client.update_port, po...
13,072
[ 0.04816566780209541, 0.02315487153828144, 0.03420204296708107, 0.0005212884279899299, -0.022039107978343964, 0.040454741567373276, -0.012494351714849472, 0.011953040026128292, 0.013842105865478516, 0.025099175050854683, 0.050419293344020844, 0.027330702170729637, -0.01969710737466812, 0.01...
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_port_remove_mandatory_field_mac(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id,...
13,073
[ 0.0121615557000041, 0.002668154425919056, 0.028051139786839485, -0.015605435706675053, 0.004944183863699436, 0.027391916140913963, -0.021618017926812172, -0.000022565387553186156, 0.017162568867206573, 0.012832146137952805, 0.015491776168346405, 0.006546781398355961, -0.0016963665839284658, ...
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_port_remove_nonexistent_property(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() _, port = self.create_port(node_id=node_id, address=address) port_id = port['uuid'] self.assertRaises(lib_exc.BadRequest, self.client.update_port, port_id...
13,074
[ 0.04070911183953285, 0.012540607713162899, 0.04882221296429634, -0.0044993022456765175, 0.007042125798761845, 0.02649323083460331, 0.006916480604559183, 0.001355175394564867, -0.0014165024040266871, 0.018882708624005318, 0.044610101729631424, 0.03372083231806755, -0.031088262796401978, -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_update_port_mixed_ops_integrity(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() extra = {'key1': 'value1', 'key2': 'value2'} _, port = self.create_port(node_id=node_id, address=address, extra=extra) port_id =...
13,075
[ 0.023483075201511383, -0.035741861909627914, 0.051466211676597595, 0.00008213338151108474, 0.011670416221022606, -0.01094626821577549, -0.01933215744793415, -0.01582779921591282, 0.03424184024333954, 0.04520750790834427, 0.020948559045791626, -0.024194292724132538, -0.023379625752568245, -...
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 GenericIPAddressFieldTest(SimpleTestCase): def test_generic_ipaddress_invalid_arguments(self): with self.assertRaises(ValueError): GenericIPAddressField(protocol='hamster') with self.assertRaises(ValueError): GenericIPAddressField(protocol='ipv4', unpack_ipv4=True) ...
13,076
[ 0.035803232342004776, -0.034869235008955, 0.0523996464908123, 0.012620938010513783, 0.0021269393619149923, -0.03395918384194374, -0.01747054047882557, 0.013974037021398544, 0.020104890689253807, 0.047011200338602066, 0.01719512976706028, -0.03692881762981415, -0.020990991964936256, -0.0321...
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_generic_ipaddress_as_generic(self): # The edge cases of the IPv6 validation code are not deeply tested # here, they are covered in the tests for django.utils.ipv6 f = GenericIPAddressField() with self.assertRaisesMessage(ValidationError, "'This field is required.'"): ...
13,077
[ 0.019380956888198853, -0.041518837213516235, 0.03256471827626228, 0.03553371503949165, 0.030608950182795525, -0.04401656612753868, -0.03291817009449005, 0.006927661132067442, 0.019322047010064125, 0.044322893023490906, 0.01751944236457348, -0.00990844052284956, 0.00040720627293922007, -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 test_generic_ipaddress_as_ipv4_only(self): f = GenericIPAddressField(protocol="IPv4") with self.assertRaisesMessage(ValidationError, "'This field is required.'"): f.clean('') with self.assertRaisesMessage(ValidationError, "'This field is required.'"): f.clean(None) ...
13,078
[ 0.022694600746035576, -0.036779243499040604, 0.044738028198480606, 0.022393131628632545, 0.011624651961028576, -0.033306315541267395, -0.029133982956409454, 0.004603434819728136, 0.011588475666940212, 0.03911864385008812, 0.01535081211477518, -0.014337874948978424, -0.011775386519730091, -...
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_generic_ipaddress_as_ipv6_only(self): f = GenericIPAddressField(protocol="IPv6") with self.assertRaisesMessage(ValidationError, "'This field is required.'"): f.clean('') with self.assertRaisesMessage(ValidationError, "'This field is required.'"): f.clean(None) ...
13,079
[ 0.03065403550863266, -0.034889958798885345, 0.02368606999516487, 0.022006740793585777, 0.013835673220455647, -0.02065325155854225, -0.008077075704932213, 0.004771677777171135, 0.04539203643798828, 0.02601708099246025, 0.005861989222466946, -0.008597166277468204, -0.0430108942091465, -0.012...
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_generic_ipaddress_normalization(self): # Test the normalizing code f = GenericIPAddressField() self.assertEqual(f.clean(' ::ffff:0a0a:0a0a '), '::ffff:10.10.10.10') self.assertEqual(f.clean(' ::ffff:10.10.10.10 '), '::ffff:10.10.10.10') self.assertEqual(f.clean(' 2001:...
13,080
[ 0.029470011591911316, -0.03942476585507393, 0.03213118389248848, 0.025453614071011543, 0.01090341154485941, -0.04797501116991043, -0.03715784102678299, -0.000227731914492324, 0.03503875806927681, 0.054455455392599106, 0.017494739964604378, -0.02048855647444725, -0.020969046279788017, -0.02...
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_generic_ipaddress_as_generic_not_required(self): f = GenericIPAddressField(required=False) self.assertEqual(f.clean(''), '') self.assertEqual(f.clean(None), '') self.assertEqual(f.clean('127.0.0.1'), '127.0.0.1') with self.assertRaisesMessage(ValidationError, "'Enter a v...
13,081
[ -0.011564592830836773, 0.010020270943641663, 0.04834914579987526, -0.040698811411857605, -0.009248110465705395, -0.046377163380384445, -0.008024532347917557, -0.011362642981112003, -0.025540702044963837, 0.006789075210690498, -0.009503517299890518, -0.028011618182063103, 0.001144876820035278...
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": "config", "annotation": null, "type_comment": null}}], "kwarg": nu...
def initAlgorithm(self, config=None): self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input layer'))) self.addParameter(QgsProcessingParameterField(self.FIELD, s...
13,082
[ 0.046019185334444046, 0.01694767363369465, 0.08540412783622742, -0.0058195581659674644, -0.025298871099948883, 0.004032518714666367, 0.021736472845077515, 0.004289478529244661, 0.007329197600483894, -0.009536716155707836, -0.0003982148482464254, -0.012766235508024693, 0.01401599496603012, ...
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): # Adding field 'ReleaseProject.new_groups' db.add_column( 'sentry_release_project', 'new_groups', self.gf('sentry.db.models.fields.bounded.BoundedPositiveIntegerField')(null=True), keep_default=False )
13,083
[ -0.010808906517922878, -0.030434591695666313, 0.04727129638195038, -0.041744742542505264, 0.010532579384744167, 0.037811893969774246, -0.007666483987122774, -0.023982664570212364, -0.008315532468259335, 0.03922566398978233, -0.0016145885456353426, -0.043826840817928314, -0.015769951045513153...
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": "height", "annotation":...
class Solution: # @param {integer[]} height # @return {integer} def trap(self, height): i, j = 0, len(height) - 1 res = 0 while i < j: if height[i] < height[j]: h = height[i] i += 1 while i <= j and height[i] < h: ...
13,084
[ 0.028193367645144463, -0.01187654584646225, 0.05925142765045166, -0.047076478600502014, 0.01735527440905571, 0.04757779836654663, -0.006445562466979027, 0.01006223913282156, -0.010312899947166443, 0.051898714154958725, -0.008027112111449242, -0.022583341225981712, -0.04884304106235504, -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": "height", "annotation": null, "type_comment": null}}], "kwarg": nu...
def trap(self, height): i, j = 0, len(height) - 1 res = 0 while i < j: if height[i] < height[j]: h = height[i] i += 1 while i <= j and height[i] < h: res += h - height[i] i += 1 else:...
13,085
[ 0.03327148035168648, 0.05157328397035599, 0.004009735770523548, -0.03093402273952961, -0.005479971878230572, -0.001352120190858841, 0.007273473776876926, 0.05085214972496033, -0.0014787842519581318, 0.030088558793067932, 0.007671339437365532, -0.035857606679201126, 0.0006531362305395305, 0...
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": "text", "annotation": null, "type_comment": null}}], "kwarg": null...
def get_tokens_unprocessed(self, text): erlexer = ErlangLexer(**self.options) curcode = '' insertions = [] for match in line_re.finditer(text): line = match.group() m = self._prompt_re.match(line) if m is not None: end = m.end() ...
13,086
[ -0.010633612051606178, 0.05054818466305733, 0.03143850341439247, -0.04472897946834564, -0.022216543555259705, 0.005446258466690779, 0.01940557174384594, 0.04919201508164406, 0.0011889610905200243, 0.06046056002378464, -0.045912545174360275, -0.053211212158203125, 0.004441459197551012, 0.03...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "term", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}, {"_type": "ar...
def gen_elixir_sigstr_rules(term, token, interpol=True): if interpol: return [ (r'[^#%s\\]+' % (term,), token), include('escapes'), (r'\\.', token), (r'%s[a-zA-Z]*' % (term,), token, '#pop'), include('interpol') ] else: return [...
13,087
[ 0.0063660964369773865, 0.022191081196069717, -0.01261185109615326, 0.004169853404164314, -0.03841319680213928, 0.001975114457309246, -0.009176084771752357, 0.008724801242351532, 0.011691234074532986, 0.04024239629507065, -0.00960329920053482, -0.0638294443488121, 0.008941417559981346, 0.01...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "symbol", "annotation": null, "type_comment": null}}, {"_type": "a...
def gen_elixir_string_rules(name, symbol, token): states = {} states['string_' + name] = [ (r'[^#%s\\]+' % (symbol,), token), include('escapes'), (r'\\.', token), (r'(%s)' % (symbol,), bygroups(token), "#pop"), include('interpol') ] return states
13,088
[ 0.025725077837705612, 0.06059104949235916, 0.032750505954027176, -0.016505837440490723, -0.04465978220105171, 0.019052227959036827, -0.019574565812945366, 0.003783675841987133, 0.009153949096798897, 0.051606860011816025, -0.0013776628766208887, -0.06513537466526031, 0.035440538078546524, 0...
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": "List", "_fields": {"c...
def gen_elixir_sigil_rules(): # all valid sigil terminators (excluding heredocs) terminators = [ (r'\{', r'\}', 'cb'), (r'\[', r'\]', 'sb'), (r'\(', r'\)', 'pa'), (r'<', r'>', 'ab'), (r'/', r'/', 'slas'), (r'\|', r'\|', 'pipe'), ...
13,089
[ 0.010328657925128937, 0.06301159411668777, -0.031550999730825424, -0.02278181165456772, 0.000051646824431372806, -0.004076655954122543, -0.008345420472323895, 0.04108862206339836, 0.016792545095086098, 0.04452397674322128, -0.0031330641359090805, -0.032319433987140656, 0.007373576983809471, ...
18
{"_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": "text", "annotation": null, "type_comment": null}}], "kwarg": null...
def get_tokens_unprocessed(self, text): for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): if token is Name: if value in self.KEYWORD: yield index, Keyword, value elif value in self.KEYWORD_OPERATOR: yield...
13,090
[ -0.043915942311286926, 0.02108781784772873, -0.026512853801250458, -0.05070529505610466, -0.01406212616711855, 0.011634287424385548, 0.026340972632169724, -0.0281242523342371, 0.0168015006929636, 0.021732376888394356, 0.026555825024843216, -0.01761794276535511, 0.024837002158164978, -0.060...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Try", "_fields": {"body": [{"_type": "Assign", "_fields": {"va...
def parse_manifest_json(): try: manifest_file = os.path.join(os.path.dirname(__file__), os.pardir, 'static/dist/manifest.json') with open(manifest_file) as file: manifest.update(json.load(file)) for source, target in manifest.copy().items(): ...
13,091
[ 0.020277922973036766, 0.059841498732566833, -0.0005629222723655403, -0.016804978251457214, -0.010978573933243752, -0.0029609075281769037, -0.01951463893055916, 0.027987096458673477, 0.01055240724235773, 0.0251883864402771, 0.00929298810660839, -0.039945218712091446, 0.0037718971725553274, ...
14
{"_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": "text", "annotation": null, "type_comment": null}}], "kwarg": null...
def get_tokens_unprocessed(self, text): exlexer = ElixirLexer(**self.options) curcode = '' in_error = False insertions = [] for match in line_re.finditer(text): line = match.group() if line.startswith(u'** '): in_error = True ...
13,092
[ 0.008719745092093945, 0.023130269721150398, 0.02287110686302185, -0.08759699016809464, -0.02658577263355255, -0.03809691593050957, -0.018648914992809296, -0.016305653378367424, 0.030581196770071983, 0.0031315491069108248, 0.02479322999715805, -0.0025133381132036448, 0.03246012702584267, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "unused_input", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlya...
def MapFn(unused_input): if isinstance(source_dataset.output_types, dtypes.DType): output_types = [source_dataset.output_types] elif isinstance(source_dataset.output_types, (list, tuple)): output_types = source_dataset.output_types else: raise ValueError('source dataset has invalid output ...
13,093
[ 0.025428978726267815, 0.01352886762470007, 0.03646381199359894, -0.020064257085323334, -0.021825352683663368, 0.004306028131395578, 0.005868617445230484, -0.012368378229439259, -0.027912834659218788, 0.027648160234093666, -0.03300270065665245, -0.0283811017870903, 0.03497757017612457, -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": "saved_model_path", "annotation": {"_type": "Name", "_fields": {"i...
def __init__(self, saved_model_path: str, model=None, **config_kw): super().__init__() # By default, SavedModels from the original T5 codebase have batch_size=1 # hardcoded. Use setdefault here so that the user can still override if # they've fixed this upstream. config_kw.setdefault("inference_batc...
13,094
[ 0.006214609835296869, 0.010221542790532112, 0.012274682521820068, -0.031371086835861206, -0.027794649824500084, -0.03095162659883499, 0.028942640870809555, 0.018014641478657722, -0.01523296907544136, 0.025145437568426132, -0.02302606776356697, -0.02781672589480877, 0.004627841990441084, -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": "model_name", "annotation": null, "type_comment": null}}, {"_type"...
def __init__(self, model_name="t5-small", model=None, tokenizer=None, **config_kw): super().__init__() self.config = T5ModelConfig(**config_kw) assert self.config.num_to_generate <= self.config.beam_size self.tokenizer = tokenizer or transforme...
13,095
[ 0.053187429904937744, -0.0025459476746618748, 0.029885444790124893, -0.06704734265804291, -0.019728725776076317, -0.05873139575123787, -0.000996181508526206, 0.013914057053625584, 0.016675211489200592, -0.02644212171435356, -0.01299367193132639, 0.0128962192684412, -0.03278736397624016, -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 output_spec(self): spec = { "output_text": lit_types.GeneratedText(parent="target_text"), "input_tokens": lit_types.Tokens(parent="input_text"), "encoder_final_embedding": lit_types.Embeddings(), # If target text is given, the following will also be populated. "target_tok...
13,096
[ -0.010422220453619957, -0.02993047796189785, 0.023061934858560562, -0.07405291497707367, -0.028088252991437912, 0.011894863098859787, 0.0007860730984248221, 0.0012245966354385018, 0.041097547858953476, 0.017239591106772423, -0.013259475119411945, 0.010086753405630589, 0.012781861238181591, ...
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 test_suite(): suite = additional_tests() loader = unittest.TestLoader() for fn in os.listdir(here): if fn.startswith("test") and fn.endswith(".py"): modname = "json.tests." + fn[:-3] __import__(modname) module = sys.modules[modname] suite.addTests(...
13,097
[ 0.0005206105415709317, 0.029774973168969154, 0.02451525442302227, -0.015068077482283115, -0.020406804978847504, -0.016693398356437683, -0.0007950245053507388, -0.03950432315468788, -0.013002566061913967, 0.017235171049833298, 0.0033014328218996525, -0.010367062874138355, -0.02379288896918296...
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": "model", "annotation": {"_type": "Attribute", "_fields": {"ctx": {...
def __init__(self, model: lit_model.Model): model = validate_t5_model(model) super().__init__(model) # TODO(gehrmann): temp solution for ROUGE. self._scorer = rouge_scorer.RougeScorer(["rougeL"], use_stemmer=True) # If output is List[(str, score)] instead of just str self._multi_output = isinst...
13,098
[ 0.008972479030489922, -0.008297668769955635, 0.07287952303886414, -0.042188145220279694, -0.004661190323531628, 0.0020525483414530754, 0.008010249584913254, 0.006910558324307203, 0.02879191003739834, 0.024193203076720238, -0.035614993423223495, -0.004186323843896389, -0.04908620938658714, ...
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 AllWavelengthsTests(unittest.TestCase): def test_run_for_landsat_etm(self): s = SixS() results = SixSHelpers.Wavelengths.run_landsat_etm(s, output_name="apparent_radiance") a = np.array([ 138.392, 129.426, 111.635, 75.822, 16.684, 5.532]) self.assertAlmostEqual(results[0], [0.47750000000000004...
13,099
[ 0.017939601093530655, -0.012150119990110397, 0.06350255012512207, -0.037047483026981354, 0.00004852624624618329, -0.01141669973731041, -0.003699555993080139, 0.02946663834154606, 0.04307061806321144, 0.016342950984835625, -0.029907988384366035, -0.014551586471498013, -0.054883237928152084, ...
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_run_for_landsat_etm(self): s = SixS() results = SixSHelpers.Wavelengths.run_landsat_etm(s, output_name="apparent_radiance") a = np.array([ 138.392, 129.426, 111.635, 75.822, 16.684, 5.532]) self.assertAlmostEqual(results[0], [0.47750000000000004, 0.56125000000000003, 0.65874999999999995, 0.8...
13,100
[ 0.000355829339241609, -0.027964739128947258, 0.04991016164422035, -0.0574844665825367, 0.003805963322520256, 0.027789175510406494, 0.007712248712778091, -0.023099124431610107, 0.010759526863694191, -0.0008064942667260766, 0.0026412883307784796, -0.025657333433628082, -0.04807928577065468, ...
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 ParallelEquivalenceTests(unittest.TestCase): def test_wavelengths_equiv(self): s = SixS() s.altitudes.set_sensor_satellite_level() s.altitudes.set_target_sea_level() serial_res = SixSHelpers.Wavelengths.run_vnir(s, spacing=0.05, output_name='apparent_radiance', n=1) for i in range(2, 10, 2): par...