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
21,401
[ 0.011449920944869518, 0.03401671722531319, 0.03415453061461449, -0.026988279074430466, 0.012575389817357063, -0.004837792832404375, 0.013631951995193958, -0.03119155950844288, -0.04736156016588211, -0.011570506729185581, -0.015791013836860657, 0.023198435083031654, -0.048188433051109314, -...
14
{"_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_score(self): max_score = None score = None weight = self.weight #The old default was None, so set to 1 if it is the old default weight if weight is None: weight = 1 score_dict = { 'score': score, 'total': max_score, } ...
21,402
[ 0.025554005056619644, -0.0009870934300124645, 0.01174277625977993, 0.041606057435274124, -0.019758028909564018, 0.0050283861346542835, -0.0006049819057807326, -0.03322451561689377, -0.002231396734714508, 0.029173796996474266, 0.024929160252213478, -0.018551431596279144, -0.004287729505449533...
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": "msg", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __init__(self, msg, reply_code=None, reply_text=None, method_sig=None, method_name=None): self.message = msg self.amqp_reply_code = reply_code self.amqp_reply_text = reply_text self.amqp_method_sig = method_sig self.method_name = method_name or '' if metho...
21,403
[ 0.0336066335439682, 0.0005369037389755249, 0.017170431092381477, 0.03276751562952995, -0.02649511769413948, -0.005595861002802849, -0.026432184502482414, -0.041473355144262314, -0.011034388095140457, 0.02021222934126854, 0.02391483262181282, -0.049046386033296585, 0.003487579757347703, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg", "annotation": nu...
class AMQPError(Exception): def __init__(self, msg, reply_code=None, reply_text=None, method_sig=None, method_name=None): self.message = msg self.amqp_reply_code = reply_code self.amqp_reply_text = reply_text self.amqp_method_sig = method_sig self.method_name = m...
21,404
[ 0.030286554247140884, 0.003056408604606986, 0.03219369426369667, -0.0006782629643566906, -0.04141629487276077, 0.007521824911236763, 0.04295339435338974, 0.01928490586578846, -0.007692614104598761, 0.030485806986689568, 0.023796578869223595, -0.0434088297188282, 0.0017648179782554507, -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 __init__(self): super(HebrewProber, self).__init__() self._final_char_logical_score = None self._final_char_visual_score = None self._prev = None self._before_prev = None self._logical_prober = None self._visual_prober = None self.reset()
21,405
[ 0.03032257966697216, -0.001311158761382103, 0.005618786904960871, 0.0013257995015010238, -0.028084173798561096, 0.04008306562900543, -0.002212377032265067, -0.014679771848022938, -0.015577737241983414, 0.04151460528373718, 0.029802020639181137, -0.023854630067944527, 0.016397617757320404, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 234}}, "targets": [{"_type": "Name", "_fields": {"id": "FINAL_KAF", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {...
class HebrewProber(CharSetProber): # windows-1255 / ISO-8859-8 code points of interest FINAL_KAF = 0xea NORMAL_KAF = 0xeb FINAL_MEM = 0xed NORMAL_MEM = 0xee FINAL_NUN = 0xef NORMAL_NUN = 0xf0 FINAL_PE = 0xf3 NORMAL_PE = 0xf4 FINAL_TSADI = 0xf5 NORMAL_TSADI = 0xf6 # Minim...
21,406
[ 0.05054021626710892, 0.0073578679002821445, 0.014098751358687878, -0.028092483058571815, -0.02956274338066578, 0.028565067797899246, -0.01681610755622387, -0.023616064339876175, -0.040773481130599976, 0.045368049293756485, -0.03129555284976959, -0.02139754593372345, -0.0521942600607872, -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 charset_name(self): # Make the decision: is it Logical or Visual? # If the final letter score distance is dominant enough, rely on it. finalsub = self._final_char_logical_score - self._final_char_visual_score if finalsub >= self.MIN_FINAL_CHAR_DISTANCE: return self.LOGICA...
21,407
[ 0.05447166785597801, 0.027606388553977013, -0.022749464958906174, -0.02142605185508728, -0.013750257901847363, 0.04364614933729172, -0.013161338865756989, -0.006448328495025635, -0.025091905146837234, 0.08093991875648499, 0.020499663427472115, 0.005015734117478132, -0.007708879187703133, 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": "byte_str", "annotation": null, "type_comment": null}}], "kwarg": ...
def feed(self, byte_str): # Final letter analysis for logical-visual decision. # Look for evidence that the received buffer is either logical Hebrew # or visual Hebrew. # The following cases are checked: # 1) A word longer than 1 letter, ending with a final letter. This is ...
21,408
[ 0.0057217576541006565, 0.005741285625845194, 0.03754618763923645, -0.024553434923291206, -0.016572918742895126, -0.011515118181705475, 0.06285471469163895, 0.0504608228802681, 0.013669728301465511, 0.017106687650084496, 0.029578687623143196, -0.020309310406446457, 0.009080604650080204, -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 on_start(self): try: self._setup_preferences() self._setup_playbin() self._setup_output() self._setup_mixer() self._setup_visualizer() self._setup_message_processor() except gobject.GError as ex: logger.exception(ex)...
21,409
[ -0.03631387650966644, -0.028276799246668816, 0.01035264041274786, -0.028423817828297615, -0.03418209031224251, -0.03312845155596733, 0.040846988558769226, -0.027566203847527504, 0.02457680180668831, -0.004067546222358942, 0.04096950218081474, -0.007063073571771383, 0.02365792728960514, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _setup_playbin(self): playbin = gst.element_factory_make('playbin2') playbin.set_property('flags', PLAYBIN_FLAGS) playbin.set_property('buffer-size', 2*1024*1024) playbin.set_property('buffer-duration', 2*gst.SECOND) self._connect(playbin, 'about-to-finish', self._on_about_...
21,410
[ 0.045683518052101135, 0.0650378093123436, -0.0013474964071065187, -0.03274986147880554, -0.01040466409176588, 0.03626042604446411, 0.031525786966085434, 0.0005636821733787656, 0.013949871063232422, 0.05215034633874893, 0.028430946171283722, -0.0057508572936058044, -0.0075812009163200855, 0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "modify_times", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlya...
def _reload_on_update(modify_times): if _reload_attempted: # We already tried to reload and it didn't work, so don't try again. return if process.task_id() is not None: # We're in a child process created by fork_processes. If child # processes restarted themselves, they'd all re...
21,411
[ 0.04073323681950569, 0.041342779994010925, -0.009262372739613056, -0.033418744802474976, -0.028595421463251114, -0.0008927787421271205, 0.03750002011656761, -0.028330404311418533, 0.00456824479624629, 0.009805658832192421, 0.06365727633237839, -0.03270319849252701, -0.018392236903309822, 0...
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": "element", "annotation": null, "type_comment": null}}], "kwarg": n...
def _on_about_to_finish(self, element): source, self._appsrc = self._appsrc, None if source is None: return self._appsrc_caps = None self._disconnect(source, 'need-data') self._disconnect(source, 'enough-data') self._disconnect(source, 'seek-data')
21,412
[ 0.05407533422112465, 0.04886667802929878, -0.024883177131414413, 0.004945265129208565, -0.02824512869119644, 0.007943202741444111, 0.011121667921543121, -0.03385627269744873, 0.0086002042517066, 0.04129044711589813, 0.009766233153641224, -0.03781011700630188, -0.04290039837360382, -0.00376...
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": "url", "annotation": nu...
class KeyMobileSitesSmoothPage(page_module.Page): def __init__(self, url, page_set, name='', tags=None, action_on_load_complete=False, extra_browser_args=None, shared_page_state_class=shared_page_state.SharedMobi...
21,413
[ 0.013600789941847324, 0.03418273851275444, -0.02172885090112686, -0.05410396680235863, -0.024932703003287315, 0.045726578682661057, 0.02462104521691799, -0.004849411081522703, 0.015844732522964478, 0.05844225734472275, 0.028173955157399178, 0.008950840681791306, -0.036326948553323746, 0.03...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_reload_attempted"]}}, {"_type...
def _reload(): global _reload_attempted _reload_attempted = True for fn in _reload_hooks: fn() if hasattr(signal, "setitimer"): # Clear the alarm signal set by # ioloop.set_blocking_log_threshold so it doesn't fire # after the exec. signal.setitimer(signal.ITIMER_...
21,414
[ 0.06361360847949982, 0.000490899954456836, -0.039266593754291534, 0.02475784532725811, -0.0041758595034480095, -0.009600422345101833, 0.011903226375579834, -0.065516397356987, 0.00416775094345212, 0.05345100164413452, 0.024303771555423737, -0.02423890493810177, -0.012238376773893833, -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}}, {"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __init__(self, url, page_set, name='', tags=None, action_on_load_complete=False, extra_browser_args=None, shared_page_state_class=shared_page_state.SharedMobilePageState): if name == '': name = url ...
21,415
[ -0.004732521250844002, 0.04211527109146118, -0.04672924056649208, -0.0091125862672925, 0.0012367996387183666, 0.024325862526893616, 0.0239926315844059, -0.015969455242156982, 0.0251461248844862, 0.0582897923886776, 0.026632847264409065, -0.021506216377019882, 0.009747006930410862, 0.016546...
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": "action_runner", "annotation": null, "type_comment": null}}], "kwa...
def RunNavigateSteps(self, action_runner): super(TheVergeArticlePage, self).RunNavigateSteps(action_runner) action_runner.WaitForJavaScriptCondition( 'window.Chorus !== undefined &&' 'window.Chorus.Comments !== undefined &&' 'window.Chorus.Comments.Json !== undefined &&' '(window...
21,416
[ 0.011542056687176228, 0.015093939378857613, -0.006835344713181257, 0.008739253506064415, 0.004275992047041655, 0.0007373745320364833, 0.02207285724580288, -0.012003988958895206, -0.005018828436732292, 0.041024550795555115, 0.01720384508371353, -0.03662995621562004, 0.014931638725101948, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "action_runner", "annotation": null, "type_comment": null}}], "kwa...
def RunNavigateSteps(self, action_runner): super(LinkedInPage, self).RunNavigateSteps(action_runner) action_runner.WaitForJavaScriptCondition( 'document.getElementById("profile-view-scroller") !== null') action_runner.ScrollPage() super(LinkedInPage, self).RunNavigateSteps(action_runner) a...
21,417
[ 0.05915505439043045, -0.006771390791982412, -0.017432110384106636, -0.012110483832657337, -0.009705853648483753, -0.007050863467156887, -0.008232800289988518, -0.053565602749586105, 0.034561458975076675, 0.043178532272577286, 0.0023624177556484938, -0.06129768118262291, -0.00370592437684536,...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "page_set", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "shared_page_state_class", "annotation": null, "type_comment":...
def AddPagesToPageSet( page_set, shared_page_state_class=shared_page_state.SharedMobilePageState, name_func=lambda name: name, extra_browser_args=None): # Add pages with predefined classes that contain custom navigation logic. for page_class, page_name in PREDEFINED_PAGE_CLASSES: page_set.AddSto...
21,418
[ -0.004255525767803192, -0.026167135685682297, 0.06687655299901962, -0.01570925861597061, -0.013723159208893776, 0.0028262638952583075, 0.057136815041303635, -0.012668394483625889, -0.017852449789643288, 0.004522022325545549, 0.0009453606908209622, -0.040911395102739334, 0.006687655579298735,...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def setUpClass(cls): super(DbTestCase, cls).setUpClass() for (short_name, options) in cls.ADDONS_UNDER_TEST.iteritems(): cls.__ADDONS_UNDER_TEST.append( init_mock_addon(short_name, **options) ) cls._original_db_name = settings.DB_NAME settings.DB...
21,419
[ 0.02293948084115982, 0.01744876243174076, 0.06471668183803558, -0.011643359437584877, -0.03646010160446167, 0.03090427629649639, 0.0022150054574012756, 0.02693272940814495, -0.023655660450458527, -0.022679051384329796, 0.03162045776844025, -0.04058356583118439, 0.04303593933582306, -0.0610...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "database", "annotation": null, "type_comment": null}}], "kwarg"...
def teardown_database(client=None, database=None): client = client or client_proxy database = database or database_proxy try: commands.rollback(database) except OperationFailure as error: message = utils.get_error_message(error) if messages.NO_TRANSACTION_ERROR not in message: ...
21,420
[ -0.015521840192377567, -0.039612192660570145, 0.0045076338574290276, -0.018981320783495903, -0.019313521683216095, -0.019382253289222717, 0.049990635365247726, 0.008522693067789078, 0.00009987530938815325, 0.00801866315305233, -0.0014490869361907244, 0.0010739280842244625, -0.021364009007811...
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 setUp(self): super(AppTestCase, self).setUp() self.app = TestApp(test_app) self.context = test_app.test_request_context() self.context.push() with self.context: g._celery_tasks = [] for signal in self.DISCONNECTED_SIGNALS: for receiver in self....
21,421
[ 0.017908774316310883, 0.002730948617681861, 0.06092330440878868, -0.030417021363973618, -0.015509779565036297, 0.03081871196627617, 0.06203911826014519, -0.005701796617358923, 0.0004372586263343692, 0.03405456617474556, 0.024570168927311897, -0.0629763975739479, -0.005383790470659733, -0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def tearDownClass(cls): super(DbTestCase, cls).tearDownClass() for addon in cls.__ADDONS_UNDER_TEST: remove_mock_addon(addon) teardown_database(database=database_proxy._get_current_object()) settings.DB_NAME = cls._original_db_name settings.PIWIK_HOST = cls._origina...
21,422
[ -0.015728913247585297, -0.03193897008895874, 0.023759478703141212, -0.028318915516138077, -0.024538477882742882, 0.001656805514357984, 0.029739445075392723, 0.013300267979502678, -0.0007883072248660028, 0.004436286631971598, 0.024584302678704262, -0.022877376526594162, -0.007337486371397972,...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def setUpClass(cls): super(MockRequestTestCase, cls).setUpClass() httpretty.enable() for method in methods: httpretty.register_uri( method, re.compile(r'.*'), body=kill, priority=-1, )
21,423
[ -0.02730104885995388, -0.036589931696653366, 0.04520444571971893, -0.04764087498188019, -0.008010845631361008, -0.008728722110390663, 0.003257635049521923, 0.02177557721734047, 0.00825557578355074, 0.004290941637009382, -0.007510507479310036, -0.034088242799043655, -0.01160566508769989, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs"...
class MockRequestTestCase(unittest.TestCase): @classmethod def setUpClass(cls): super(MockRequestTestCase, cls).setUpClass() httpretty.enable() for method in methods: httpretty.register_uri( method, re.compile(r'.*'), body=kill...
21,424
[ -0.02040991373360157, -0.027964726090431213, 0.014654383063316345, -0.03399123251438141, -0.03045770525932312, 0.0030701584182679653, 0.02214416116476059, 0.021006060764193535, 0.018935805186629295, 0.0460008904337883, -0.03182342275977135, -0.04251071810722351, 0.0023913634940981865, -0.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": "argv", "annotation": null, "type_comment": null}}], "kwarg": null...
def handle_default_options(self, argv): acc = [] broker = None for i, arg in enumerate(argv): if "--settings=" in arg: _, settings_module = arg.split("=") os.environ["DJANGO_SETTINGS_MODULE"] = settings_module elif "--pythonpath=" in arg: ...
21,425
[ -0.005429411306977272, -0.01465941034257412, 0.02883852645754814, -0.049574702978134155, -0.035040583461523056, 0.02031852677464485, 0.011892499402165413, 0.0034769114572554827, -0.021842939779162407, 0.01987999863922596, -0.023137645795941353, -0.036878231912851334, 0.022887056693434715, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "option_list", "value": {"_type": "Name", "_fields": {"id": "BaseCommand", "ctx": {"_type": "Load", "_fields": ...
class CeleryCommand(BaseCommand): options = BaseCommand.option_list skip_opts = ["--app", "--loader", "--config"] keep_base_opts = False def get_version(self): return "celery %s" % (celery.__version__) def execute(self, *args, **options): broker = options.get("broker") if b...
21,426
[ -0.003254387527704239, -0.03790837526321411, 0.030566886067390442, -0.027802497148513794, -0.02714538760483265, -0.014433733187615871, -0.026782846078276634, 0.005613747984170914, -0.004857506137341261, -0.04470605403184891, 0.015181477181613445, -0.022398343309760094, 0.0029484922997653484,...
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 ReposSolrTest(unittest.TestCase): def testGetDocId(self): opt = OptionParser().parse_args([])[0] opt.base = '' opt.prefix = '' s = ReposSolr(opt) self.assertEqual(s.getDocId('/file.txt', None), '^/file.txt') opt.base = 'b' self.assertEqual(s.getDocId( '/file.txt', None), 'b^/f...
21,427
[ 0.040313564240932465, 0.03915591165423393, -0.03836144134402275, -0.02658062055706978, 0.005754216108471155, 0.010294032283127308, 0.00959603488445282, -0.015276479534804821, 0.014266370795667171, -0.001156943617388606, 0.07531554251909256, -0.024174518883228302, -0.012302900664508343, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "decoder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "eventid_typeid", "annotation": null, "type_comment": null}}, {...
def _decode_event_stream(decoder, eventid_typeid, event_types, decode_user_id): # Decodes events prefixed with a gameloop and possibly userid gameloop = 0 while not decoder.done(): start_bits = decoder.used_bits() # decode the gameloop delta before each event delta = _varuint32_valu...
21,428
[ -0.0003826186584774405, -0.023708336055278778, 0.021287914365530014, -0.030320223420858383, -0.027368487790226936, -0.0038520144298672676, -0.03341364115476608, 0.004781811032444239, -0.006346230395138264, -0.026848983019590378, 0.02382640540599823, -0.02583358623087406, 0.009126764722168446...
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 testGetDocId(self): opt = OptionParser().parse_args([])[0] opt.base = '' opt.prefix = '' s = ReposSolr(opt) self.assertEqual(s.getDocId('/file.txt', None), '^/file.txt') opt.base = 'b' self.assertEqual(s.getDocId( '/file.txt', None), 'b^/file.txt') opt.prefix = '/svn/' self.asser...
21,429
[ 0.03299466893076897, 0.033018808811903, 0.02568129450082779, 0.003469629678875208, -0.04178037494421005, 0.03610828518867493, -0.002677649026736617, 0.05532098188996315, -0.02473996952176094, 0.015362917445600033, -0.0027862635906785727, 0.01944199576973915, -0.018898922950029373, -0.01381...
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": "weakcontainer", "annot...
class _IterationGuard: # This context manager registers itself in the current iterators of the # weak container, such as to delay all removals until the context manager # exits. # This technique should be relatively thread-safe (since sets are). def __init__(self, weakcontainer): # Don't cr...
21,430
[ 0.05158882960677147, 0.022558879107236862, 0.03413041681051254, 0.0003344019642099738, -0.017155082896351814, 0.039185941219329834, 0.009678523056209087, 0.03869162127375603, -0.013121897354722023, 0.03197339177131653, 0.04974637180566788, -0.024333929643034935, -0.018997542560100555, -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": "data", "annotation": null, "type_comment": null}}], "kwarg": null...
def __init__(self, data=None): self.data = set() def _remove(item, selfref=ref(self)): self = selfref() if self is not None: if self._iterating: self._pending_removals.append(item) else: self.data.discard(ite...
21,431
[ -0.004795442335307598, -0.0063532753847539425, 0.027193481102585793, 0.00842022430151701, 0.02342541702091694, 0.04368029162287712, 0.0015989888925105333, 0.013291881419718266, -0.02242547646164894, 0.02648620679974556, 0.011090794578194618, -0.05575273558497429, -0.0071702990680933, -0.01...
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": "data", "annotation": n...
class WeakSet: def __init__(self, data=None): self.data = set() def _remove(item, selfref=ref(self)): self = selfref() if self is not None: if self._iterating: self._pending_removals.append(item) else: se...
21,432
[ 0.018411030992865562, 0.04336055740714073, 0.04933369532227516, 0.03438856080174446, 0.00032569581526331604, 0.04336055740714073, 0.01635853201150894, 0.03352823108434677, 0.00459661241620779, -0.003018831368535757, 0.05181635916233063, -0.011362481862306595, -0.012450182810425758, -0.0161...
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 pop(self): if self._pending_removals: self._commit_removals() while True: try: itemref = self.data.pop() except KeyError: raise KeyError('pop from empty WeakSet') item = itemref() if item is not None: ...
21,433
[ 0.016055284067988396, 0.03937646374106407, 0.019076230004429817, 0.027761448174715042, -0.02289147488772869, 0.05320509895682335, 0.03888165205717087, 0.0036785220727324486, 0.01476617343723774, -0.007825811393558979, 0.05375199764966965, -0.0254957377910614, -0.002387783955782652, -0.0051...
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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __isub__(self, other): if self._pending_removals: self._commit_removals() if self is other: self.data.clear() else: self.data.difference_update(ref(item) for item in other) return self
21,434
[ 0.004065957386046648, 0.039640314877033234, 0.021825438365340233, -0.04923464357852936, 0.015809593722224236, -0.011228467337787151, 0.018413135781884193, 0.012275423854589462, 0.011776872910559177, 0.04447071626782417, 0.00768321892246604, -0.013815391808748245, -0.02130473032593727, -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": "running", "annotation": null, "type_comment": null}}, {"_type": "...
def _run(self, running, schedule_node, complete_node, get_next_nodes): def schedule(nodes, not_done): for node in nodes: future = schedule_node(node) if future is not None: not_done.append(future) else: schedule...
21,435
[ 0.023505011573433876, 0.027365989983081818, 0.005338194314390421, 0.028200797736644745, -0.012182952836155891, 0.04265337809920311, 0.03980981931090355, 0.001971251331269741, -0.013272114098072052, -0.014335188083350658, 0.04340992122888565, -0.03493142127990723, -0.00512623181566596, -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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __ixor__(self, other): if self._pending_removals: self._commit_removals() if self is other: self.data.clear() else: self.data.symmetric_difference_update(ref(item, self._remove) for item in other) return self
21,436
[ -0.01757747121155262, -0.008075345307588577, -0.05080275237560272, -0.07578311115503311, 0.008531447499990463, -0.013437468558549881, 0.0064906831830739975, -0.008461277931928635, 0.011285602115094662, 0.02220866084098816, 0.04893156513571739, -0.04322443902492523, -0.013764926232397556, -...
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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,...
def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') page = self._download_webpage(url, video_id, 'Downloading page') video_guid = self._html_search_regex( r'<meta property="og:video" content="https?://(?:www\.)?newstube\.ru/freshp...
21,437
[ -0.04428723081946373, -0.02216615341603756, -0.08614034950733185, -0.07960432022809982, 0.014491953887045383, -0.018616413697600365, 0.004470981657505035, 0.003084892872720957, 0.00015803033602423966, 0.019168594852089882, 0.030561570078134537, -0.025513051077723503, -0.0021749199368059635, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "https?://(?:www\\.)?newstube\\.ru/media/(?P<id>.+)"}}, "targets": [{"_type": "Name", "_fields": {"id": "_VALID_URL", "ctx": {"_type": "St...
class NewstubeIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?newstube\.ru/media/(?P<id>.+)' _TEST = { 'url': 'http://www.newstube.ru/media/telekanal-cnn-peremestil-gorod-slavyansk-v-krym', 'info_dict': { 'id': '728e0ef2-e187-4012-bac0-5a081fdcb1f6', 'ext': 'flv', ...
21,438
[ 0.043649282306432724, 0.0020118935499340296, 0.05332108959555626, -0.06261443346738815, 0.012089758180081844, -0.013077965006232262, 0.019879767671227455, -0.035302095115184784, 0.014823094941675663, -0.02436874806880951, -0.008273599669337273, 0.02078387141227722, 0.0018174060387536883, -...
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": "content", "annotation"...
class BaseTests: # Write a content (str or bytes) to temp file, and return the # temp file's name. def writeTmp(self, content, *, mode='w'): # opening in text mode is the default fd, name = tempfile.mkstemp() self.addCleanup(support.unlink, name) with open(fd, mode) as f: ...
21,439
[ -0.0059649222530424595, -0.014749869704246521, 0.030571483075618744, -0.0031599686481058598, 0.003079588059335947, -0.007616077084094286, 0.037564609199762344, -0.008453376591205597, 0.01175568625330925, 0.014629298821091652, 0.03062506951391697, -0.014964218251407146, 0.007910806685686111, ...
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_security_cookie_init(): project = angr.Project(os.path.join(test_location, 'i386', 'test_arrays.exe')) check_value(project, angr.simos.windows.SecurityCookieInit.NONE, compare_none) check_value(project, angr.simos.windows.SecurityCookieInit.RANDOM, compare_random) check_value(project, angr.simo...
21,440
[ 0.01551980059593916, 0.050278641283512115, -0.011335653252899647, -0.03374867886304855, 0.03168243169784546, 0.008821721188724041, 0.002361833583563566, -0.0029644884634763002, -0.025805111974477768, -0.008615096099674702, 0.0008178888820111752, -0.03301401436328888, -0.026838233694434166, ...
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 LineReader: def __init__(self): self._linesread = [] @property def linesread(self): try: return self._linesread[:] finally: self._linesread = [] def openhook(self, filename, mode): self.it = iter(filename.splitlines(True)) return s...
21,441
[ 0.030266322195529938, -0.0006768176681362092, 0.01990567333996296, -0.013656217604875565, 0.012223361991345882, 0.0037667572032660246, -0.011308538727462292, 0.02777535654604435, -0.0462922602891922, 0.04871709644794464, 0.0127303721383214, -0.0052381898276507854, -0.02914208173751831, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "hint", "annotation": null, "type_comment": null}}], "kwarg": null...
def readlines(self, hint=-1): lines = [] size = 0 while True: line = self.readline() if not line: return lines lines.append(line) size += len(line) if size >= hint: return lines
21,442
[ -0.01200171373784542, -0.025540655478835106, 0.0904696136713028, -0.03008933737874031, -0.01674569770693779, 0.019908355548977852, 0.015687279403209686, -0.02416723035275936, -0.021382581442594528, 0.031903769820928574, 0.03472622111439705, 0.017917519435286522, -0.006322162691503763, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class BufferSizesTests(BaseTests, unittest.TestCase): def test_buffer_sizes(self): # First, run the tests with default and teeny buffer size. for round, bs in (0, 0), (1, 30): t1 = self.writeTmp(''.join("Line %s of file 1\n" % (i+1) for i in range(15))) t2 = self.writeTmp(''....
21,443
[ 0.013278172351419926, -0.02965293452143669, 0.08645676076412201, -0.040775880217552185, -0.019768623635172844, 0.018505213782191277, 0.0307924784719944, -0.013166695833206177, -0.0018502117600291967, 0.050585873425006866, 0.03465702012181282, 0.047340650111436844, -0.025280550122261047, -0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_buffer_sizes(self): # First, run the tests with default and teeny buffer size. for round, bs in (0, 0), (1, 30): t1 = self.writeTmp(''.join("Line %s of file 1\n" % (i+1) for i in range(15))) t2 = self.writeTmp(''.join("Line %s of file 2\n" % (i+1) for i in range(10))) ...
21,444
[ 0.03689541295170784, -0.011621548794209957, 0.036541134119033813, -0.06336496025323868, 0.01694202795624733, -0.046283748000860214, 0.002873755292966962, -0.00017328333342447877, 0.04145039990544319, 0.026014048606157303, 0.030164150521159172, -0.003795824246481061, 0.00507691502571106, 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_zero_byte_files(self): t1 = self.writeTmp("") t2 = self.writeTmp("") t3 = self.writeTmp("The only line there is.\n") t4 = self.writeTmp("") fi = FileInput(files=(t1, t2, t3, t4)) line = fi.readline() self.assertEqual(line, 'The only line there is.\n') ...
21,445
[ -0.0062101795338094234, -0.010260015726089478, 0.08723915368318558, -0.052389923483133316, -0.030773598700761795, -0.008705859072506428, 0.02275131084024906, -0.021074626594781876, -0.0210875254124403, 0.03773828595876694, 0.04312947019934654, 0.006771223619580269, 0.017102176323533058, 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": "t1", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def buffer_size_test(self, t1, t2, t3, t4, bs=0, round=0): pat = re.compile(r'LINE (\d+) OF FILE (\d+)') start = 1 + round*6 if verbose: print('%s. Simple iteration (bs=%s)' % (start+0, bs)) fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) lines = list(fi) ...
21,446
[ 0.058592282235622406, 0.007071679923683405, 0.0653829276561737, -0.06735588610172272, 0.02157636731863022, -0.028240837156772614, 0.009228169918060303, -0.018571045249700546, 0.020257238298654556, 0.03177380934357643, -0.005999170709401369, -0.004849234130233526, 0.004485039506107569, 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_files_that_dont_end_with_newline(self): t1 = self.writeTmp("A\nB\nC") t2 = self.writeTmp("D\nE\nF") fi = FileInput(files=(t1, t2)) lines = list(fi) self.assertEqual(lines, ["A\n", "B\n", "C", "D\n", "E\n", "F"]) self.assertEqual(fi.filelineno(), 3) self.a...
21,447
[ 0.03928099945187569, -0.010245135985314846, 0.04684516787528992, -0.06908285617828369, 0.034613240510225296, -0.028940115123987198, 0.004449333064258099, -0.0253974050283432, 0.006786205805838108, -0.00868323165923357, 0.0271687600761652, -0.008252360858023167, -0.0007379400194622576, 0.03...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_fileno(self): t1 = self.writeTmp("A\nB") t2 = self.writeTmp("C\nD") fi = FileInput(files=(t1, t2)) self.assertEqual(fi.fileno(), -1) line = next(fi) self.assertNotEqual(fi.fileno(), -1) fi.nextfile() self.assertEqual(fi.fileno(), -1) line ...
21,448
[ 0.021375032141804695, 0.05338103324174881, -0.0007308005588129163, -0.026740780100226402, 0.02183998003602028, -0.026615118607878685, 0.007099878508597612, 0.018459683284163475, 0.03749741241335869, -0.02643919363617897, 0.06453978270292282, 0.006427588872611523, -0.002043571090325713, 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_gz_ext_fake(self): original_open = gzip.open gzip.open = self.fake_open try: result = fileinput.hook_compressed("test.gz", 3) finally: gzip.open = original_open self.assertEqual(self.fake_open.invocation_count, 1) self.assertEqual(self.fa...
21,449
[ 0.0245143361389637, 0.043210867792367935, 0.0012524438789114356, -0.026030942797660828, 0.016844281926751137, -0.04733802750706673, 0.01726694405078888, 0.041793711483478546, 0.015352537855505943, -0.0028809315990656614, 0.03647315502166748, -0.001295953057706356, 0.00863347202539444, 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_bz2_ext_fake(self): original_open = bz2.BZ2File bz2.BZ2File = self.fake_open try: result = fileinput.hook_compressed("test.bz2", 4) finally: bz2.BZ2File = original_open self.assertEqual(self.fake_open.invocation_count, 1) self.assertEqual...
21,450
[ 0.031090790405869484, 0.030151722952723503, -0.012442661449313164, -0.04911075904965401, 0.014174862764775753, -0.01795651763677597, 0.042791079729795456, 0.037156667560338974, 0.03515163064002991, -0.014086032286286354, 0.06822207570075989, -0.03152225539088249, 0.007664831820875406, 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(self): encoding = object() errors = object() result = fileinput.hook_encoded(encoding, errors=errors) fake_open = InvocationRecorder() original_open = builtins.open builtins.open = fake_open try: filename = object() mode = object(...
21,451
[ 0.02350415289402008, 0.034233786165714264, -0.00592415314167738, -0.051386766135692596, 0.022096792235970497, 0.00863663386553526, 0.014205939136445522, -0.016804147511720657, 0.013087267056107521, -0.006663920823484659, 0.0358937531709671, 0.014242025092244148, 0.04388083517551422, 0.0464...
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}}, {"_type": ...
def do_test_use_builtin_open(self, filename, mode): original_open = self.replace_builtin_open(self.fake_open) try: result = fileinput.hook_compressed(filename, mode) finally: self.replace_builtin_open(original_open) self.assertEqual(self.fake_open.invocation_coun...
21,452
[ 0.031094146892428398, -0.04086444154381752, 0.006963531952351332, -0.015170327387750149, -0.016375916078686714, -0.010442158207297325, -0.012363565154373646, 0.001971640158444643, -0.03553975746035576, -0.07484697550535202, 0.024739690124988556, -0.0372476726770401, 0.012922406196594238, -...
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_steal(self): with mock.patch.object(self.dbapi, 'steal_bay_lock', autospec=True) as mock_steal_baylock: old_conductor_id = self.conductor_id new_conductor_id = str(uuid.uuid4()) objects.BayLock.steal(self.bay_uuid, old_conductor_id, ...
21,453
[ 0.007945365272462368, -0.0019756786059588194, 0.041311025619506836, -0.022519994527101517, -0.035729773342609406, -0.03451116010546684, 0.0023016578052192926, 0.0051455991342663765, -0.007768666837364435, -0.04187158867716789, -0.006537866313010454, -0.02612709254026413, 0.018193911761045456...
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 TestBayLockObject(base.DbTestCase): def setUp(self): super(TestBayLockObject, self).setUp() baylock_dict = utils.get_test_baylock() self.bay_uuid = baylock_dict['bay_uuid'] self.conductor_id = baylock_dict['conductor_id'] def test_create(self): with mock.patch.obj...
21,454
[ 0.052855487912893295, 0.03680143877863884, -0.0203042421489954, -0.028905345126986504, 0.0329742506146431, 0.0054436721839010715, 0.04854486510157585, -0.013898737728595734, -0.012659937143325806, -0.02727375365793705, 0.02006252482533455, -0.00732705183327198, 0.026347171515226364, -0.011...
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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __setattr__(self, name, value): # For properties of this instance like _buffer, or descriptors set on # the class like filename, use regular __setattr__ if name in self.__dict__ or name in self.__class__.__dict__: object.__setattr__(self, name, value) else: # ...
21,455
[ 0.04667362943291664, 0.04754101485013962, 0.017048265784978867, -0.028788955882191658, 0.021457478404045105, 0.01093525905162096, -0.01529284194111824, -0.0006847444456070662, -0.001357872155494988, 0.04206822067499161, 0.01923738233745098, 0.0020703678019344807, 0.021705303341150284, 0.04...
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 getter(self): if closed_only and not self._closed: raise AttributeError("can only get %r on a closed file" % field_name) # Protect against PHP-237 if field_name == 'length': return self._file.get(field_name, 0) return self._fil...
21,456
[ 0.03998633474111557, 0.004714521579444408, -0.031467605382204056, 0.02454473078250885, -0.008631114847958088, 0.00898512452840805, 0.020352797582745552, -0.03394005820155144, -0.01691383682191372, -0.009620096534490585, 0.028073599562048912, -0.04639223963022232, -0.0019021043553948402, -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}}, {"_type": "arg", "_fields": {"arg": "grid_out", "annotation...
class GridOutIterator(object): def __init__(self, grid_out, chunks): self.__id = grid_out._id self.__chunks = chunks self.__current_chunk = 0 self.__max_chunk = math.ceil(float(grid_out.length) / grid_out.chunk_size) def __iter__(self): ...
21,457
[ 0.06466693431138992, 0.010385801084339619, 0.007845945656299591, 0.013549577444791794, 0.012036707252264023, 0.0014742205385118723, -0.0009641788783483207, 0.02999238297343254, -0.038561634719371796, -0.0010055896127596498, 0.042382460087537766, -0.005438603926450014, -0.023410843685269356, ...
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 next(self): if self.__current_chunk >= self.__max_chunk: raise StopIteration chunk = self.__chunks.find_one({"files_id": self.__id, "n": self.__current_chunk}) if not chunk: raise CorruptGridFile("no chunk #%d" % self.__current_...
21,458
[ 0.07502533495426178, -0.012793594039976597, 0.010132222436368465, -0.06995605677366257, 0.024256501346826553, 0.03660019487142563, 0.0537850521504879, -0.0036688908003270626, 0.0022827598731964827, -0.001668109674938023, 0.03916018456220627, -0.028083806857466698, -0.008959950879216194, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": n...
def new_version(self, session): # convert to an INSERT make_transient(self) self.id = None # history of the 'elements' collection. # this is a tuple of groups: (added, unchanged, deleted) hist = attributes.get_history(self, 'elements') # rewrite the 'elements' c...
21,459
[ 0.010283615440130234, 0.01786486990749836, -0.007248451467603445, -0.07140623033046722, 0.008459854871034622, 0.04536771774291992, 0.0527692586183548, 0.026664184406399727, 0.014217348769307137, 0.002472727093845606, 0.06379169970750809, -0.011455082334578037, -0.038711655884981155, 0.0203...
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": "session", "annotation": null, "type_comment": null}}, {"_type": "...
def before_flush(self, session, flush_context, instances): for instance in session.dirty: if hasattr(instance, 'new_version') and \ session.is_modified(instance, passive=True): # make it transient instance.new_version(session) # re-ad...
21,460
[ 0.05076119303703308, 0.01738612912595272, 0.05832494795322418, 0.022985408082604408, 0.004270369186997414, 0.02844811975955963, 0.02605292946100235, 0.06051003187894821, 0.011828870512545109, -0.03815493732690811, 0.013478189706802368, -0.015327107161283493, 0.023090459406375885, -0.008425...
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": "group", "annotation": ...
class DummyProcess(threading.Thread): def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): threading.Thread.__init__(self, group, target, name, args, kwargs) self._pid = None self._children = weakref.WeakKeyDictionary() self._start_called = False self....
21,461
[ 0.033000554889440536, 0.019205939024686813, -0.03050793707370758, -0.014700053259730339, 0.00978938303887844, 0.017182018607854843, -0.042012326419353485, -0.05385758727788925, -0.020345725119113922, 0.04171406477689743, -0.001438048668205738, -0.0492132231593132, 0.013720049522817135, -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": {"_type": "arg", "_fields": {"arg": "kwds", "anno...
class Namespace(object): def __init__(self, **kwds): self.__dict__.update(kwds) def __repr__(self): items = self.__dict__.items() temp = [] for name, value in items: if not name.startswith('_'): temp.append('%s=%r' % (name, value)) temp.sort() ...
21,462
[ 0.06043842434883118, 0.01820814609527588, 0.01362230721861124, -0.03779091686010361, 0.0252164788544178, -0.01088432502001524, -0.043942928314208984, -0.037475429475307465, -0.009109706617891788, 0.03614587336778641, -0.016788451001048088, -0.019639108330011368, 0.01720534637570381, -0.049...
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 __repr__(self): items = self.__dict__.items() temp = [] for name, value in items: if not name.startswith('_'): temp.append('%s=%r' % (name, value)) temp.sort() return 'Namespace(%s)' % str.join(', ', temp)
21,463
[ 0.008512847125530243, 0.026930995285511017, -0.046476367861032486, -0.0177907794713974, 0.019229138270020485, 0.014771242626011372, -0.011476276442408562, -0.04859820380806923, -0.016485033556818962, -0.015597534365952015, 0.029930127784609795, -0.02421749383211136, 0.0017800979549065232, ...
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": "typecode", "annotation...
class Value(object): def __init__(self, typecode, value, lock=True): self._typecode = typecode self._value = value def _get(self): return self._value def _set(self, value): self._value = value value = property(_get, _set) def __repr__(self): return '<%s(%r, %r...
21,464
[ 0.003330012783408165, 0.02725784294307232, 0.02227730304002762, -0.0018821810372173786, 0.0007544811232946813, -0.0017518762033432722, 0.020565643906593323, 0.0049001057632267475, 0.014568403363227844, 0.08066674321889877, 0.00994821172207594, -0.04540399834513664, -0.030964292585849762, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "lower", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "upper", "annotation": null, "type_comment": null}}], "kwarg": nu...
def in_between(lower, upper): def _in_between(actual): _, _, estimate = actual[0] if estimate < lower or estimate > upper: raise BeamAssertException( 'Failed assert: %f not in [%f, %f]' % (estimate, lower, upper)) return _in_between
21,465
[ -0.0038346932269632816, -0.035600222647190094, 0.02834700234234333, -0.028989091515541077, -0.046610843390226364, -0.0135551942512393, -0.015184195712208748, 0.030653763562440872, 0.013139026239514351, 0.02099866047501564, 0.019191302359104156, -0.027324417605996132, 0.0002201604365836829, ...
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 EstimatePiTest(unittest.TestCase): def test_basics(self): with TestPipeline() as p: result = p | 'Estimate' >> estimate_pi.EstimatePiTransform(5000) # Note: Probabilistically speaking this test can fail with a probability # that is very small (VERY) given that we run at least 500 thousand...
21,466
[ -0.001445138594135642, -0.05461664870381355, 0.045806098729372025, -0.012952825054526329, -0.017401933670043945, 0.01553900633007288, 0.06290119886398315, -0.017182765528559685, -0.018903233110904694, 0.014815752394497395, 0.005106612574309111, -0.02553306333720684, 0.017380017787218094, -...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def setUp(self): super(CollectionTestCase, self).setUp() temp_dir = tempfile.mkdtemp() # Override the STATIC_ROOT for all tests from setUp to tearDown # rather than as a context manager self.patched_settings = self.settings(STATIC_ROOT=temp_dir) self.patched_settings.enab...
21,467
[ 0.001123578753322363, -0.03496158868074417, 0.019858600571751595, -0.022393185645341873, -0.04609286040067673, -0.010510687716305256, -0.019100839272141457, 0.028768843039870262, 0.01737627573311329, 0.025019224733114243, 0.019976185634732246, -0.014214578084647655, -0.0024610948748886585, ...
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_basics(self): with TestPipeline() as p: result = p | 'Estimate' >> estimate_pi.EstimatePiTransform(5000) # Note: Probabilistically speaking this test can fail with a probability # that is very small (VERY) given that we run at least 500 thousand # trials. assert_that(result, ...
21,468
[ 0.046900808811187744, -0.012559507973492146, 0.03406533971428871, -0.02700583077967167, 0.0003455549303907901, 0.024567091837525368, 0.00003306637881905772, -0.022269541397690773, 0.009190197102725506, 0.025940487161278725, -0.01717386022210121, -0.026723450049757957, -0.032242704182863235, ...
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_aic_R(self): # R includes the estimation of the scale as a lost dof # Doesn't with Gamma though if self.res1.scale != 1: dof = 2 else: dof = 0 assert_almost_equal(self.res1.aic+dof, self.res2.aic_R, self.decimal_aic_R)
21,469
[ 0.02164422534406185, -0.04259702190756798, 0.023496270179748535, -0.0282992385327816, -0.006327818613499403, -0.0035312313120812178, -0.05625276267528534, -0.009056497365236282, 0.03252189978957176, 0.001960080349817872, 0.013248290866613388, -0.03252189978957176, -0.009500987827777863, -0...
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 test_aic_Stata(self): # Stata uses the below llf for aic definition for these families if isinstance(self.res1.model.family, (sm.families.Gamma, sm.families.InverseGaussian)): llf = self.res1.model.family.loglike(self.res1.model.endog, self.res1.mu, scale=...
21,470
[ 0.04046917334198952, -0.0010268345940858126, 0.00022898893803358078, -0.03679249435663223, -0.005685353185981512, 0.0006307238945737481, -0.023114223033189774, -0.02355131134390831, 0.006800569593906403, 0.01921900175511837, -0.012424859218299389, -0.009127418510615826, 0.005640359129756689,...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_loglike(self): # Stata uses the below llf for these families # We differ with R for them if isinstance(self.res1.model.family, (sm.families.Gamma, sm.families.InverseGaussian)): llf = self.res1.model.family.loglike(self.res1.model.endog, self....
21,471
[ 0.010666090995073318, -0.016302278265357018, 0.03610752522945404, -0.00863391999155283, 0.0065119294449687, -0.015864407643675804, 0.000842761539388448, 0.026249811053276062, 0.03644435107707977, 0.03029169887304306, 0.01475288812071085, 0.028809674084186554, -0.0032363166101276875, 0.0288...
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_tpvalues(self): # test comparing tvalues and pvalues with normal implementation # make sure they use normal distribution (inherited in results class) params = self.res1.params tvalues = params / self.res1.bse pvalues = stats.norm.sf(np.abs(tvalues)) * 2 half_widt...
21,472
[ 0.03803152218461037, 0.029509935528039932, 0.024407504126429558, -0.004250929690897465, 0.006295847240835428, -0.010033903643488884, -0.0019249182660132647, 0.009376374073326588, 0.007785152178257704, 0.046316396445035934, -0.013426757417619228, -0.024723118171095848, 0.00961965974420309, ...
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_score_test(self): res1 = self.res1 # fake example, should be zero, k_constraint should be 0 st, pv, df = res1.model.score_test(res1.params, k_constraints=1) assert_allclose(st, 0, atol=1e-20) assert_allclose(pv, 1, atol=1e-10) assert_equal(df, 1) st, pv,...
21,473
[ 0.03390786796808243, -0.008489666506648064, 0.03296809643507004, -0.05740208178758621, -0.021119393408298492, -0.015379185788333416, -0.02407839521765709, -0.004736941773444414, -0.020509814843535423, 0.019887534901499748, -0.022211557254195213, -0.013563146814703941, -0.01494740042835474, ...
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 score_test_r(self): res1 = self.res1 res2 = self.res2 st, pv, df = res1.model.score_test(res1.params, exog_extra=res1.model.exog[:, 1]**2) st_res = 0.2837680293459376 # (-0.5326988167303712)**2 assert_allclose(st, st_res, rtol=1e-4)...
21,474
[ 0.029856381937861443, -0.022218702360987663, 0.04270157217979431, 0.004499821458011866, -0.018533390015363693, 0.02793361060321331, 0.015315416269004345, 0.02177806757390499, 0.019841942936182022, 0.02281956933438778, 0.0015672597801312804, -0.04027140140533447, 0.012972037307918072, -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 test_predict(self): np.random.seed(382304) endog = np.random.randint(0, 10, 100) exog = np.random.normal(size=(100,3)) exposure = np.random.uniform(1, 2, 100) mod1 = GLM(endog, exog, family=sm.families.Poisson(), exposure=exposure).fit() exog1 = np....
21,475
[ 0.045316364616155624, -0.011197065934538841, 0.022771349176764488, -0.027134494855999947, -0.033622629940509796, 0.01865968108177185, 0.004605194088071585, 0.007613501511514187, 0.004136816132813692, -0.0028951424174010754, -0.008273632265627384, -0.028190702199935913, 0.0028637077193707228,...
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 test_offset_exposure(self): # exposure=x and offset=log(x) should have the same effect np.random.seed(382304) endog = np.random.randint(0, 10, 100) exog = np.random.normal(size=(100,3)) exposure = np.random.uniform(1, 2, 100) offset = np.random.uniform(1, 2, 100) ...
21,476
[ 0.04622764140367508, 0.028273941949009895, 0.004557478241622448, -0.05308269336819649, -0.04597654193639755, 0.007118705660104752, -0.012096777558326721, -0.0019742795266211033, -0.03457656875252724, -0.04271223396062851, 0.04740781709551811, -0.01745150052011013, 0.016848858445882797, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_attribute_writable_resettable(): # Regression test for mutables and class constructors. data = sm.datasets.longley.load() endog, exog = data.endog, data.exog glm_model = sm.GLM(endog, exog) assert_equal(glm_model.family.link.power, 1.0) glm_model.family.link.power = 2. assert_equal(...
21,477
[ -0.008370026014745235, 0.031490202993154526, 0.04211130738258362, -0.014874518848955631, 0.014563596807420254, -0.028604844585061073, 0.013854694552719593, -0.02259782701730728, -0.009738083928823471, 0.08248144388198853, -0.004872151184827089, -0.016603246331214905, 0.03178868815302849, -...
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_prefect_pred(): cur_dir = os.path.dirname(os.path.abspath(__file__)) iris = np.genfromtxt(os.path.join(cur_dir, 'results', 'iris.csv'), delimiter=",", skip_header=1) y = iris[:,-1] X = iris[:,:-1] X = X[y != 2] y = y[y != 2] X = add_constant(X, prepend=True) ...
21,478
[ 0.009895066730678082, 0.007498125080019236, -0.03365551680326462, -0.04368579760193825, 0.012119919992983341, -0.00951401423662901, -0.009747562929987907, -0.025223201140761375, 0.007983659394085407, 0.037048112601041794, -0.010515812784433365, -0.01050352118909359, 0.026870330795645714, 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 test_loglike_no_opt(): # see 1728 y = np.asarray([0, 1, 0, 0, 1, 1, 0, 1, 1, 1]) x = np.arange(10, dtype=np.float64) def llf(params): lin_pred = params[0] + params[1]*x pr = 1 / (1 + np.exp(-lin_pred)) return np.sum(y*np.log(pr) + (1-y)*np.log(1-pr)) for params in [0,0...
21,479
[ -0.0006394826341420412, 0.0215597003698349, 0.014531481079757214, -0.023642586544156075, -0.050476495176553726, -0.029988689348101616, 0.020780140534043312, 0.0006760244723409414, -0.00458295876160264, 0.033082567155361176, -0.005989820696413517, 0.0022716859821230173, 0.011297526769340038, ...
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_glm_start_params(): # see 1604 y2 = np.array('0 1 0 0 0 1'.split(), int) wt = np.array([50,1,50,1,5,10]) y2 = np.repeat(y2, wt) x2 = np.repeat([0,0,0.001,100,-1,-1], wt) mod = sm.GLM(y2, sm.add_constant(x2), family=sm.families.Binomial()) res = mod.fit(start_params=[-4, -5]) np....
21,480
[ 0.003638078458607197, 0.037704285234212875, -0.017547281458973885, -0.04113420844078064, -0.012539098970592022, 0.059054307639598846, 0.002889336319640279, -0.038126811385154724, 0.0005801973748020828, -0.00023456440248992294, 0.05229388177394867, -0.02190924808382988, -0.02152400277554989, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg...
def pwm_prog(): # fmt: off pull(noblock) .side(0) mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock mov(y, isr) # ISR must be preloaded with PWM count max label("pwmloop") jmp(x_not_y, "skip") nop() .side(1) label("skip") jmp(y_dec, "pwmloop")
21,481
[ 0.005524464882910252, 0.01925584487617016, -0.014848316088318825, -0.024831490591168404, -0.035212066024541855, 0.007893812842667103, -0.016185026615858078, -0.05264950543642044, 0.019014997407794, 0.027191806584596634, 0.08468236774206161, -0.010404659435153008, 0.01422210969030857, 0.001...
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": "sm_id", "annotation": ...
class PIOPWM: def __init__(self, sm_id, pin, max_count, count_freq): self._sm = StateMachine(sm_id, pwm_prog, freq=2 * count_freq, sideset_base=Pin(pin)) # Use exec() to load max count into ISR self._sm.put(max_count) self._sm.exec("pull()") self._sm.exec("mov(isr, osr)") ...
21,482
[ 0.002501143142580986, 0.017965657636523247, -0.017223678529262543, -0.005668244324624538, -0.033814847469329834, 0.02880343794822693, -0.0129907401278615, -0.04646500572562218, -0.00208910065703094, 0.04035887122154236, 0.07789578288793564, -0.009724809788167477, 0.01384219340980053, 0.022...
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": "sm_id", "annotation": null, "type_comment": null}}, {"_type": "ar...
def __init__(self, sm_id, pin, max_count, count_freq): self._sm = StateMachine(sm_id, pwm_prog, freq=2 * count_freq, sideset_base=Pin(pin)) # Use exec() to load max count into ISR self._sm.put(max_count) self._sm.exec("pull()") self._sm.exec("mov(isr, osr)") self._sm.acti...
21,483
[ 0.023702891543507576, 0.015346527099609375, 0.02984415367245674, 0.004271029960364103, 0.023915115743875504, 0.01585056260228157, -0.017176968976855278, 0.0036443029530346394, -0.0012725215638056397, 0.005647177342325449, 0.014696587808430195, -0.021620431914925575, 0.03140931576490402, 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 PauschBridge(Bridge): def init(self): self.rig = core.init(upload = True, run = False, wipe = True, fire = True) def paint(self): for light in self.lights(): # TODO: Support setting top and bottom separately (have the data, # just don't want to figure out the query...
21,484
[ 0.043315570801496506, -0.03162182867527008, -0.015384580008685589, -0.02191358618438244, 0.04679933190345764, 0.008234343491494656, -0.019270313903689384, -0.006443739403039217, -0.01615198142826557, -0.018673446029424667, 0.01679757423698902, 0.00019356342090759426, -0.013995948247611523, ...
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 paint(self): for light in self.lights(): # TODO: Support setting top and bottom separately (have the data, # just don't want to figure out the query rn) query = "$sequence=%d" % light.sequence core.query(self.rig, query).setRGBRaw(*light.color) self.r...
21,485
[ 0.03933805227279663, -0.0011759320041164756, 0.054907333105802536, -0.006723097991198301, -0.04075344279408455, -0.019559212028980255, 0.07594294100999832, 0.035750776529312134, -0.03819110244512558, -0.016777241602540016, 0.03316402807831764, -0.02933271788060665, -0.01947380043566227, -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 setUp(self): self.db_config['collection'] = 'modulestore{0}'.format(uuid.uuid4().hex[:5]) self.user_id = random.getrandbits(32) super(SplitWMongoCourseBootstrapper, self).setUp() self.split_mongo = SplitMongoModuleStore( None, self.db_config, **se...
21,486
[ 0.07159731537103653, 0.04723285511136055, 0.046634428203105927, 0.0180168766528368, 0.01440495252609253, 0.030284594744443893, 0.01380652654916048, 0.0025994100142270327, -0.012150171212852001, -0.011081553995609283, 0.038277845829725266, -0.05612374469637871, 0.006946008186787367, 0.03165...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Hashable(metaclass=ABCMeta): __slots__ = () @abstractmethod def __hash__(self): return 0 @classmethod def __subclasshook__(cls, C): if cls is Hashable: for B in C.__mro__: if "__hash__" in B.__dict__: if B.__dict__["__hash__"]:...
21,487
[ 0.03182017803192139, 0.06293991208076477, 0.030594399198889732, -0.02681700326502323, -0.0015978881856426597, 0.003555379342287779, 0.04475337639451027, -0.02312716469168663, 0.0028095939196646214, -0.029943987727165222, -0.0052283150143921375, -0.00485933106392622, 0.003042554249987006, 0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "event", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def update_zappa_settings(event): resource_props = event.get("ResourceProperties") if resource_props is None: raise RuntimeError("ResourceProperties not available from CloudFormation") enc_key_id = resource_props.get("EncryptionKeyId") if enc_key_id is None: raise RuntimeError("Encrypti...
21,488
[ 0.012996187433600426, 0.02976294420659542, 0.0005692804115824401, 0.020860834047198296, 0.026750952005386353, 0.03337733447551727, 0.011690990999341011, 0.007396113593131304, -0.025546154007315636, 0.013654363341629505, 0.009816862642765045, -0.03821883350610733, 0.02146323211491108, 0.046...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "C", "annotation": null, "type_comment": null}}], "kwarg": null, "v...
def __subclasshook__(cls, C): if cls is Hashable: for B in C.__mro__: if "__hash__" in B.__dict__: if B.__dict__["__hash__"]: return True break return NotImplemented
21,489
[ 0.08903614431619644, 0.04179292172193527, -0.00015627039829269052, -0.01796419732272625, -0.026074247434735298, 0.06479319930076599, 0.02694629691541195, -0.0038070364389568567, -0.02566002495586872, 0.03217858821153641, 0.016732430085539818, -0.0968845784664154, 0.03826112672686577, 0.018...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Iterable(metaclass=ABCMeta): __slots__ = () @abstractmethod def __iter__(self): while False: yield None @classmethod def __subclasshook__(cls, C): if cls is Iterable: if any("__iter__" in B.__dict__ for B in C.__mro__): return True ...
21,490
[ 0.11036628484725952, 0.0510350838303566, 0.06557659059762955, 0.01605624333024025, -0.01815357618033886, 0.08193577826023102, 0.00536276213824749, -0.03274168819189072, -0.05774654820561409, 0.015613473020493984, 0.0019254675135016441, -0.0767623633146286, 0.02533111348748207, 0.0431351326...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Sized(metaclass=ABCMeta): __slots__ = () @abstractmethod def __len__(self): return 0 @classmethod def __subclasshook__(cls, C): if cls is Sized: if any("__len__" in B.__dict__ for B in C.__mro__): return True return NotImplemented
21,491
[ 0.09562767297029495, 0.028249796479940414, -0.06231820955872536, 0.006298229098320007, -0.005829155910760164, 0.08829116076231003, 0.012849441729485989, 0.002827615011483431, -0.008754274807870388, -0.002906672190874815, -0.001358467387035489, -0.07509386539459229, 0.03115910477936268, 0.0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Iterator(Iterable): __slots__ = () @abstractmethod def __next__(self): raise StopIteration def __iter__(self): return self @classmethod def __subclasshook__(cls, C): if cls is Iterator: if (any("__next__" in B.__dict__ for B in C.__mro__) and ...
21,492
[ 0.0655611902475357, 0.03439699485898018, 0.02954779379069805, 0.015054073184728622, 0.007462380453944206, 0.05870765447616577, 0.033319395035505295, -0.0024272941518574953, -0.02015112154185772, -0.01899809017777443, 0.0015059461584314704, -0.06120768561959267, 0.03778065741062164, 0.04008...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Container(metaclass=ABCMeta): __slots__ = () @abstractmethod def __contains__(self, x): return False @classmethod def __subclasshook__(cls, C): if cls is Container: if any("__contains__" in B.__dict__ for B in C.__mro__): return True retur...
21,493
[ 0.06494943052530289, 0.03692931309342384, 0.015464150346815586, 0.00009421662980457768, -0.02219220995903015, 0.042445629835128784, 0.008101368322968483, -0.028897186741232872, 0.0009095285786315799, 0.00012649371637962759, -0.0009874263778328896, -0.09933985024690628, 0.03466739133000374, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Callable(metaclass=ABCMeta): __slots__ = () @abstractmethod def __call__(self, *args, **kwds): return False @classmethod def __subclasshook__(cls, C): if cls is Callable: if any("__call__" in B.__dict__ for B in C.__mro__): return True ret...
21,494
[ 0.022628752514719963, -0.009861854836344719, -0.02131638675928116, -0.004873591009527445, 0.03470761328935623, -0.018602466210722923, 0.038453590124845505, 0.028464321047067642, 0.009823630563914776, 0.006450341548770666, 0.03307671472430229, -0.05213787034153938, 0.002099148230627179, -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": "it", "annotation": null, "type_comment": null}}], "kwarg": null, ...
def __ixor__(self, it): if it is self: self.clear() else: if not isinstance(it, Set): it = self._from_iterable(it) for value in it: if value in self: self.discard(value) else: self...
21,495
[ 0.014842718839645386, -0.061952218413352966, -0.020595107227563858, 0.0007983246468938887, 0.041568513959646225, 0.06137363985180855, 0.025902435183525085, -0.011649420484900475, -0.020227933302521706, 0.009118147194385529, -0.0007072266307659447, -0.10636910796165466, 0.019193170592188835, ...
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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __le__(self, other): if not isinstance(other, Set): return NotImplemented if len(self) > len(other): return False for elem in self: if elem not in other: return False return True
21,496
[ 0.049420371651649475, 0.010999681428074837, 0.03446914255619049, -0.005942956078797579, -0.016285784542560577, 0.003534494899213314, 0.01875680312514305, -0.014711422845721245, -0.039244361221790314, -0.005301742348819971, 0.019538771361112595, -0.0462924987077713, 0.012907682918012142, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class Mapping(Sized, Iterable, Container): __slots__ = () @abstractmethod def __getitem__(self, key): raise KeyError def get(self, key, default=None): try: return self[key] except KeyError: return default def __contains__(self, key): try: ...
21,497
[ 0.03288879618048668, 0.02961914986371994, 0.03288879618048668, -0.02701198123395443, -0.012106239795684814, 0.015194239094853401, 0.020397892221808434, -0.021487774327397346, -0.013003789819777012, -0.0008948786999098957, 0.03126465901732445, -0.03645762428641319, -0.0003910085652023554, 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}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": ...
class ValuesView(MappingView): def __contains__(self, value): for key in self._mapping: if value == self._mapping[key]: return True return False def __iter__(self): for key in self._mapping: yield self._mapping[key]
21,498
[ 0.02235819771885872, -0.0037324780132621527, 0.0023311616387218237, -0.022295335307717323, 0.0023298519663512707, -0.006469628307968378, 0.04404585808515549, 0.008800789713859558, -0.04865579679608345, 0.04890724644064903, 0.014144127257168293, -0.05414581298828125, 0.0021451925858855247, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwds", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": ...
def update(*args, **kwds): if len(args) > 2: raise TypeError("update() takes at most 2 positional " "arguments ({} given)".format(len(args))) elif not args: raise TypeError("update() takes at least 1 argument (0 given)") self = args[0] ...
21,499
[ 0.06715000420808792, 0.04717695713043213, 0.008801588788628578, -0.004367726389318705, -0.03223023936152458, 0.01149662770330906, 0.05334964394569397, -0.004563378635793924, -0.012565825134515762, -0.021483151242136955, 0.0021604399662464857, -0.05868460610508919, 0.0110502103343606, 0.001...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class MutableMapping(Mapping): __slots__ = () @abstractmethod def __setitem__(self, key, value): raise KeyError @abstractmethod def __delitem__(self, key): raise KeyError __marker = object() def pop(self, key, default=__marker): try: value = self[key]...
21,500
[ 0.04195602983236313, -0.004304181318730116, -0.01688423566520214, -0.009159049019217491, 0.028594104573130608, 0.018515514209866524, -0.015159446746110916, -0.015980280935764313, 0.001780637539923191, -0.02900971658527851, 0.017715459689497948, -0.07298146188259125, 0.025809504091739655, -...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "__slots__", "ctx": {"_type": "Store", "_fields": {}}}}], "ty...
class MutableSequence(Sequence): __slots__ = () @abstractmethod def __setitem__(self, index, value): raise IndexError @abstractmethod def __delitem__(self, index): raise IndexError @abstractmethod def insert(self, index, value): raise IndexError def append(se...