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,401
[ 0.005753525998443365, -0.01856769062578678, -0.024399418383836746, 0.0015068093780428171, -0.006585832219570875, -0.007954389788210392, 0.012311428785324097, -0.035124439746141434, -0.007608060725033283, 0.053178220987319946, 0.00499383732676506, -0.03440943732857704, 0.027683956548571587, ...
18
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "foundCompilers", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "expectedCompilers", "annotation": null, "type_comment":...
def __compareCompilers__(foundCompilers, expectedCompilers): equal = True flags = 0 isWin = platform.system() in ('Microsoft', 'Windows') if isWin: flags = re.IGNORECASE for currentFound in foundCompilers: if isinstance(currentFound, dict): foundExp = False fo...
13,402
[ -0.0005926591111347079, -0.013300502672791481, 0.0007912017754279077, -0.05006689205765724, -0.03239622339606285, -0.010931350290775299, 0.05467456579208374, -0.00040970297413878143, 0.018537575379014015, 0.04773930460214615, 0.017730044201016426, 0.02733728289604187, -0.0031915269792079926,...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settingsFolder", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonl...
def __checkCreatedSettings__(settingsFolder): waitForCleanShutdown() qtProj = os.path.join(settingsFolder, "QtProject") folders = [] files = [{os.path.join(qtProj, "QtCreator.db"):0}, {os.path.join(qtProj, "QtCreator.ini"):30}] folders.append(os.path.join(qtProj, "qtcreator")) files...
13,403
[ 0.043300408869981766, 0.03285439684987068, 0.01038283109664917, -0.03512893244624138, -0.02493564411997795, 0.023166561499238014, 0.016206063330173492, -0.007313262205570936, -0.02181868813931942, -0.0005495476652868092, 0.0020441857632249594, -0.03500256687402725, -0.0023087584413588047, ...
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": "modelConfig", "annotation": null, "type_comment": null}}, {"_type...
def __init__(self, modelConfig, inferenceArgs, metricSpecs, sourceSpec, sinkSpec=None): self.model = ModelFactory.create(modelConfig) self.model.enableInference(inferenceArgs) self.metricsManager = MetricsManager(metricSpecs, self.model.getFieldInfo(), ...
13,404
[ -0.03962695598602295, 0.03549028933048248, 0.0013374098343774676, -0.014333359897136688, 0.04384094476699829, 0.02972988225519657, 0.000983425066806376, 0.058222632855176926, 0.011453157290816307, 0.006533615291118622, 0.01418838370591402, -0.0336732491850853, 0.009273674339056015, 0.00231...
7
{"_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": "uri", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __init__(self, uri, module): self.module = module conn = libvirt.open(uri) if not conn: raise Exception("hypervisor connection failure") self.conn = conn
13,405
[ -0.015464382246136665, 0.020466143265366554, 0.026627734303474426, -0.014836141839623451, 0.014026678167283535, 0.03854013979434967, -0.029768936336040497, 0.003609362756833434, 0.019741250202059746, 0.05011426657438278, 0.04402516409754753, -0.01368839479982853, 0.021021895110607147, 0.02...
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": "uri", "annotation": nu...
class LibvirtConnection(object): def __init__(self, uri, module): self.module = module conn = libvirt.open(uri) if not conn: raise Exception("hypervisor connection failure") self.conn = conn def find_entry(self, entryid): # entryid = -1 returns a list of...
13,406
[ 0.07496590167284012, 0.03798145800828934, 0.01693735644221306, -0.018693998456001282, 0.022231021896004677, 0.03237919136881828, 0.020201386883854866, 0.014254915527999401, 0.0017002635868266225, 0.034135833382606506, 0.03845622390508652, -0.02083045430481434, 0.05094262957572937, 0.007453...
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": "entryid", "annotation": null, "type_comment": null}}], "kwarg": n...
def create(self, entryid): if not self.module.check_mode: return self.find_entry(entryid).create() else: try: state = self.find_entry(entryid).isActive() except: return self.module.exit_json(changed=True) if not state: ...
13,407
[ 0.028220780193805695, -0.03380637615919113, 0.009414434432983398, -0.021250044927001, 0.04873884096741676, -0.020630674436688423, -0.01655408926308155, 0.03268025070428848, -0.04905415698885918, 0.06662176549434662, 0.008400918915867805, -0.04423432797193527, 0.03527034446597099, 0.0190653...
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": "entryid", "annotation": null, "type_comment": null}}], "kwarg": n...
def find_entry(self, entryid): # entryid = -1 returns a list of everything results = [] # Get active entries for name in self.conn.listNetworks(): entry = self.conn.networkLookupByName(name) results.append(entry) # Get inactive entries for name ...
13,408
[ 0.0285755954682827, 0.02780066430568695, 0.012041707523167133, -0.019252203404903412, 0.008439487777650356, 0.03736622631549835, 0.000060541518905665725, -0.00020905742712784559, -0.036639727652072906, 0.0460599847137928, 0.05957285314798355, -0.007712989114224911, -0.001607377314940095, 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": "entryid", "annotation": null, "type_comment": null}}, {"_type": "...
def modify(self, entryid, xml): network = self.find_entry(entryid) # identify what type of entry is given in the xml new_data = etree.fromstring(xml) old_data = etree.fromstring(network.XMLDesc(0)) if new_data.tag == 'host': mac_addr = new_data.get('mac') ...
13,409
[ 0.04059166833758354, 0.0394844114780426, -0.03562077879905701, -0.006973380222916603, 0.023888539522886276, 0.05710633099079132, 0.0009276244672946632, 0.005076903384178877, 0.023546937853097916, 0.031639356166124344, 0.04268839582800865, -0.019553735852241516, 0.02315821871161461, 0.01752...
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": "entryid", "annotation": null, "type_comment": null}}], "kwarg": n...
def get_status(self, entryid): if not self.module.check_mode: state = self.find_entry(entryid).isActive() return ENTRY_STATE_ACTIVE_MAP.get(state, "unknown") else: try: state = self.find_entry(entryid).isActive() return ENTRY_STATE_ACTI...
13,410
[ 0.017322717234492302, 0.0008595826802775264, -0.02701585367321968, -0.03328460454940796, 0.000269273150479421, 0.010657988488674164, 0.033396147191524506, 0.016274208202958107, 0.03948642686009407, 0.03883947432041168, 0.005050135310739279, -0.032548416405916214, 0.019475508481264114, -0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "entryid", "annotation": null, "type_comment": null}}, {"_type": "...
def set_autostart(self, entryid, val): if not self.module.check_mode: return self.find_entry(entryid).setAutostart(val) else: try: state = self.find_entry(entryid).autostart() except: return self.module.exit_json(changed=True) ...
13,411
[ 0.019251996651291847, 0.014359420165419579, 0.00044836345477961004, -0.04833630844950676, -0.011807027272880077, 0.012567440047860146, 0.03180764988064766, 0.03503792732954025, 0.02574792504310608, 0.04593127965927124, -0.009313581511378288, -0.04154564440250397, 0.017801908776164055, 0.00...
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": "entryid", "annotation": null, "type_comment": null}}], "kwarg": n...
def get_autostart2(self, entryid): if not self.module.check_mode: return self.find_entry(entryid).autostart() else: try: return self.find_entry(entryid).autostart() except: return self.module.exit_json(changed=True)
13,412
[ 0.02942826971411705, 0.04030100628733635, 0.03544871136546135, -0.025407154113054276, 0.015702566131949425, 0.011013137176632881, 0.009109284728765488, -0.035605959594249725, 0.029495662078261375, 0.05144331231713295, 0.04766930267214775, -0.0362124964594841, 0.0552622452378273, 0.00386105...
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": "entryid", "annotation": null, "type_comment": null}}, {"_type": "...
def define_from_xml(self, entryid, xml): if not self.module.check_mode: return self.conn.networkDefineXML(xml) else: try: self.find_entry(entryid) except: return self.module.exit_json(changed=True)
13,413
[ -0.052862927317619324, 0.0078043765388429165, -0.010437902994453907, -0.04266552999615669, 0.009974931366741657, 0.0019375657429918647, -0.04230477288365364, 0.01770114339888096, -0.005318159703165293, 0.056903403252363205, 0.002024748595431447, -0.029630174860358238, 0.021873898804187775, ...
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": "uri", "annotation": nu...
class VirtNetwork(object): def __init__(self, uri, module): self.module = module self.uri = uri self.conn = LibvirtConnection(self.uri, self.module) def get_net(self, entryid): return self.conn.find_entry(entryid) def list_nets(self, state=None): results = [] ...
13,414
[ 0.0203198604285717, -0.03296332806348801, 0.03799813613295555, -0.030276590958237648, 0.018908757716417313, -0.015081851743161678, -0.056353744119405746, -0.0006293511833064258, -0.0041373493149876595, 0.06701038032770157, -0.001298213261179626, -0.003448731731623411, 0.05152213200926781, ...
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": "state", "annotation": null, "type_comment": null}}], "kwarg": nul...
def list_nets(self, state=None): results = [] for entry in self.conn.find_entry(-1): if state: if state == self.conn.get_status2(entry): results.append(entry.name()) else: results.append(entry.name()) return results
13,415
[ -0.005829376634210348, -0.027251942083239555, 0.028584372252225876, -0.03537221625447273, 0.020099565386772156, 0.006486163474619389, -0.03376324474811554, 0.021042320877313614, -0.012576369568705559, 0.055157531052827835, 0.009861230850219727, -0.02672399953007698, -0.001690676319412887, ...
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": "facts_mode", "annotation": null, "type_comment": null}}], "kwarg"...
def facts(self, facts_mode='facts'): results = dict() for entry in self.list_nets(): results[entry] = dict() results[entry]["autostart"] = self.conn.get_autostart(entry) results[entry]["persistent"] = self.conn.get_persistent(entry) results[entry]["state"]...
13,416
[ -0.04811578616499901, 0.041956037282943726, -0.012958720326423645, -0.021210461854934692, -0.015806151553988457, 0.0033442797139286995, -0.039352670311927795, 0.016294283792376518, 0.0370049923658371, 0.09483691304922104, 0.030031690374016762, -0.0228491872549057, 0.02986897900700569, 0.00...
15
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def core(module): state = module.params.get('state', None) name = module.params.get('name', None) command = module.params.get('command', None) uri = module.params.get('uri', None) xml = module.params.get('xml', None) autostart = module.params.get('autostart', None) v = VirtNetwork(uri, mod...
13,417
[ -0.027257179841399193, 0.051652710884809494, 0.0028050094842910767, -0.017348729074001312, -0.01201891340315342, 0.05832988768815994, -0.026088673621416092, 0.01796875335276127, 0.03605674207210541, 0.04569095000624657, 0.04247159883379936, -0.05437127500772476, -0.0023340301122516394, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): module = AnsibleModule( argument_spec=dict( name=dict(aliases=['network']), state=dict(choices=['active', 'inactive', 'present', 'absent']), command=dict(choices=ALL_COMMANDS), uri=dict(default='qemu:///system'), xml=dict(), ...
13,418
[ -0.002499965950846672, 0.0003579463518690318, 0.026775335893034935, -0.06013936921954155, -0.011314098723232746, -0.01622641459107399, 0.027873452752828598, -0.0012353804195299745, 0.024579105898737907, 0.0062966435216367245, 0.01981281489133835, -0.048877838999032974, -0.007377236150205135,...
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 TPluginsSongsMenu(PluginTestCase): def setUp(self): config.init() self.h = SongsMenuPluginHandler() library = SongLibrary() library.librarian = SongLibrarian() self.lib = library self.parent = Gtk.Window() def tearDown(self): self.lib.destroy() ...
13,419
[ 0.026284363120794296, 0.01785264164209366, 0.021785875782370567, -0.0016869333339855075, 0.020337408408522606, 0.02687317132949829, 0.055677630007267, -0.009014641866087914, -0.026190154254436493, -0.004875325597822666, 0.023434536531567574, 0.014861499890685081, 0.03787209466099739, -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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _should_loaddata(self): # Must do database stuff in this new thread if database in memory. if not hasattr(self, 'fixtures'): return False if settings.DATABASE_ENGINE != 'sqlite3': return False if settings.TEST_DATABASE_NAME and settings.TEST_DATABASE_NAME != '...
13,420
[ 0.0196155346930027, 0.019706588238477707, 0.025117769837379456, -0.03714984655380249, 0.011414212174713612, 0.0068290154449641705, 0.020409001037478447, 0.007876131683588028, 0.01775544136762619, 0.009846789762377739, 0.010555706918239594, 0.004682753700762987, 0.012292228639125824, 0.0384...
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_handle_single(self): self.skipTest("Pops up windows and needs user input.. so disabled." "Still worth keeping whilst we don't have unit tests " "for all plugins.") # Ignored... for id_, plugin in self.plugins.items(): if self.h.plu...
13,421
[ -0.001874368404969573, -0.018748784437775612, -0.01501534879207611, 0.0072067552246153355, 0.047698210924863815, -0.028684211894869804, 0.02035028487443924, 0.013158830814063549, -0.015872202813625336, 0.02617485262453556, -0.029867487028241158, -0.021768175065517426, 0.02217620052397251, ...
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": "id", "annotation": nul...
class User(login.UserMixin): def __init__(self, id, password): self.id = id self.password = password def is_authenticated(self): if not app.config.get('webui_username'): return True if self.id == app.config.get('webui_username') \ and self.password =...
13,422
[ 0.01192373875528574, 0.027368834242224693, -0.004223121330142021, -0.038597073405981064, -0.01885993406176567, 0.028697174042463303, -0.018722087144851685, -0.010564069263637066, 0.0329328291118145, 0.07639212906360626, 0.007406126707792282, -0.06265758723020554, 0.0536850206553936, 0.0075...
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 main(): argument_specs = dict( state=dict(default='present', choices=['absent', 'present']), active_standby_se_tag=dict(type='str',), analytics_policy=dict(type='dict',), analytics_profile_ref=dict(type='str',), application_profile_ref=dict(type='str',)...
13,423
[ 0.0001905167882796377, 0.00005083050564280711, -0.02604520693421364, 0.010364113375544548, 0.033301085233688354, -0.06976037472486496, -0.04601386561989784, 0.045933909714221954, 0.03354094922542572, -0.011223625391721725, -0.02714458294212818, 0.0038977861404418945, -0.0021425331942737103, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def load_user_from_request(request): api_key = request.headers.get('Authorization') if api_key: api_key = api_key[len("Basic "):] try: api_key = base64.b64decode(api_key).decode('utf8') return User(*api_key.split(":", 1)) except Exception as e: app.log...
13,424
[ -0.006079703103750944, 0.04934927821159363, 0.05109159275889397, -0.06252708286046982, 0.005650259088724852, 0.03190157189965248, 0.013435469940304756, -0.027926145121455193, -0.019128672778606415, 0.03209788724780083, 0.03271137923002243, -0.026478303596377373, -0.0062422784976661205, -0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "For", "_fields": {"body": [{"_type": "With", "_fields": {"body...
def main(): for path in sys.argv[1:] or sys.stdin.read().splitlines(): with open(path, 'r') as f: for i, line in enumerate(f.readlines()): if MAIN_DISPLAY_IMPORT in line: lineno = i + 1 colno = line.index(MAIN_DISPLAY_IMPORT) + 1 ...
13,425
[ -0.005792531184852123, -0.01020884234458208, -0.018296953290700912, -0.06294512748718262, 0.06091463938355446, 0.023937197402119637, -0.012780793942511082, -0.024207929149270058, -0.037428662180900574, 0.020293598994612694, -0.0034038876183331013, -0.060012198984622955, 0.04568598046898842, ...
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": "slicc", "annotation": ...
class TypeFieldEnumAST(TypeFieldAST): def __init__(self, slicc, field_id, pairs_ast): super(TypeFieldEnumAST, self).__init__(slicc, pairs_ast) self.field_id = field_id self.pairs_ast = pairs_ast def __repr__(self): return "[TypeFieldEnum: %r]" % self.field_id def generate(...
13,426
[ 0.004014994017779827, 0.022170916199684143, -0.03570074960589409, -0.0010104491375386715, -0.017464421689510345, 0.0051514143124222755, 0.0020530610345304012, 0.051932260394096375, -0.007504662033170462, 0.0012630614219233394, 0.017614513635635376, 0.037073031067848206, -0.02684524841606617,...
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}}, {"_type": "arg", "_fields": {"arg": "queue", "annotation": ...
class TriggerHandler(RequestHandler): def initialize(self, queue, wake_callback): self.queue = queue self.wake_callback = wake_callback @gen.coroutine def get(self): logging.debug("queuing trigger") event = Event() self.queue.append(event.set) if self.get_arg...
13,427
[ 0.008326064795255661, 0.04015598073601723, 0.014205086044967175, -0.008876649662852287, 0.029119815677404404, 0.020946690812706947, -0.028361231088638306, -0.039739981293678284, 0.016713306307792664, 0.07639668881893158, 0.014890258200466633, -0.05192625895142555, 0.03597153723239899, 0.02...
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": "type", "annotation": null, "type_comment": null}}], "kwarg": null...
def generate(self, type): if str(type) == "State": self.error("States must in a State Declaration, not a normal enum.") # Add enumeration if not type.addEnum(self.field_id, self.pairs_ast.pairs): self.error("Duplicate enumeration: %s:%s" % (type, self.field_id)) ...
13,428
[ 0.056411225348711014, 0.03593256697058678, -0.0011822127271443605, -0.03003685735166073, 0.021997252479195595, -0.012673543766140938, -0.02223174087703228, 0.014404292218387127, -0.010194665752351284, 0.02170693315565586, 0.023560509085655212, -0.032694391906261444, -0.030751489102840424, ...
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": null, "vararg": null, "defaults": [], "kwonlyargs...
class ContentLengthHandler(RequestHandler): def get(self): self.stream = self.detach() IOLoop.current().spawn_callback(self.write_response) @gen.coroutine def write_response(self): yield self.stream.write( utf8( "HTTP/1.0 200 OK\r\nContent-Length: %s\r\n\...
13,429
[ 0.02581222727894783, -0.014836383052170277, -0.03618229553103447, -0.011869106441736221, 0.046983592212200165, -0.020801739767193794, -0.020175427198410034, 0.03088431991636753, -0.0032496300991624594, 0.009286857210099697, 0.025401530787348747, -0.0365929901599884, -0.04345160722732544, 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 write_response(self): yield self.stream.write( utf8( "HTTP/1.0 200 OK\r\nContent-Length: %s\r\n\r\nok" % self.get_argument("value") ) ) self.stream.close()
13,430
[ -0.014241889119148254, -0.054188650101423264, 0.022218376398086548, -0.0485793799161911, 0.05045771226286888, 0.025048742070794106, 0.002230521757155657, -0.025331778451800346, 0.00857472326606512, -0.04358764365315437, 0.020468695089221, -0.06401774287223816, 0.015065268613398075, 0.00541...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def test_singleton(self: typing.Any): # Class "constructor" reuses objects on the same IOLoop self.assertTrue(SimpleAsyncHTTPClient() is SimpleAsyncHTTPClient()) # unless force_instance is used self.assertTrue( SimpleAsyncHTTPClient() is not SimpleAsyncHTTPClient(force_instan...
13,431
[ -0.02348148822784424, 0.009174926206469536, 0.021243998780846596, -0.040493711829185486, -0.011935308575630188, -0.021085914224386215, 0.015480028465390205, 0.02343284711241722, 0.008956041187047958, 0.026485076174139977, -0.008153463713824749, -0.04650088772177696, -0.0131330955773592, -0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def get_app(self: typing.Any): # callable objects to finish pending /trigger requests self.triggers = ( collections.deque() ) # type: typing.Deque[typing.Callable[[], None]] return Application( [ url( "/trigger", ...
13,432
[ -0.030571769922971725, -0.007373339030891657, 0.030095260590314865, -0.060742270201444626, 0.019260967150330544, 0.01914810948073864, -0.016903504729270935, 0.009009769186377525, 0.020891128107905388, 0.019035253673791885, 0.026734624058008194, -0.04762575030326843, -0.043863844126462936, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def test_max_redirects(self: typing.Any): response = self.fetch("/countdown/5", max_redirects=3) self.assertEqual(302, response.code) # We requested 5, followed three redirects for 4, 3, 2, then the last # unfollowed redirect is to 1. self.assertTrue(response.request.url.endswith...
13,433
[ 0.03321842476725578, -0.02594299428164959, 0.06332990527153015, -0.038163647055625916, -0.01611727848649025, 0.0560285821557045, -0.00969625823199749, 0.042202673852443695, 0.015146358869969845, -0.006398365832865238, 0.042539261281490326, -0.020764751359820366, -0.022603027522563934, 0.02...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def test_connection_limit(self: typing.Any): with closing(self.create_client(max_clients=2)) as client: self.assertEqual(client.max_clients, 2) seen = [] # Send 4 requests. Two can be sent immediately, while the others # will be queued for i in range(...
13,434
[ -0.025474192574620247, -0.036036115139722824, 0.027896033599972725, -0.021000511944293976, 0.004215799272060394, 0.04383982717990875, 0.013264071196317673, 0.0149010568857193, 0.02446509152650833, 0.022648708894848824, 0.018421698361635208, -0.007349618244916201, -0.0375385545194149, 0.010...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def test_connect_timeout(self: typing.Any): timeout = 0.1 cleanup_event = Event() test = self class TimeoutResolver(Resolver): async def resolve(self, *args, **kwargs): await cleanup_event.wait() # Return something valid so the test doesn't r...
13,435
[ -0.031331390142440796, -0.03872699663043022, -0.005793434102088213, -0.02803334966301918, 0.021599670872092247, 0.01941346935927868, -0.021237386390566826, 0.007751645985990763, 0.0490458682179451, 0.0011992877116426826, 0.03390486165881157, -0.03328023478388786, -0.013879256322979927, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def test_see_other_redirect(self: typing.Any): for code in (302, 303): response = self.fetch("/see_other_post", method="POST", body="%d" % code) self.assertEqual(200, response.code) self.assertTrue(response.request.url.endswith("/see_other_post")) self.assertTrue(...
13,436
[ -0.033759646117687225, -0.01691550947725773, 0.016011446714401245, -0.05410108342766762, 0.013156508095562458, 0.01115805096924305, 0.0240885429084301, 0.05543338879942894, 0.06704346835613251, -0.017129629850387573, 0.004002861678600311, -0.011205633170902729, -0.05381558835506439, -0.011...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Any", "value": {"_type": "Name", "_fields": {"i...
def test_request_timeout(self: typing.Any): timeout = 0.1 if os.name == "nt": timeout = 0.5 with self.assertRaises(HTTPTimeoutError): self.fetch("/trigger?wake=false", request_timeout=timeout, raise_error=True) # trigger the hanging request to let it clean up aft...
13,437
[ -0.012968076393008232, -0.06080961227416992, 0.054522059857845306, -0.04239606484770775, -0.013012987561523914, 0.018963705748319626, -0.029079928994178772, -0.003087637247517705, 0.008768890053033829, -0.017066212370991707, 0.027844874188303947, -0.06242641061544418, -0.013046670705080032, ...
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 CreateAsyncHTTPClientTestCase(AsyncTestCase): def setUp(self): super(CreateAsyncHTTPClientTestCase, self).setUp() self.saved = AsyncHTTPClient._save_configuration() def tearDown(self): AsyncHTTPClient._restore_configuration(self.saved) super(CreateAsyncHTTPClientTestCase, ...
13,438
[ -0.0629037469625473, -0.0411091148853302, 0.012323955073952675, -0.010046822018921375, -0.01176427397876978, 0.013937152922153473, -0.005004206206649542, -0.011094851419329643, 0.005470606964081526, 0.022068988531827927, -0.0017695794813334942, -0.04521344229578972, -0.038892339915037155, ...
13
{"_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 ResolveTimeoutTestCase(AsyncHTTPTestCase): def setUp(self): self.cleanup_event = Event() test = self # Dummy Resolver subclass that never finishes. class BadResolver(Resolver): @gen.coroutine def resolve(self, *args, **kwargs): yield tes...
13,439
[ -0.002453831722959876, -0.03422529995441437, 0.056080594658851624, -0.02975156344473362, 0.007975717075169086, 0.03329632431268692, -0.02090187929570675, -0.0036303263623267412, 0.010029234923422337, -0.012247767299413681, 0.034738678485155106, -0.04652195796370506, -0.015205810777842999, ...
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_max_clients(self): AsyncHTTPClient.configure(SimpleAsyncHTTPClient) with closing(AsyncHTTPClient(force_instance=True)) as client: self.assertEqual(client.max_clients, 10) # type: ignore with closing(AsyncHTTPClient(max_clients=11, force_instance=True)) as client: ...
13,440
[ -0.027416033670306206, -0.02335657738149166, 0.017167378216981888, 0.005047844722867012, -0.03007527068257332, 0.0002882801927626133, 0.016390787437558174, 0.010842864401638508, 0.0045860083773732185, -0.002772490493953228, 0.03365229815244675, -0.01907355710864067, -0.04014742746949196, -...
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 setUp(self): self.cleanup_event = Event() test = self # Dummy Resolver subclass that never finishes. class BadResolver(Resolver): @gen.coroutine def resolve(self, *args, **kwargs): yield test.cleanup_event.wait() # Return somet...
13,441
[ -0.0019981754012405872, -0.0638120025396347, 0.006037730257958174, -0.01011508796364069, 0.007863090373575687, -0.0048901294358074665, -0.012518299743533134, 0.017270715907216072, 0.014106038957834244, 0.03549191728234291, 0.030156249180436134, -0.03950987011194229, -0.058627549558877945, ...
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 ChunkedWithContentLengthTest(AsyncHTTPTestCase): def get_app(self): class ChunkedWithContentLength(RequestHandler): def get(self): # Add an invalid Transfer-Encoding to the response self.set_header("Transfer-Encoding", "chunked") self.write("...
13,442
[ 0.054381828755140305, -0.0031736562959849834, 0.03242996707558632, -0.02190445177257061, 0.0015364526771008968, 0.016997285187244415, -0.015776420012116432, 0.0065073287114501, 0.03058088943362236, 0.032382555305957794, 0.048692360520362854, -0.01606089435517788, -0.04326366260647774, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_chunked_with_content_length(self): # Make sure the invalid headers are detected with ExpectLog( gen_log, ( "Malformed HTTP message from None: Response " "with both Transfer-Encoding and Content-Length" ), level=logg...
13,443
[ 0.011881623417139053, -0.03668829798698425, 0.0175026748329401, 0.019510993734002113, 0.0032817514147609472, -0.017906581982970238, -0.029193563386797905, 0.025603272020816803, 0.0013288288610056043, 0.030068697407841682, 0.015225082635879517, -0.04009907692670822, -0.05291193351149559, -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 get_app(self): class ChunkedWithContentLength(RequestHandler): def get(self): # Add an invalid Transfer-Encoding to the response self.set_header("Transfer-Encoding", "chunked") self.write("Hello world") return Application([("/chunkwithcl",...
13,444
[ 0.004064091015607119, -0.008906866423785686, 0.013813642784953117, 0.018283076584339142, 0.007760174106806517, 0.04467300325632095, -0.0017587060574442148, 0.0274566151201725, -0.050006452947854996, 0.05512657016515732, -0.009952222928404808, -0.013450968079268932, 0.00031517373281531036, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def get_current_realm_cluster(url): parts = urlparse(url) url = parts.scheme + '://' + parts.netloc + '/info' http_conn = client.http_connection(url) try: info = client.get_capabilities(http_conn) except client.ClientException: raise SkipTest('Unable to retrieve cluster info') tr...
13,445
[ 0.016462409868836403, 0.007354980334639549, -0.02570260316133499, -0.034687891602516174, 0.030630704015493393, 0.014486921019852161, -0.005586598534137011, 0.014752443879842758, -0.02767809107899666, -0.005496320780366659, 0.02430064231157303, 0.010142968967556953, -0.031098024919629097, 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": "Try", "_fields": {"body": [{"_type": "Expr", "_fields": {"valu...
def _check_pydot(): try: # Attempt to create an image of a blank graph # to check the pydot/graphviz installation. pydot.Dot.create(pydot.Dot()) except Exception: # pydot raises a generic Exception here, # so no specific class can be caught. raise ImportError('Failed to import pydot. You mus...
13,446
[ 0.029751094058156013, -0.013134418055415154, 0.031013119965791702, -0.024025235325098038, 0.008489461615681648, 0.010324073024094105, 0.02316051349043846, 0.016499821096658707, 0.012199584394693375, -0.03643515706062317, 0.017843645066022873, 0.0358976274728775, -0.015179367735981941, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_sync(self): base_headers = {'X-Container-Sync-Key': 'secret'} # setup dest container dest_container = 'dest-container-%s' % uuid.uuid4() dest_headers = base_headers.copy() dest_policy = None if len(ENABLED_POLICIES) > 1: dest_policy = random.choice(E...
13,447
[ 0.051188770681619644, -0.0056015681475400925, 0.03490143269300461, -0.013457187451422215, -0.001041030278429389, 0.031321797519922256, 0.015470731072127819, 0.005945548880845308, -0.01978866569697857, -0.032350942492485046, 0.0020429084543138742, 0.044297974556684494, 0.012797192670404911, ...
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 TestContainerSync(ReplProbeTest): def setUp(self): super(TestContainerSync, self).setUp() self.realm, self.cluster = get_current_realm_cluster(self.url) def test_sync(self): base_headers = {'X-Container-Sync-Key': 'secret'} # setup dest container dest_container =...
13,448
[ 0.0014429213479161263, -0.002932600677013397, -0.029106827452778816, -0.013524739071726799, -0.02349587343633175, 0.03995467349886894, 0.0020091310143470764, -0.008720358833670616, -0.042128920555114746, -0.006744835060089827, 0.03719595447182655, -0.05564196780323982, 0.04264325648546219, ...
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 SetupStack(object): def __init__(self): self._on_teardown = [] def add_teardown(self, teardown): self._on_teardown.append(teardown) def tear_down(self): for func in reversed(self._on_teardown): func()
13,449
[ -0.016046959906816483, 0.02775961346924305, 0.09931327402591705, -0.029488325119018555, -0.0160093791782856, -0.012326470576226711, 0.006545305717736483, -0.006902322638779879, -0.03625285252928734, 0.00361401098780334, -0.028110366314649582, -0.0038332317490130663, -0.004227829165756702, ...
14
{"_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 = [ ('gwells', '0005_auto_20170612_1155'), ] operations = [ migrations.CreateModel( name='DrillingMethod', fields=[ ('drilling_method_guid', models.UUIDField(default=uuid.uuid4, editable=False, prim...
13,450
[ 0.04258051514625549, -0.024026263505220413, -0.034441474825143814, 0.005535237491130829, -0.014093874953687191, 0.03903980553150177, 0.018312841653823853, 0.009943883866071701, -0.0006017343257553875, 0.007340081036090851, -0.0071906354278326035, -0.011990140192210674, 0.06888294965028763, ...
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}}, {"_type": "arg", "_fields": {"arg": "setup_stack", "annotat...
class TearDownConvenience(object): def __init__(self, setup_stack=None): self._own_setup_stack = setup_stack is None if setup_stack is None: setup_stack = SetupStack() self._setup_stack = setup_stack # only call this convenience method if no setup_stack was supplied to c'to...
13,451
[ 0.022108685225248337, 0.009861104190349579, 0.02033008448779583, -0.013969897292554379, 0.010052472352981567, 0.016705339774489403, 0.016255062073469162, 0.0007506990805268288, -0.029673367738723755, 0.004204477649182081, -0.018821651116013527, -0.0038470688741654158, 0.05560942366719246, ...
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": "dir_", "annotation": n...
class TempDirMaker(TearDownConvenience): def make_temp_dir(self, dir_=None): temp_dir = tempfile.mkdtemp(prefix="tmp-%s-" % self.__class__.__name__, dir=dir_) def tear_down(): shutil.rmtree(temp_dir) self._setup_stack.add_teardown(tear_down) ...
13,452
[ -0.0289144366979599, -0.02260562591254711, -0.007070606574416161, -0.022075191140174866, -0.029862450435757637, 0.0048134298995137215, 0.009124637581408024, -0.03959088400006294, 0.008898920379579067, -0.019231148064136505, 0.025889819487929344, -0.042457498610019684, 0.03981659933924675, ...
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 FixtureFactory(object): def __init__(self): self._setup_stack = SetupStack() self._context_managers = {} self._fixtures = {} def register_context_manager(self, name, context_manager): self._context_managers[name] = context_manager def get_fixture(self, name, add_tear...
13,453
[ 0.04077634960412979, 0.02086203545331955, -0.013559715822339058, 0.022259319201111794, 0.0011360514909029007, 0.03180944174528122, 0.019926464185118675, 0.039512719959020615, -0.010856278240680695, -0.023012636229395866, 0.0294765867292881, -0.04303630441427231, 0.002841647481545806, 0.001...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields...
class MonkeyPatcher(TearDownConvenience): Unset = object() def monkey_patch(self, obj, name, value): orig_value = getattr(obj, name) setattr(obj, name, value) def reverse_patch(): setattr(obj, name, orig_value) self._setup_stack.add_teardown(reverse_patch) def ...
13,454
[ -0.008578954264521599, -0.023486247286200523, 0.02272394299507141, -0.025676360353827477, -0.007840849459171295, 0.01067831739783287, 0.00745364697650075, 0.026741167530417442, 0.008234101347625256, 0.020763730630278587, 0.01984412409365177, -0.03947044909000397, -0.00028983462834730744, -...
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 TestCase(unittest.TestCase): def setUp(self): self._setup_stack = SetupStack() self._monkey_patcher = MonkeyPatcher(self._setup_stack) def tearDown(self): self._setup_stack.tear_down() def register_context_manager(self, name, context_manager): return self.fixture_fac...
13,455
[ 0.03734631463885307, 0.001550528104417026, 0.02961949072778225, 0.006211224477738142, -0.008820242248475552, 0.012355628423392773, 0.025828974321484566, 0.023435601964592934, -0.029425105080008507, 0.025415904819965363, 0.027068180963397026, -0.02612055279314518, 0.0351351797580719, -0.010...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "run_meld", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, ...
class GoldenTestCase(TestCase): run_meld = False def assert_golden(self, dir_got, dir_expect): assert os.path.exists(dir_expect), dir_expect proc = subprocess.Popen(["diff", "--recursive", "-u", "-N", "--exclude=.*", dir_expect, dir_got], ...
13,456
[ 0.03060752898454666, 0.03178281709551811, 0.027456754818558693, -0.009102239273488522, -0.0055482396855950356, 0.011021461337804794, 0.02355579473078251, 0.02349327877163887, -0.018467042595148087, 0.03280806913971901, 0.05416332557797432, -0.0014683299232274294, 0.04501107335090637, -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}}, {"_type": "arg", "_fields": {"arg": "dir_got", "annotation": null, "type_comment": null}}, {"_type": "...
def assert_golden(self, dir_got, dir_expect): assert os.path.exists(dir_expect), dir_expect proc = subprocess.Popen(["diff", "--recursive", "-u", "-N", "--exclude=.*", dir_expect, dir_got], stdout=subprocess.PIPE) stdout, stderr = ...
13,457
[ -0.027294717729091644, 0.0002101551363011822, 0.015078728087246418, -0.00713833374902606, -0.021976443007588387, -0.026702428236603737, -0.05720538645982742, -0.016053538769483566, 0.03830144926905632, 0.06421415507793427, 0.0154982665553689, -0.030502958223223686, -0.07462859898805618, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "low", "annotation": {"_type": "Name", "_fields": {"id": "float", "ct...
def find_zero(f, low: float, high: float, err: float) -> float: x = (low + high) / 2 y = f(x) if abs(y) > err: if y * f(low) < 0: x = find_zero(f, low, x, err) else: x = find_zero(f, x, high, err) return x
13,458
[ -0.003027120605111122, 0.017286673188209534, 0.02179526910185814, 0.013079393655061722, 0.013804786838591099, 0.00678521441295743, -0.05240685120224953, -0.04434940963983536, -0.0006758709787391126, 0.0080853421241045, -0.010328480042517185, -0.021839909255504608, 0.05499594658613205, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "name_or_id"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}...
class PortsTable(tables.DataTable): name = tables.Column("name_or_id", verbose_name=_("Name"), link="horizon:project:networks:ports:detail") fixed_ips = tables.Column(get_fixed_ips, verbose_name=_("Fixed IPs")) attached = tables.Column(get_attached, verbose_...
13,459
[ 0.0300032589584589, 0.026852337643504143, 0.005716837476938963, -0.033524878323078156, 0.024187956005334854, -0.010043562389910221, 0.01683194376528263, 0.002393599832430482, 0.01135837659239769, 0.0447847880423069, 0.04042910411953926, -0.0072633372619748116, -0.01095292717218399, 0.04362...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "s", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},...
def try_one(s): # Since C doesn't guarantee we can write/read arbitrary bytes in text # files, use binary mode. f = open(TESTFN, "wb") # write once with \n and once without f.write(s) f.write("\n") f.write(s) f.close() f = open(TESTFN, "rb") line = f.readline() if line != s +...
13,460
[ 0.0054480028338730335, 0.04312524572014809, 0.0173953790217638, -0.012798028066754341, -0.0215817391872406, -0.004358402453362942, 0.007770572789013386, -0.05352424085140228, -0.04767480492591858, 0.024334413930773735, -0.026016604155302048, -0.04713956266641617, 0.024869656190276146, 0.00...
7
{"_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": "options", "annotation"...
class ModelFormOptions(object): def __init__(self, options=None): self.model = getattr(options, 'model', None) self.fields = getattr(options, 'fields', None) self.exclude = getattr(options, 'exclude', None) self.widgets = getattr(options, 'widgets', None) self.localized_field...
13,461
[ 0.003088704776018858, 0.037586793303489685, 0.0348365381360054, -0.021660909056663513, -0.030295424163341522, -0.026074105873703957, 0.000307971058646217, -0.05253196507692337, -0.03797055035829544, 0.06391673535108566, -0.03232080489397049, -0.033578671514987946, 0.016970554366707802, -0....
6
{"_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": "options", "annotation": null, "type_comment": null}}], "kwarg": n...
def __init__(self, options=None): self.model = getattr(options, 'model', None) self.fields = getattr(options, 'fields', None) self.exclude = getattr(options, 'exclude', None) self.widgets = getattr(options, 'widgets', None) self.localized_fields = getattr(options, 'localized_fiel...
13,462
[ 0.028043443337082863, 0.04678117856383324, 0.004502846393734217, -0.022085264325141907, -0.03408583626151085, 0.024927504360675812, 0.022569498047232628, -0.022569498047232628, -0.028780320659279823, 0.009679408743977547, 0.0015987604856491089, -0.05217090994119644, 0.05094979703426361, 0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mcs", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": nu...
class ModelFormMetaclass(DeclarativeFieldsMetaclass): def __new__(mcs, name, bases, attrs): formfield_callback = attrs.pop('formfield_callback', None) new_class = super(ModelFormMetaclass, mcs).__new__(mcs, name, bases, attrs) if bases == (BaseModelForm,): return new_class ...
13,463
[ 0.03399931639432907, 0.05433760583400726, 0.022899731993675232, -0.010886129923164845, -0.037261322140693665, 0.00775000499561429, 0.04424508288502693, -0.018039559945464134, -0.01525919046252966, 0.029423747211694717, 0.012040968053042889, -0.05941670387983322, 0.05749014765024185, 0.0154...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mcs", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __new__(mcs, name, bases, attrs): formfield_callback = attrs.pop('formfield_callback', None) new_class = super(ModelFormMetaclass, mcs).__new__(mcs, name, bases, attrs) if bases == (BaseModelForm,): return new_class opts = new_class._meta = ModelFormOptions(getattr(new...
13,464
[ 0.06266281008720398, 0.03952385112643242, 0.057117801159620285, 0.034041374921798706, -0.0277667548507452, -0.003684515133500099, 0.019741078838706017, 0.004982172977179289, -0.01871963031589985, 0.04936312139034271, -0.010579301044344902, -0.0282253660261631, -0.009015857242047787, 0.0395...
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": "errors", "annotation": null, "type_comment": null}}], "kwarg": nu...
def _update_errors(self, errors): # Override any validation error messages defined at the model level # with those defined at the form level. opts = self._meta # Allow the model generated by construct_instance() to raise # ValidationError and have them handled in the same way as...
13,465
[ 0.03428816422820091, 0.051992252469062805, 0.03501518815755844, -0.005693406797945499, -0.028295103460550308, -0.01496300008147955, 0.01133769005537033, -0.0019919555634260178, -0.05140276998281479, 0.04928063601255417, -0.0031856552232056856, -0.028609491884708405, 0.012555952183902264, -...
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": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None): opts = self._meta if opts.model is None: raise ValueError('ModelForm has no model class spe...
13,466
[ 0.03301820531487465, 0.004784964490681887, 0.021737171337008476, 0.000893871474545449, -0.011972164735198021, -0.008226683363318443, 0.026931798085570335, 0.032304778695106506, -0.025438062846660614, 0.025705598294734955, -0.030164504423737526, -0.022941075265407562, 0.017233675345778465, ...
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": "i", "annotation": null, "type_comment": null}}], "kwarg": {"_type...
def _construct_form(self, i, **kwargs): if self.is_bound and i < self.initial_form_count(): pk_key = "%s-%s" % (self.add_prefix(i), self.model._meta.pk.name) pk = self.data[pk_key] pk_field = self.model._meta.pk to_python = self._get_to_python(pk_field) ...
13,467
[ 0.034764911979436874, 0.04660685732960701, 0.062110770493745804, -0.020580731332302094, -0.027845218777656555, -0.012305636890232563, 0.009684001095592976, 0.00037266165600158274, -0.03310037776827812, 0.04066210240125656, 0.04089989513158798, -0.022364158183336258, -0.04075722023844719, 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 _post_clean(self): opts = self._meta exclude = self._get_validation_exclusions() try: self.instance = construct_instance(self, self.instance, opts.fields, exclude) except ValidationError as e: self._update_errors(e) # Foreign Keys being used to repr...
13,468
[ -0.008067668415606022, 0.02076924405992031, 0.009995684958994389, -0.0049783955328166485, -0.013546125963330269, -0.01901347190141678, -0.037360191345214844, -0.004131068475544453, -0.02233610674738884, -0.022002730518579483, -0.022713931277394295, -0.08525502681732178, 0.019980257377028465,...
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 get_queryset(self): if not hasattr(self, '_queryset'): if self.queryset is not None: qs = self.queryset else: qs = self.model._default_manager.get_queryset() # If the queryset isn't already ordered we need to add an # artificia...
13,469
[ 0.04923895746469498, 0.0405539870262146, 0.06904551386833191, -0.0397578664124012, -0.018913935869932175, -0.003359394846484065, 0.03746599704027176, 0.009879154153168201, -0.025837786495685577, 0.04487234726548195, 0.03235151618719101, 0.0048732333816587925, -0.010397839359939098, -0.0286...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def validate_unique(self): # Collect unique_checks and date_checks to run from all the forms. all_unique_checks = set() all_date_checks = set() forms_to_delete = self.deleted_forms valid_forms = [form for form in self.forms if form.is_valid() and form not in forms_to_delete] ...
13,470
[ 0.04556925967335701, 0.011748501099646091, 0.018544314429163933, 0.01957329735159874, -0.017809325829148293, -0.0011109627084806561, 0.009967568330466747, 0.021552110090851784, -0.013060172088444233, 0.032452549785375595, -0.005879904143512249, 0.0021625610534101725, -0.006863657385110855, ...
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": "unique_check", "annotation": null, "type_comment": null}}], "kwar...
def get_unique_error_message(self, unique_check): if len(unique_check) == 1: return ugettext("Please correct the duplicate data for %(field)s.") % { "field": unique_check[0], } else: return ugettext("Please correct the duplicate data for %(field)s, " ...
13,471
[ 0.07547660171985626, 0.04714038223028183, 0.020992200821638107, -0.01859835349023342, 0.0067970105446875095, 0.04722703620791435, 0.06468804180622101, 0.06460138410329819, 0.021425476297736168, 0.021187175065279007, 0.012402513064444065, -0.019161611795425415, 0.020461438223719597, -0.0202...
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": "commit", "annotation": null, "type_comment": null}}], "kwarg": nu...
def save_existing_objects(self, commit=True): self.changed_objects = [] self.deleted_objects = [] if not self.initial_forms: return [] saved_instances = [] forms_to_delete = self.deleted_forms for form in self.initial_forms: obj = form.instance ...
13,472
[ 0.08401902765035629, 0.04854031279683113, 0.0028812335804104805, 0.008621103130280972, -0.002845924347639084, 0.03104952909052372, 0.046642087399959564, 0.047997962683439255, 0.017276102676987648, 0.009084359742701054, 0.01546826958656311, -0.036088861525058746, 0.015140600502490997, -0.01...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "commit", "annotation": null, "type_comment": null}}], "kwarg": nu...
def save_new_objects(self, commit=True): self.new_objects = [] for form in self.extra_forms: if not form.has_changed(): continue # If someone has marked an add form for deletion, don't save the # object. if self.can_delete and self._should_...
13,473
[ 0.018171699717640877, 0.026991060003638268, 0.03785184398293495, -0.015003971755504608, -0.01670348271727562, -0.023350685834884644, 0.025804417207837105, 0.004153244197368622, -0.039782650768756866, 0.012670914642512798, 0.020635489374399185, -0.018573950976133347, 0.032220326364040375, -...
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": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, data=None, files=None, instance=None, save_as_new=False, prefix=None, queryset=None, **kwargs): if instance is None: self.instance = self.fk.remote_field.model() else: self.instance = instance self.save_as_new = save_as_new if q...
13,474
[ 0.045042313635349274, 0.030208148062229156, 0.006666737608611584, -0.01334427110850811, 0.020966485142707825, 0.02884780988097191, 0.07566072046756744, 0.01365736499428749, -0.004933925811201334, 0.0035465965047478676, 0.029128514230251312, -0.022413194179534912, 0.008329372853040695, -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": "form", "annotation": null, "type_comment": null}}, {"_type": "arg...
def save_new(self, form, commit=True): # Ensure the latest copy of the related instance is present on each # form (it may have been saved after the formset was originally # instantiated). setattr(form.instance, self.fk.name, self.instance) # Use commit=False so we can assign the ...
13,475
[ 0.02384582906961441, 0.02311869151890278, 0.037019845098257065, -0.006132548209279776, -0.008522477932274342, -0.01948300376534462, 0.03917987272143364, 0.007324839476495981, -0.017216047272086143, 0.011933607049286366, -0.0008434258634224534, -0.019237060099840164, 0.011099537834525108, -...
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": "i", "annotation": null, "type_comment": null}}], "kwarg": {"_type...
def _construct_form(self, i, **kwargs): form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs) if self.save_as_new: # Remove the primary key from the form's data, we are only # creating new instances form.data[form.add_prefix(self._pk_field.name)] = None ...
13,476
[ 0.021164530888199806, 0.019503772258758545, 0.028293635696172714, -0.023351868614554405, -0.026875915005803108, -0.026430346071720123, 0.01061264518648386, -0.021387314423918724, -0.02566072717308998, 0.017741749063134193, 0.015756942331790924, -0.020465796813368797, 0.04779740795493126, -...
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": "form", "annotation": null, "type_comment": null}}, {"_type": "arg...
def add_fields(self, form, index): super(BaseInlineFormSet, self).add_fields(form, index) if self._pk_field == self.fk: name = self._pk_field.name kwargs = {'pk_field': True} else: # The foreign key field might not be on the form, so we poke at the ...
13,477
[ 0.045595183968544006, 0.01895563118159771, 0.01574910804629326, 0.0016044831136241555, 0.03142000734806061, -0.033883556723594666, 0.030051371082663536, -0.02880004420876503, -0.04328805208206177, 0.0559186190366745, 0.055410269647836685, 0.013451752252876759, 0.016335666179656982, -0.0489...
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": "parent_instance", "annotation": null, "type_comment": null}}], "k...
def __init__(self, parent_instance, *args, **kwargs): self.parent_instance = parent_instance self.pk_field = kwargs.pop("pk_field", False) self.to_field = kwargs.pop("to_field", None) if self.parent_instance is not None: if self.to_field: kwargs["initial"] = g...
13,478
[ 0.024481533095240593, -0.0028881842736154795, -0.023084934800863266, -0.009909681044518948, 0.015146921388804913, 0.0037302502896636724, -0.009822393767535686, 0.0032655736431479454, -0.037646517157554626, 0.01767311990261078, -0.008970058523118496, -0.06855650991201401, 0.023023320361971855...
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": "field", "annotation": ...
class ModelChoiceIterator(object): def __init__(self, field): self.field = field self.queryset = field.queryset def __iter__(self): if self.field.empty_label is not None: yield ("", self.field.empty_label) # Can't use iterator() when queryset uses prefetch_related() ...
13,479
[ 0.051205825060606, -0.01235372107475996, -0.0041588968597352505, -0.01294019166380167, 0.043184421956539154, -0.026611894369125366, 0.013860887847840786, 0.00405169278383255, 0.0030490169301629066, 0.05519130453467369, 0.05367783084511757, -0.0052561648190021515, -0.02306784689426422, 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}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul...
def clean(self, value): if value in self.empty_values: if self.pk_field: return None # if there is no value act as we did before. return self.parent_instance # ensure the we compare the values as equal types. if self.to_field: orig ...
13,480
[ 0.024960584938526154, -0.05031493678689003, -0.006847206968814135, 0.01676800101995468, 0.04165202006697655, -0.059852901846170425, -0.013453776948153973, 0.04287707805633545, 0.03594236820936203, 0.009330139495432377, 0.024741824716329575, -0.03329536318778992, 0.007301134988665581, -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}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul...
def to_python(self, value): if value in self.empty_values: return None try: key = self.to_field_name or 'pk' value = self.queryset.get(**{key: value}) except (ValueError, TypeError, self.queryset.model.DoesNotExist): raise ValidationError(self.erro...
13,481
[ 0.0018933553947135806, -0.003315391717478633, 0.011085420846939087, -0.0018933553947135806, 0.04843542352318764, -0.00030248574330471456, 0.005795876029878855, 0.013703260570764542, 0.005774329882115126, -0.008386783301830292, 0.0009621638455428183, -0.07325642555952072, 0.007972022518515587...
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 _get_choices(self): # If self._choices is set, then somebody must have manually set # the property self.choices. In this case, just return self._choices. if hasattr(self, '_choices'): return self._choices # Otherwise, execute the QuerySet in self.queryset to determine th...
13,482
[ 0.017570335417985916, 0.0054532927460968494, 0.017907265573740005, -0.015760889276862144, 0.016859035938978195, 0.04265298694372177, 0.01319023035466671, -0.007081793155521154, 0.03222059831023216, 0.036338645964860916, 0.03713729977607727, -0.0006021084263920784, -0.0017018142389133573, 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": "initial", "annotation": null, "type_comment": null}}, {"_type": "...
def has_changed(self, initial, data): if initial is None: initial = [] if data is None: data = [] if len(initial) != len(data): return True initial_set = set(force_text(value) for value in self.prepare_value(initial)) data_set = set(force_text(...
13,483
[ 0.037015121430158615, 0.016304567456245422, -0.03495738282799721, -0.005486299749463797, 0.025685444474220276, -0.024269234389066696, -0.009568493813276291, 0.009169050492346287, 0.020323215052485466, 0.07979191839694977, 0.03575626760721207, -0.03926653414964676, -0.020625824108719826, 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": "value", "annotation": null, "type_comment": null}}], "kwarg": nul...
def clean(self, value): if self.required and not value: raise ValidationError(self.error_messages['required'], code='required') elif not self.required and not value: return self.queryset.none() if not isinstance(value, (list, tuple)): raise ValidationError(sel...
13,484
[ 0.021493829786777496, -0.01702892780303955, 0.01970786787569523, -0.02222067303955555, -0.01691470853984356, 0.03484699875116348, 0.0000027175547074875794, -0.01871105283498764, 0.023196721449494362, 0.010694997385144234, -0.026083333417773247, 0.02971755526959896, 0.022241441532969475, -0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "test_class", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "loss_name_str", "annotation": null, "type_comment": null}},...
def add_loss_consistency_test(test_class, loss_name_str, loss_args): tuple_loss = getattr(tfgan_losses, loss_name_str) arg_loss = getattr(tfgan_losses.losses_impl, loss_name_str) def consistency_test(self): self.assertEqual(arg_loss.__name__, tuple_loss.__name__) with self.cached_session(): self.as...
13,485
[ 0.025075802579522133, -0.027465056627988815, 0.06353143602609634, -0.014836137183010578, -0.049195900559425354, 0.024006325751543045, 0.031060317531228065, -0.006166554056107998, -0.01068907231092453, 0.007662682794034481, -0.022823074832558632, 0.004232394974678755, -0.04378025606274605, ...
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 setUp(self): super(CycleConsistencyLossTest, self).setUp() def _partial_model(generator_inputs_np): model = namedtuples.GANModel(*[None] * 11) return model._replace( generator_inputs=constant_op.constant( generator_inputs_np, dtype=dtypes.float32)) self._model_x2y =...
13,486
[ 0.03069451078772545, -0.013600233010947704, 0.01575636863708496, -0.06121210753917694, -0.05435670539736748, 0.0061477478593587875, 0.06877516210079193, 0.030760852620005608, 0.032950159162282944, 0.04467068612575531, 0.0041408841498196125, 0.046351365745067596, 0.027841778472065926, -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 cmd_tracker_start(self): if self.tracker_settings.port == None: print("tracker port not set") return if self.connection is not None: self.connection.close() self.connection = None print("Closed old connection") print("connecting to ...
13,487
[ -0.010161598213016987, 0.011650588363409042, 0.07239530980587006, -0.052169352769851685, -0.003616119036450982, -0.004357575438916683, 0.008344422094523907, -0.048863187432289124, -0.0007786810747347772, -0.03225942701101303, 0.02491779439151287, -0.04891180619597435, -0.011699208058416843, ...
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": "tag", "annotation": nu...
class table_F__e_a_t(DefaultTable.DefaultTable): def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) self.features = {} def decompile(self, data, ttFont): (_, data) = sstruct.unpack2(Feat_hdr_format, data, self) numFeats, = struct.unpack('>H', data[:2]) ...
13,488
[ -0.007411289494484663, 0.02890908159315586, 0.03995024412870407, -0.06616037338972092, -0.007386032026261091, 0.0006467739585787058, 0.00609428808093071, -0.031405970454216, -0.004600483924150467, -0.014851445332169533, 0.060040827840566635, -0.023309119045734406, -0.015255565755069256, -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": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def decompile(self, data, ttFont): (_, data) = sstruct.unpack2(Feat_hdr_format, data, self) numFeats, = struct.unpack('>H', data[:2]) data = data[8:] allfeats = [] maxsetting = 0 for i in range(numFeats): if self.version >= 2.0: (fid, nums, _, ...
13,489
[ -0.0011927055893465877, -0.005223480518907309, 0.09092243015766144, -0.09060980379581451, -0.06419280171394348, -0.028605395928025246, 0.007516080513596535, -0.04275177791714668, -0.029048284515738487, 0.0124073950573802, 0.009456975385546684, -0.00920947827398777, -0.005930148530751467, -...
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": "ttFont", "annotation": null, "type_comment": null}}], "kwarg": nu...
def compile(self, ttFont): fdat = "" vdat = "" offset = 0 for f, v in sorted(self.features.items(), key=lambda x:x[1].index): fnum = grUtils.tag2num(f) if self.version >= 2.0: fdat += struct.pack(">LHHLHH", grUtils.tag2num(f), len(v.settings), ...
13,490
[ -0.0012632344150915742, -0.008861088193953037, 0.034700047224760056, -0.08105232566595078, -0.035085029900074005, -0.04437601938843727, 0.011292913928627968, -0.039704859256744385, 0.008360606618225574, 0.002175169298425317, -0.009419317357242107, -0.018928464502096176, -0.022483166307210922...
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": "writer", "annotation": null, "type_comment": null}}, {"_type": "a...
def toXML(self, writer, ttFont): writer.simpletag('version', version=self.version) writer.newline() for f, v in sorted(self.features.items(), key=lambda x:x[1].index): writer.begintag('feature', fid=f, label=v.label, flags=v.flags, default=(v.default if v....
13,491
[ 0.024523785337805748, 0.023157013580203056, 0.030355343595147133, -0.05899246037006378, -0.007191821467131376, -0.035275720059871674, 0.0058608464896678925, -0.05487912893295288, 0.04113331437110901, -0.01224236749112606, 0.02827264554798603, -0.04095107689499855, -0.0016677866224199533, 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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg...
def fromXML(self, name, attrs, content, ttFont): if name == 'version': self.version = float(safeEval(attrs['version'])) elif name == 'feature': fid = attrs['fid'] fobj = Feature() fobj.flags = int(safeEval(attrs['flags'])) fobj.label = int(safe...
13,492
[ -0.019190536811947823, 0.040421262383461, -0.03323809430003166, -0.051897332072257996, 0.03338686004281044, 0.00013307391782291234, -0.00003698342334246263, -0.03927365690469742, -0.019881226122379303, 0.0012631644494831562, 0.020540038123726845, -0.032558031380176544, -0.0020229227375239134...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "fname", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def get_version(fname): with open(fname) as f: source = f.read() module = ast.parse(source) for e in module.body: if isinstance(e, ast.Assign) and \ len(e.targets) == 1 and \ e.targets[0].id == '_version_' and \ isinstance(e.value, ast.Str): ...
13,493
[ 0.024294033646583557, 0.015910057350993156, 0.04921199008822441, 0.02191532403230667, -0.014298254624009132, -0.05048583447933197, -0.02626979351043701, 0.008163003250956535, 0.061716463416814804, 0.04689827561378479, 0.029428407549858093, -0.011510094627737999, -0.020056551322340965, -0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _quad(func,a,b,args,full_output,epsabs,epsrel,limit,points): infbounds = 0 if (b != Inf and a != -Inf): pass # standard integration elif (b == Inf and a != -Inf): infbounds = 1 bound = a elif (b == Inf and a == -Inf): infbounds = 2 bound = 0 # ignored ...
13,494
[ 0.03346224129199982, 0.015378041192889214, 0.023731835186481476, -0.011012889444828033, 0.01656639762222767, -0.021449249237775803, -0.0025502603966742754, 0.011636482551693916, 0.03209739550948143, 0.06734805554151535, -0.024120109155774117, 0.019201960414648056, -0.0012523337500169873, 0...
14
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _quad_weight(func,a,b,args,full_output,epsabs,epsrel,limlst,limit,maxp1,weight,wvar,wopts): if weight not in ['cos','sin','alg','alg-loga','alg-logb','alg-log','cauchy']: raise ValueError("%s not a recognized weighting function." % weight) strdict = {'cos':1,'sin':2,'alg':1,'alg-loga':2,'alg-logb':...
13,495
[ -0.002800451824441552, 0.03388858214020729, 0.05708504095673561, -0.03486265242099762, 0.01919824257493019, -0.0057254936546087265, -0.00841551274061203, 0.02105577290058136, 0.021033119410276413, 0.03898546099662781, 0.01642327569425106, -0.003950080834329128, -0.013399127870798111, -0.00...
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": "func", "annotation": n...
class _NQuad: def __init__(self, func, ranges, opts, full_output): self.abserr = 0 self.func = func self.ranges = ranges self.opts = opts self.maxdepth = len(ranges) self.full_output = full_output if self.full_output: self.out_dict = {'neval': 0} ...
13,496
[ 0.02697094716131687, 0.03523252531886101, 0.07106338441371918, -0.03516348823904991, 0.006725477520376444, -0.018375683575868607, -0.012449899688363075, 0.04455269128084183, -0.011989644728600979, 0.0417681485414505, -0.02296672947704792, -0.00759420869871974, -0.022552499547600746, -0.012...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def integrate(self, *args, **kwargs): depth = kwargs.pop('depth', 0) if kwargs: raise ValueError('unexpected kwargs') # Get the integration range and options for this depth. ind = -(depth + 1) fn_range = self.ranges[ind] low, high = fn_range(*args) fn...
13,497
[ -0.014743288047611713, 0.03625669330358505, 0.053311727941036224, 0.00567911472171545, 0.013115628622472286, -0.011594121344387531, 0.015816599130630493, -0.0300998967140913, -0.0013438507448881865, -0.005738087929785252, 0.0012052637757733464, -0.01606428623199463, -0.030666038393974304, ...
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}}, {"_type": "arg", "_fields": {"arg": "cr", "annotation": nul...
class report_webkit_html(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(report_webkit_html, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'cr':cr, 'uid': uid, })
13,498
[ 0.013899880461394787, 0.028981249779462814, 0.05777717009186745, -0.02796192467212677, 0.025089284405112267, -0.0028378921560943127, 0.006973106414079666, -0.0002640615275595337, 0.011849647387862206, 0.022077642381191254, 0.001344379037618637, -0.0519392192363739, -0.016540857031941414, 0...
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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def account_chart_sum_open_report(self, cr, uid, ids, context=None): if context is None: context = {} context.update({'open':'report'}) self._logger.debug('context after `%s`', context) res= self.account_chart_sum_open( cr, uid, ids, context) data = self.read(cr, uid...
13,499
[ -0.02218605950474739, -0.0025976935867220163, 0.04829954728484154, -0.018414689227938652, 0.01556665450334549, 0.03612712398171425, 0.011437655426561832, -0.011190565302968025, -0.006115471478551626, 0.01197084877640009, 0.029390675947070122, -0.0580010712146759, -0.0034852661192417145, -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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None): res = {} res['value'] = {} if fiscalyear_id: start_period = end_period = False #FIXME - check if closing periods are handled correctly # FIXME 2 statements because UNION does not g...
13,500
[ 0.04756990820169449, -0.009004602208733559, 0.01571282185614109, -0.05845336616039276, -0.012623143382370472, 0.04910082742571831, -0.010479853488504887, -0.007257959805428982, 0.029839051887392998, 0.014780350960791111, 0.050631750375032425, -0.05299771949648857, 0.0015874612145125866, 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_methods_and_attributes(): instance1 = ExampleMandA() instance2 = ExampleMandA(32) instance1.add1(instance2) instance1.add2(instance2) instance1.add3(instance2) instance1.add4(instance2) instance1.add5(instance2) instance1.add6(32) instance1.add7(32) instance1.add8(32) ...