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
18,801
[ 0.03417695686221123, -0.007619517855346203, -0.06688190996646881, -0.014465289190411568, -0.033648546785116196, 0.03447890654206276, 0.00826587900519371, -0.04736839607357979, 0.03974416106939316, 0.04672675207257271, -0.029138168320059776, -0.05080307647585869, -0.0120779974386096, 0.0275...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "option_string", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonly...
def _sanitize_option_string(option_string): if option_string.startswith('--'): return option_string[2:].replace('-', '_') if len(option_string) == 2 and option_string[0] == '-': return option_string[1] raise ValueError('invalid option_string format: ' + option_string)
18,802
[ 0.012251959182322025, 0.012262792326509953, -0.04203147813677788, 0.00101761135738343, -0.033690180629491806, 0.0006811157800257206, 0.026757152751088142, -0.03379850834608078, 0.0021868827752768993, 0.013313579373061657, -0.03992990404367447, -0.05321098491549492, -0.005936404690146446, -...
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": "option_string", "annot...
class _BaseOption(object): def __init__(self, option_string, dest=None, default=None): if dest is None: dest = _sanitize_option_string(option_string) if default is None: default = EXPECTED_DEFAULTS.get(dest, None) self.option_string = option_string self.des...
18,803
[ 0.025362923741340637, 0.010381284169852734, -0.021981939673423767, -0.00003319063034723513, -0.03948545828461647, -0.01209394633769989, 0.0289323553442955, -0.02394401840865612, -0.00984365213662386, 0.05032677948474884, -0.025274241343140602, -0.013257891871035099, -0.012892080470919609, ...
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": "option_string", "annotation": null, "type_comment": null}}, {"_ty...
def __init__(self, option_string, dest=None, default=None): if dest is None: dest = _sanitize_option_string(option_string) if default is None: default = EXPECTED_DEFAULTS.get(dest, None) self.option_string = option_string self.dest = dest self.default = ...
18,804
[ 0.016143174842000008, 0.0016096686013042927, 0.02470870316028595, -0.03809742629528046, 0.011186324991285801, 0.01835138536989689, 0.002587382448837161, -0.01742161251604557, -0.015271512791514397, 0.0094139464199543, 0.015666665509343147, -0.006194609217345715, -0.01567828841507435, -0.01...
15
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_add_host_key(self): # Copied args = json.dumps(dict(ANSIBLE_MODULE_ARGS={})) # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually with swap_stdin_and_argv(stdin_data=args): ansible.module_utils.basic._ANSIBLE_ARGS = None...
18,805
[ -0.03418213129043579, -0.015952419489622116, 0.006365027278661728, -0.043815068900585175, 0.02823840267956257, 0.029582004994153976, -0.033476170152425766, -0.01705690659582615, -0.010987927205860615, 0.03709706291556358, -0.004420790355652571, -0.030857287347316742, -0.006273935548961163, ...
16
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "ssh://one.example.org/example.git"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "ss...
class TestAnsibleModuleKnownHosts(unittest.TestCase): urls = { 'ssh://one.example.org/example.git': { 'is_ssh_url': True, 'get_fqdn': 'one.example.org', 'add_host_key_cmd': " -t rsa one.example.org", 'port': None, }, 'ssh+git://two.example.org/...
18,806
[ 0.03112976811826229, -0.0006253272294998169, -0.062302179634571075, 0.0007595876813866198, 0.02616179920732975, -0.03275022283196449, -0.024093586951494217, -0.028208687901496887, 0.05044728145003319, -0.01527704019099474, 0.016694936901330948, -0.04179064929485321, -0.013123543001711369, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "system", "annotation": null, "type_comment": null}}], "kwarg": n...
def _render(value, system): request = system.get('request') if request is not None: response = request.response ct = response.content_type if ct == response.default_content_type: response.content_type = 'application/json' return cjson.encode(va...
18,807
[ 0.019106067717075348, -0.0040853628888726234, 0.07897622138261795, -0.04533074051141739, -0.0055404240265488625, -0.006083273328840733, -0.011797185055911541, -0.002509979996830225, 0.01790844090282917, 0.05274035781621933, -0.004395962692797184, -0.02769092656672001, 0.014438680373132229, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kw", "annotation": null, "type_comment": null}}, "varar...
def boost_get_includes(self, *k, **kw): includes = k and k[0] or kw.get('includes', None) if includes and self.__boost_get_version_file(includes): return includes for d in self.environ.get('INCLUDE', '').split(';') + BOOST_INCLUDES: if self.__boost_get_version_file(d): return d if includes: self.end_msg('h...
18,808
[ -0.026435159146785736, -0.00876182783395052, 0.031178751960396767, -0.0630943700671196, -0.017811495810747147, -0.015819646418094635, -0.07502242922782898, -0.05917975679039955, 0.009481426328420639, 0.05678493529558182, 0.017569709569215775, -0.03525455668568611, 0.01902041956782341, -0.0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "lib_names", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "is_static", "annotation": null, "type_comment": null}}], "kw...
def match_libs(lib_names, is_static): libs = [] lib_names = Utils.to_list(lib_names) if not lib_names: return libs t = [] if kw.get('mt', False): t.append('-mt') if kw.get('abi', None): t.append('%s%s' % (is_static and '-s' or '-', kw['abi'])) elif is_static: t.append('-s') tags_pat = t and ...
18,809
[ -0.016404850408434868, 0.022913504391908646, -0.01181834377348423, -0.030652839690446854, -0.0076314909383654594, 0.014920421876013279, 0.006730683147907257, -0.016950411722064018, 0.008931953459978104, 0.0155421057716012, 0.06907038390636444, -0.015643605962395668, 0.023598626255989075, 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": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value...
def try_link(): if has_lib('system'): self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False) if has_lib('thread'): self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False) if has_lib('log'): if not has_lib('thread'): self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS'] if ...
18,810
[ -0.031310539692640305, 0.0046087647788226604, -0.0039011819753795862, -0.010329445824027061, -0.019332174211740494, 0.02964266575872898, -0.025548793375492096, 0.00838991068303585, 0.03307949751615524, 0.0015178283210843801, 0.02403254434466362, -0.07429619878530502, 0.008307780139148235, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "some_org"}}, "targets": [{"_type": "Name", "_fields": {"id": "ORG_ID", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}...
class SystemUnsubscribeTest(CLIActionTestCase): ORG_ID = 'some_org' SYS_NAME = 'system' SYS_ID = 12345 ENT_ID = 23456 SERIAL_ID = 34567 def setUp(self): self.set_action(Unsubscribe()) self.set_module(katello.client.core.system) self.mock_printer() self.mock(self...
18,811
[ 0.023611806333065033, -0.004014774691313505, 0.027316909283399582, -0.001694974722340703, -0.001211968599818647, -0.0258480217307806, 0.03672216832637787, 0.017210090532898903, -0.042904648929834366, 0.038607604801654816, 0.01688123680651188, 0.009065442718565464, -0.0015785051509737968, -...
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 install_boost(self): if install_boost.done or not Utils.is_win32 or not self.bld.cmd.startswith('install'): return install_boost.done = True inst_to = getattr(self, 'install_path', '${BINDIR}') for lib in self.env.LIB_BOOST: try: file = self.bld.find_file(self.env.cxxshlib_PATTERN % lib, self.env.LIBPATH...
18,812
[ -0.015664638951420784, -0.0011517648817971349, -0.016938187181949615, 0.010525873862206936, -0.03891962394118309, 0.016874510794878006, -0.03935263305902481, 0.030616093426942825, 0.03976016864180565, -0.01301566045731306, 0.029418958351016045, -0.060977477580308914, -0.014429298229515553, ...
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): self.set_action(Unsubscribe()) self.set_module(katello.client.core.system) self.mock_printer() self.mock(self.action.api, 'systems_by_org', [{'uuid':self.SYS_ID}]) self.mock(self.action.api, 'unsubscribe', 0) self.mock(self.action.api, 'unsubscribe_by_ser...
18,813
[ 0.012970435433089733, -0.023870360106229782, 0.029796302318572998, -0.047740720212459564, 0.03703118860721588, -0.010560790076851845, -0.013993790373206139, -0.0008835365297272801, 0.04331411421298981, 0.01868218556046486, 0.009293495677411556, -0.005449962802231312, -0.04562261328101158, ...
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 HeadersTest(unittest.TestCase): def test_basics(self): h = Headers({'Content-Type': 'text/html', 'Content-Length': 1234}) assert h['Content-Type'] assert h['Content-Length'] self.assertRaises(KeyError, h.__getitem__, 'Accept') self.assertEqual(h.get('Accept'), None) ...
18,814
[ 0.009288297966122627, -0.03717862069606781, 0.05777689814567566, -0.02067456766963005, 0.04251891374588013, -0.04691829904913902, -0.013617750257253647, 0.012276318855583668, 0.05925183743238449, 0.035601962357759476, 0.014800244010984898, 0.0074573396705091, -0.03588169068098068, -0.00040...
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_multivalue(self): h = Headers() h['X-Forwarded-For'] = hlist = ['ip1', 'ip2'] self.assertEqual(h['X-Forwarded-For'], 'ip2') self.assertEqual(h.get('X-Forwarded-For'), 'ip2') self.assertEqual(h.getlist('X-Forwarded-For'), hlist) assert h.getlist('X-Forwarded-For'...
18,815
[ 0.022270923480391502, -0.026784630492329597, 0.05634692311286926, -0.005908738821744919, 0.035663239657878876, -0.021055694669485092, -0.03831690177321434, 0.019282452762126923, 0.03960653021931648, 0.014967151917517185, 0.021030893549323082, -0.01970406249165535, -0.026139814406633377, 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_basics(self): h = Headers({'Content-Type': 'text/html', 'Content-Length': 1234}) assert h['Content-Type'] assert h['Content-Length'] self.assertRaises(KeyError, h.__getitem__, 'Accept') self.assertEqual(h.get('Accept'), None) self.assertEqual(h.getlist('Accept')...
18,816
[ -0.004684452898800373, -0.04474155232310295, 0.023443598300218582, -0.027430107817053795, 0.03867035731673241, -0.0214320570230484, -0.015373051166534424, -0.009179942309856415, 0.06154096871614456, 0.005290962755680084, 0.004650927148759365, -0.0065771304070949554, -0.017567459493875504, ...
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_setdefault(self): h = Headers() hlist = ['ip1', 'ip2'] olist = h.setdefault('X-Forwarded-For', hlist) assert h.getlist('X-Forwarded-For') is not hlist assert h.getlist('X-Forwarded-For') is olist h = Headers() olist = h.setdefault('X-Forwarded-For', 'ip1...
18,817
[ 0.025015443563461304, -0.05902604013681412, 0.004556428641080856, -0.018808046355843544, 0.034766387194395065, -0.028199678286910057, -0.02475525438785553, -0.009651822969317436, 0.028645718470215797, 0.029760820791125298, 0.0146202202886343, -0.05486299470067024, -0.00439845584332943, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_iterables(self): idict = {'Content-Type': 'text/html', 'X-Forwarded-For': ['ip1', 'ip2']} h = Headers(idict) self.assertEqual(dict(h), {'Content-Type': ['text/html'], 'X-Forwarded-For': ['ip1', 'ip2']}) self.assertEqual(h.keys(), ['X-Forwarded-For', 'Content-Type']) sel...
18,818
[ -0.04179754853248596, -0.012681896798312664, -0.003803535597398877, -0.04140479117631912, 0.009994616732001305, -0.003943067509680986, -0.024909023195505142, -0.009214271791279316, 0.020609375089406967, 0.03326026350259781, -0.004364246968179941, -0.04241769015789032, 0.02116750180721283, ...
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": "nums", "annotation": {...
class Solution: # time:O(n) def subarraySumMap(self, nums: List[int], k: int) -> int: # ok let's do this # first we know that from brute force # we can calculate every possible sum[i, j] # to find out where sum[i, j] == k # but that's too slow # so we leverage a m...
18,819
[ 0.03873174637556076, -0.04833412542939186, 0.04635779559612274, -0.04403775930404663, -0.001705120550468564, -0.011997603811323643, -0.016132857650518417, -0.018119927495718002, 0.04259847477078438, 0.016820276156067848, -0.014854688197374344, 0.015660256147384644, -0.03565984219312668, 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_appendlist(self): h1 = Headers({'header1': 'value1'}) h1.appendlist('header1', 'value3') self.assertEqual(h1.getlist('header1'), ['value1', 'value3']) h1 = Headers() h1.appendlist('header1', 'value1') h1.appendlist('header1', 'value3') self.assertEqual(h...
18,820
[ 0.017077330499887466, -0.024365350604057312, -0.0023981269914656878, -0.0028409312944859266, -0.017051937058568, 0.0331135131418705, 0.005227948538959026, -0.014512556605041027, 0.016505969688296318, -0.0309042539447546, 0.007186445407569408, -0.004447089042514563, 0.009275085292756557, 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 MemoryBackendTest(tab_test_case.TabTestCase): def setUp(self): super(MemoryBackendTest, self).setUp() if not self._browser.supports_overriding_memory_pressure_notifications: self.skipTest('Browser does not support overriding memory pressure ' 'notification signals, skipping te...
18,821
[ -0.02519206888973713, -0.01693611964583397, -0.0054903700947761536, -0.04383594170212746, 0.021711299195885658, 0.0012243879027664661, -0.019818631932139397, 0.01057827565819025, 0.014412561431527138, 0.03178377449512482, 0.00455219391733408, -0.02773738093674183, 0.02349519357085228, 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": "nums", "annotation": {"_type": "Subscript", "_fields": {"ctx": {"...
def subarraySumMap(self, nums: List[int], k: int) -> int: # ok let's do this # first we know that from brute force # we can calculate every possible sum[i, j] # to find out where sum[i, j] == k # but that's too slow # so we leverage a map to memorize every sum[0, cur] ...
18,822
[ 0.010165001265704632, -0.018021274358034134, -0.020198075100779533, 0.0015328306471928954, -0.008271844126284122, 0.051979370415210724, 0.016992241144180298, -0.013865562155842781, 0.046966131776571274, 0.010765270330011845, 0.035198211669921875, -0.021029217168688774, 0.011029125191271305, ...
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 testSetMemoryPressureNotificationsSuppressed(self): def PerformCheck(suppressed): # Check that the method sends the correct DevTools request. with mock.patch.object(inspector_websocket.InspectorWebsocket, 'SyncRequest') as mock_method: self._browser.SetMemoryPres...
18,823
[ 0.0061624133959412575, 0.007083616219460964, -0.023864801973104477, -0.008500339463353157, -0.009358354844152927, 0.010123252868652344, -0.0030479503329843283, -0.0026156168896704912, 0.03772607445716858, 0.009903759695589542, 0.051906611770391464, 0.00793498009443283, -0.005151418503373861,...
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 testSimulateMemoryPressureNotification(self): def PerformCheck(pressure_level): # Check that the method sends the correct DevTools request. with mock.patch.object(inspector_websocket.InspectorWebsocket, 'SyncRequest') as mock_method: self._browser.SimulateMemoryP...
18,824
[ 0.01306327898055315, 0.0007674522348679602, -0.033213820308446884, -0.00325038586743176, 0.012655823491513729, 0.035979580134153366, 0.004367802757769823, -0.014520242810249329, 0.03232482448220253, 0.017952749505639076, 0.046203017234802246, -0.02773168683052063, 0.00499442033469677, 0.01...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "suppressed", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg...
def PerformCheck(suppressed): # Check that the method sends the correct DevTools request. with mock.patch.object(inspector_websocket.InspectorWebsocket, 'SyncRequest') as mock_method: self._browser.SetMemoryPressureNotificationsSuppressed(suppressed) self.assertE...
18,825
[ 0.0035658085253089666, 0.010514250956475735, -0.04205700382590294, -0.0024148584343492985, 0.01891588233411312, 0.004591589327901602, 0.002649933099746704, -0.01657124049961567, 0.03326459974050522, 0.018647225573658943, 0.06198645383119583, -0.006997288670390844, -0.0043107206001877785, 0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pressure_level", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonl...
def PerformCheck(pressure_level): # Check that the method sends the correct DevTools request. with mock.patch.object(inspector_websocket.InspectorWebsocket, 'SyncRequest') as mock_method: self._browser.SimulateMemoryPressureNotification(pressure_level) self.asser...
18,826
[ -0.0019743393640965223, -0.03063139133155346, 0.025206811726093292, -0.01800856553018093, -0.016946952790021896, 0.02713583968579769, 0.004605713300406933, -0.017335347831249237, 0.04249037429690361, -0.0297769233584404, 0.015574625693261623, -0.027705485001206398, -0.010001162067055702, 0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class MemoryBackendUnitTest(unittest.TestCase): def setUp(self): self._mock_timer = simple_mock.MockTimer() self._inspector_socket = fakes.FakeInspectorWebsocket(self._mock_timer) def tearDown(self): self._mock_timer.Restore() def testSetMemoryPressureNotificationsSuppressedSuccess(self): respo...
18,827
[ 0.010687639936804771, -0.027669839560985565, -0.002163755241781473, -0.007940325886011124, -0.01593310758471489, 0.03574785962700844, 0.028273068368434906, 0.006015895400196314, 0.05901150777935982, -0.0195393655449152, 0.001570361782796681, -0.025283152237534523, -0.004048845265060663, 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 testSetMemoryPressureNotificationsSuppressedSuccess(self): response_handler = mock.Mock(return_value={'result': {}}) self._inspector_socket.AddResponseHandler( 'Memory.setPressureNotificationsSuppressed', response_handler) backend = memory_backend.MemoryBackend(self._inspector_socket) backe...
18,828
[ 0.0008155485265888274, -0.02086028829216957, 0.005855463910847902, -0.008566033095121384, -0.015407447703182697, 0.024968940764665604, 0.009802433662116528, 0.004758555442094803, 0.045803867280483246, -0.01596541330218315, 0.02292729541659355, -0.025121113285422325, 0.011355859227478504, 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 testSetMemoryPressureNotificationsSuppressedFailure(self): response_handler = mock.Mock() backend = memory_backend.MemoryBackend(self._inspector_socket) self._inspector_socket.AddResponseHandler( 'Memory.setPressureNotificationsSuppressed', response_handler) # If the DevTools method is miss...
18,829
[ 0.014675159938633442, -0.002272915095090866, -0.015497585758566856, -0.00695206830278039, -0.017489397898316383, -0.010800763964653015, 0.010498779825866222, 0.005792319308966398, 0.0476749949157238, -0.015176326036453247, 0.01500927098095417, -0.011648890562355518, -0.007678115740418434, ...
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 testSimulateMemoryPressureNotificationSuccess(self): response_handler = mock.Mock(return_value={'result': {}}) self._inspector_socket.AddResponseHandler( 'Memory.simulatePressureNotification', response_handler) backend = memory_backend.MemoryBackend(self._inspector_socket) backend.SimulateM...
18,830
[ 0.03096684068441391, 0.006219211500138044, -0.0012149091344326735, -0.02015766128897667, 0.016281187534332275, 0.017034009099006653, -0.011550766415894032, 0.0004441792261786759, 0.041326574981212616, 0.053573984652757645, -0.050427861511707306, -0.01521375309675932, 0.004205130971968174, ...
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": "mass", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, mass=1.0, radius=1.0, flux=1.0, q1=None, q2=None, mu1=None, mu2=None): self.mass = mass self.radius = radius self.flux = flux # Allow different limb darkening parameters. if mu1 is not None and mu2 is not None: if q1 is not None or...
18,831
[ 0.0032432442530989647, 0.008721007034182549, -0.0014867529971525073, -0.006671634502708912, -0.022600561380386353, -0.01716110296547413, -0.010017028078436852, 0.0043349661864340305, 0.030542679131031036, -0.020072363317012787, 0.030466066673398018, -0.02152799256145954, 0.018131522461771965...
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 testSimulateMemoryPressureNotificationFailure(self): response_handler = mock.Mock() backend = memory_backend.MemoryBackend(self._inspector_socket) self._inspector_socket.AddResponseHandler( 'Memory.simulatePressureNotification', response_handler) # If the DevTools method is missing, the bac...
18,832
[ 0.026249997317790985, 0.010423894040286541, 0.04748454689979553, -0.0027712834998965263, -0.01567015051841736, 0.07156367599964142, 0.0025389136280864477, -0.007248692214488983, 0.06492632627487183, 0.05424666777253151, -0.031265441328287125, -0.008608601987361908, -0.044615015387535095, -...
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 period(self): # If we already have a period, return that. if self._period is not None: return self._period # If not, check to make sure that we're already part of a system # and then compute the period based on the star's mass. self._check_ps() mstar = se...
18,833
[ 0.021360352635383606, 0.008869676850736141, 0.04109302535653114, -0.013457847759127617, -0.019484981894493103, 0.02277572639286518, -0.028165943920612335, 0.004800477065145969, 0.035596657544374466, 0.08209169656038284, -0.036611009389162064, -0.017821917310357094, -0.00857480801641941, -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": "radius", "annotation": null, "type_comment": null}}, {"_type": "a...
def __init__(self, radius=0.0, mass=0.0, a=None, period=None, t0=0.0, e=0.0, omega=0.0, ix=None, incl=None, b=None, # Deprecated: ...
18,834
[ 0.027436627075076103, -0.015873154625296593, 0.048559073358774185, 0.028539104387164116, -0.0011525889858603477, -0.00015953804540913552, -0.004798277746886015, 0.011826564557850361, 0.023440150544047356, 0.03838622197508812, -0.03881217911839485, -0.020283060148358345, -0.017088383436203003...
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 b(self): # If we already have an impact parameter, return that. if self._b is not None: return self._b # If not, check to make sure that we're already part of a system # and then compute the impact parameter based on the star's radius. self._check_ps() rs...
18,835
[ 0.020044678822159767, -0.018511774018406868, 0.051313336938619614, 0.028761450201272964, -0.00934682134538889, -0.02844967320561409, -0.030917908996343613, 0.004511026665568352, 0.036192141473293304, 0.04073889181017876, -0.03245081380009651, -0.0033256239257752895, -0.023513199761509895, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "b", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def b(self, b): if b < 0.0: raise ValueError("Invalid impact parameter (must be non-negative)") self._check_ps() rstar = self.system.central.radius # Compute contribution due to eccentricity. factor = 1.0 e = self.e if e > 0.0: factor = (...
18,836
[ 0.061840686947107315, -0.0049444157630205154, 0.05540584772825241, -0.04622673988342285, -0.019079767167568207, 0.010551242157816887, -0.04563530534505844, -0.023929553106427193, 0.02715880237519741, -0.006340207997709513, -0.02526620216667652, 0.01547200046479702, -0.023207999765872955, -...
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 _parameter_names(self): names = ["central:ln_flux", "central:ln_radius", "central:ln_mass"] for i, body in enumerate(self.bodies): names += map("bodies[{0}]:{{0}}".format(i).format, ("ln_radius", "ln_mass", "t0", "sqrt_e_cos_omega", "sqr...
18,837
[ 0.04694892466068268, 0.046679411083459854, 0.0442807599902153, -0.007546325214207172, 0.029565423727035522, -0.034362729638814926, 0.009230772964656353, 0.01866368018090725, -0.009446382522583008, 0.00021792540792375803, -0.0026243694592267275, -0.03883662447333336, 0.0005714488215744495, ...
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 ix(self): if self._ix is None: if self._b is not None: self.b = self._b elif self._incl is not None: self.incl = self._incl else: raise RuntimeError("Something went wrong.") return self._ix
18,838
[ 0.02223351038992405, 0.03075428679585457, -0.009564136154949665, -0.00010441365884616971, -0.02499096281826496, 0.03693992272019386, -0.021773936226963997, 0.00111633341293782, 0.033909209072589874, 0.06593043357133865, 0.005244748666882515, -0.0033847105223685503, -0.005722955334931612, 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": "vector", "annotation": null, "type_comment": null}}], "kwarg": nu...
def check_vector(self, vector): params = self._get_params() params[self.unfrozen] = vector for i, body in enumerate(self.bodies): n = 3 + 7 * i ecosp, esinp = params[n+3:n+5] e = ecosp**2 + esinp**2 if not 0 <= e < 1.0: return False...
18,839
[ 0.022335784509778023, 0.029191575944423676, 0.005465411581099033, -0.03344601020216942, -0.03144694119691849, -0.030754953622817993, -0.02450144663453102, -0.004859923385083675, 0.02988356351852417, 0.022002605721354485, -0.01349373534321785, 0.018606746569275856, -0.042083028703927994, -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 _get_params(self): params = np.empty(5+7*len(self.bodies)) params[0] = np.log(self.central.flux) params[1] = np.log(self.central.radius) params[2] = np.log(self.central.mass) params[-2] = self.central.q1 params[-1] = self.central.q2 for i, body in enumerate(s...
18,840
[ 0.0011448540026322007, 0.013156143017113209, -0.06473693996667862, -0.02010698989033699, -0.006446165964007378, 0.0032603605650365353, -0.030189160257577896, -0.00020520629186648875, 0.009026926010847092, 0.004175096750259399, 0.01354612410068512, -0.02677108719944954, 0.0012509519001469016,...
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": "parameter_name", "annotation": null, "type_comment": null}}], "kw...
def freeze_parameter(self, parameter_name): any_ = False for i, k in enumerate(self._parameter_names()): if not fnmatch.fnmatch(k, parameter_name): continue any_ = True self.unfrozen[i] = False if not any_: raise ValueError("unknown...
18,841
[ 0.013380208984017372, 0.007208667695522308, 0.020742526277899742, -0.035800062119960785, -0.03216371685266495, -0.0003321044787298888, -0.03149791061878204, 0.0038572135381400585, 0.05326475575566292, 0.02637629769742489, -0.0010019151959568262, 0.018117699772119522, -0.04343126341700554, ...
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": "params", "annotation": null, "type_comment": null}}], "kwarg": nu...
def _set_params(self, params): self.central.flux = np.exp(params[0]) self.central.radius = np.exp(params[1]) self.central.mass = np.exp(params[2]) self.central.q1 = params[-2] self.central.q2 = params[-1] for i, body in enumerate(self.bodies): n = 3 + 7 * i ...
18,842
[ -0.006664483342319727, 0.017934462055563927, -0.024085495620965958, -0.03777750954031944, -0.031180446967482567, -0.04651135206222534, -0.04904229938983917, 0.0011546153109520674, 0.010538700968027115, 0.055846817791461945, -0.04281865805387497, 0.00612510135397315, 0.019656335934996605, 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": "parameter_name", "annotation": null, "type_comment": null}}], "kw...
def get_parameter(self, parameter_name): vector = self._get_params() params = [] for i, k in enumerate(self._parameter_names()): if not fnmatch.fnmatch(k, parameter_name): continue params.append(vector[i]) if len(params) == 0: raise Val...
18,843
[ -0.005757661536335945, 0.007282013539224863, -0.05830421298742294, -0.019218262284994125, -0.0009538475424051285, 0.003923628479242325, -0.05123266205191612, -0.009025848470628262, 0.02117857336997986, 0.007131683174520731, 0.01256763655692339, -0.040240492671728134, 0.0037763044238090515, ...
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": "parameter_name", "annotation": null, "type_comment": null}}], "kw...
def thaw_parameter(self, parameter_name): any_ = False for i, k in enumerate(self._parameter_names()): if not fnmatch.fnmatch(k, parameter_name): continue any_ = True self.unfrozen[i] = True if not any_: raise ValueError("unknown pa...
18,844
[ 0.0084998132660985, -0.027558762580156326, 0.00025942077627405524, -0.01713963784277439, 0.04748694598674774, 0.02522525191307068, 0.031339049339294434, 0.0054429140873253345, 0.003934882581233978, 0.03780287504196167, 0.02215668559074402, -0.00044373166747391224, -0.011311694048345089, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "p", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def chebyPolyCoeffs(p, func): coeffs = [0]*(p+1) fnCoeff = [] T = [coeffs[:] for i in range(p+1)] T[0][0] = 1 T[1][1] = 1 # now generate the Chebyshev polynomial coefficient using # formula T(k+1) = 2xT(k) - T(k-1) which yields # T = [ [ 1, 0, 0, 0, 0, 0], # T0(x) = +1 # ...
18,845
[ 0.003397709922865033, 0.011907961219549179, -0.046651940792798996, -0.0351274199783802, -0.010155851021409035, -0.00955406203866005, -0.0095593873411417, 0.00926648173481226, 0.016381435096263885, 0.038876619189977646, -0.01582757756114006, -0.025711823254823685, -0.0004596627550199628, 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": "parameter_name", "annotation": null, "type_comment": null}}, {"_t...
def set_parameter(self, parameter_name, value): vector = self._get_params() any_ = False for i, k in enumerate(self._parameter_names()): if not fnmatch.fnmatch(k, parameter_name): continue any_ = True vector[i] = value if not any_: ...
18,846
[ 0.01854758895933628, 0.007838485762476921, 0.05306052044034004, -0.01609642244875431, -0.007438696920871735, -0.017171265557408333, 0.015257521532475948, -0.01610952988266945, -0.01439240388572216, 0.020435117185115814, 0.01357971876859665, -0.050386521965265274, -0.024249497801065445, 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": "orm", "annotation": nu...
class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'UserProfile.country' db.add_column('auth_userprofile', 'country', self.gf('django_countries.fields.CountryField')(max_length=2, null=True, blank=True), keep_default=False) ...
18,847
[ 0.012068115174770355, -0.03501994162797928, 0.011129128746688366, -0.015834733843803406, 0.01646428182721138, -0.007186450529843569, 0.0019940133206546307, -0.008482892997562885, -0.0498516671359539, 0.02110586315393448, 0.003910666797310114, -0.00839752983301878, 0.012708333320915699, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "n", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "k", "annotation": null, "type_comment": null}}], "kwarg": null, "var...
def binom(n, k): coeff = 1 for i in xrange(n - k + 1, n + 1): coeff *= i for i in xrange(1, k + 1): coeff /= i return coeff
18,848
[ 0.025201626121997833, 0.012989385053515434, 0.056891776621341705, -0.0665135458111763, -0.05146411433815956, -0.0075000436045229435, 0.021908022463321686, -0.010620949789881706, -0.008443716913461685, 0.03234393894672394, 0.034761715680360794, -0.0018858045805245638, -0.046283163130283356, ...
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": "node", "annotation": null, "type_comment": null}}, {"_type": "arg...
def _do_split(self, node, version): debug("Run sstablesplit") time.sleep(5.0) node.stop() # default split size is 50MB splitmaxsize = 10 expected_sstable_size = (10 * 1024 * 1024) keyspace = 'keyspace1' # get the initial sstables and their total size ...
18,849
[ 0.042083121836185455, 0.016330288723111153, 0.06421761214733124, 0.030602049082517624, -0.0014974736841395497, -0.033063795417547226, 0.026230327785015106, 0.0070350756868720055, 0.03802973031997681, 0.029158957302570343, -0.024299129843711853, -0.02701554074883461, 0.027970528230071068, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,...
def forwards(self, orm): # Adding field 'UserProfile.country' db.add_column('auth_userprofile', 'country', self.gf('django_countries.fields.CountryField')(max_length=2, null=True, blank=True), keep_default=False) # Adding field 'UserProfile.city' ...
18,850
[ 0.009781253524124622, 0.05769910290837288, -0.02660501003265381, -0.04657936096191406, -0.010357833467423916, 0.021106915548443794, 0.014435071498155594, -0.02996152453124523, 0.02349560149013996, 0.02071566693484783, 0.014383590780198574, -0.0789913460612297, 0.02114810049533844, 0.025554...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def get_argument_spec(filename): with add_mocks(filename) as module_mock: try: mod = imp.load_source('module', filename) if not module_mock.call_args: mod.main() except AnsibleModuleCallError: pass except Exception as e: reraise...
18,851
[ 0.006142099853605032, 0.029653917998075485, 0.00021788344020023942, -0.05498862639069557, -0.041357580572366714, -0.0029592961072921753, 0.0061072674579918385, -0.04309919476509094, -0.004464342724531889, 0.006101462058722973, 0.02614746429026127, -0.08680214732885361, -0.018913952633738518,...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def add_mocks(filename): # Used to clean up imports later pre_sys_modules = list(sys.modules.keys()) module_mock = mock.MagicMock() for module_class in MODULE_CLASSES: p = mock.patch('%s.__init__' % module_class, new=module_mock).start() p.side_effect = AnsibleModuleCallError('AnsibleMo...
18,852
[ 0.027997901663184166, 0.04129985719919205, 0.022610962390899658, -0.030455101281404495, -0.021736767143011093, 0.014069830998778343, -0.012285999022424221, -0.04661591351032257, 0.048907727003097534, 0.03995312377810478, 0.018322676420211792, -0.06124097853899002, 0.03666898235678673, -0.0...
11
{"_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": "xml_object", "annotation": null, "type_comment": null}}, {"_type":...
def definition_from_xml(cls, xml_object, system): children = [] for child in xml_object: try: child_block = system.process_xml(etree.tostring(child, encoding='unicode')) # pylint: disable=no-member children.append(child_block.scope_ids.usage_id) e...
18,853
[ 0.02051403932273388, 0.0003109260287601501, 0.033391937613487244, -0.046593401581048965, 0.006012921687215567, -0.04305575415492058, -0.017289170995354652, -0.010877186432480812, 0.01733231358230114, 0.045428566634655, 0.009528997354209423, -0.003960978239774704, 0.0077709597535431385, 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 testReadFiles(self): file_system = self._CreateCachingFileSystem( _CreateLocalFs(), start_empty=False) expected = { './test1.txt': 'test1\n', './test2.txt': 'test2\n', './test3.txt': 'test3\n', } self.assertEqual( expected, file_system.Read(['./test1.txt', '...
18,854
[ -0.002031447133049369, -0.00365539756603539, -0.004099116660654545, -0.0513385646045208, 0.007033093832433224, -0.01462159026414156, -0.01799023151397705, -0.016746610403060913, 0.011017506942152977, 0.055347125977277756, 0.02337522618472576, -0.01706053502857685, 0.03093353845179081, -0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def testListDir(self): file_system = self._CreateCachingFileSystem( _CreateLocalFs(), start_empty=False) expected = ['dir/'] + ['file%d.html' % i for i in range(7)] file_system._read_object_store.Set( 'list/', (expected, file_system.Stat('list/').version)) self.assertEqual(expect...
18,855
[ 0.015207190066576004, -0.02136310189962387, 0.006028750911355019, -0.05276868864893913, 0.00031688439776189625, 0.025601813569664955, 0.02772768959403038, -0.019771955907344818, 0.05451634153723717, -0.0043137031607329845, 0.06239382177591324, -0.016746167093515396, 0.02249777317047119, 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 testCaching(self): test_fs = TestFileSystem({ 'bob': { 'bob0': 'bob/bob0 contents', 'bob1': 'bob/bob1 contents', 'bob2': 'bob/bob2 contents', 'bob3': 'bob/bob3 contents', } }) mock_fs = MockFileSystem(test_fs) def create_empty_caching_fs(): return se...
18,856
[ 0.017400778830051422, -0.03392462804913521, -0.00200910703279078, -0.03973741456866264, -0.020833328366279602, 0.025756658986210823, 0.00942698772996664, -0.04013829678297043, 0.036831021308898926, -0.013943172059953213, 0.05968128889799118, -0.009834133088588715, 0.032822202891111374, -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 testCachedStat(self): test_fs = TestFileSystem({ 'bob': { 'bob0': 'bob/bob0 contents', 'bob1': 'bob/bob1 contents' } }) mock_fs = MockFileSystem(test_fs) file_system = self._CreateCachingFileSystem(mock_fs, start_empty=False) self.assertEqual(StatInfo('0'), file_sys...
18,857
[ 0.013089892454445362, -0.017515169456601143, 0.007294888142496347, -0.03071662411093712, -0.0015928515931591392, 0.005069854203611612, 0.008342327550053596, -0.03441055119037628, 0.04157528281211853, 0.018729951232671738, 0.06718486547470093, -0.0021367142908275127, 0.017825061455368996, -...
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 testFreshStat(self): test_fs = TestFileSystem({ 'bob': { 'bob0': 'bob/bob0 contents', 'bob1': 'bob/bob1 contents' } }) mock_fs = MockFileSystem(test_fs) def run_expecting_stat(stat): def run(): file_system = self._CreateCachingFileSystem(mock_fs, start_empt...
18,858
[ 0.02688770554959774, 0.02350456826388836, 0.01829681731760502, -0.050100844353437424, -0.036036115139722824, 0.012385830283164978, 0.019893353804945946, -0.02747056819498539, 0.026026083156466484, 0.020564913749694824, 0.05326857417821884, -0.008324798196554184, 0.02929518185555935, -0.016...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "stat", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def run_expecting_stat(stat): def run(): file_system = self._CreateCachingFileSystem(mock_fs, start_empty=True) self.assertEqual( StatInfo(stat, child_versions={'bob0': stat, 'bob1': stat}), file_system.Stat('bob/')) self.assertTrue(*mock_fs.CheckAndReset(stat_count...
18,859
[ 0.03528258204460144, 0.01045621931552887, 0.01808677799999714, -0.043377719819545746, -0.025150930508971214, 0.0027349728625267744, 0.036326292902231216, -0.017870398238301277, 0.016890326514840126, 0.0066377585753798485, 0.03958471491932869, -0.024705443531274796, 0.026576489210128784, -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 run(): file_system = self._CreateCachingFileSystem(mock_fs, start_empty=True) self.assertEqual( StatInfo(stat, child_versions={'bob0': stat, 'bob1': stat}), file_system.Stat('bob/')) self.assertTrue(*mock_fs.CheckAndReset(stat_count=1)) self.assertEqual(StatIn...
18,860
[ 0.055234529078006744, 0.018454527482390404, 0.026467522606253624, -0.03493806719779968, 0.05307582765817642, -0.008998488076031208, -0.02515353262424469, 0.012752747163176537, 0.0056783161126077175, -0.02832118794322014, 0.037941474467515945, -0.04460528492927551, 0.021047310903668404, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__contains__", "value": {"_type": "Name", "_fields": {"id": "dict", "ct...
class InvalidSession(dict): __contains__ = _invalid_method(dict.__contains__) __delitem__ = _invalid_method(dict.__delitem__) __getitem__ = _invalid_method(dict.__getitem__) __iter__ = _invalid_method(dict.__iter__) __len__ = _invalid_method(dict.__len__) __setitem__ = _invalid_method(dict.__se...
18,861
[ 0.0045372056774795055, -0.013466022908687592, -0.015225044451653957, -0.036725517362356186, 0.05025096610188484, -0.019456204026937485, -0.02047833800315857, -0.0054167164489626884, 0.03335009515285492, 0.009430970065295696, 0.04544931277632713, 0.002460252959281206, 0.02394883893430233, 0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "view", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def uses_session(view): @functools.wraps(view) def wrapped(context, request): # Mark our request as allowing access to the sessions. request._allow_session = True # Actually execute our view. return view(context, request) # Wrap our already wrapped view with another wrapper...
18,862
[ 0.02812178060412407, -0.009460431523621082, -0.0016602938994765282, -0.03340641036629677, 0.0546392984688282, 0.013011042028665543, 0.01875571720302105, 0.03144826740026474, 0.019298335537314415, -0.021987834945321083, 0.0546392984688282, -0.045863039791584015, -0.010144602507352829, 0.009...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "_csrf_token"}}, "targets": [{"_type": "Name", "_fields": {"id": "_csrf_token_key", "ctx": {"_type": "Store", "_fields": {}}}}], "type_com...
class Session(dict): _csrf_token_key = "_csrf_token" _flash_key = "_flash_messages" # A number of our methods need to be decorated so that they also call # self.changed() __delitem__ = _changed_method(dict.__delitem__) __setitem__ = _changed_method(dict.__setitem__) clear = _changed_method...
18,863
[ 0.031091831624507904, -0.0013469558907672763, 0.01891639269888401, -0.020310696214437485, 0.0500631183385849, 0.0011678650043904781, 0.03989679366350174, 0.008074874058365822, 0.02380193956196308, 0.01708294078707695, 0.062008004635572433, -0.037349723279476166, -0.0011774713639169931, -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": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, data=None, session_id=None, new=True): # Brand new sessions don't have any data, so we'll just create an empty # dictionary for them. if data is None: data = {} # Initialize our actual dictionary here. super().__init__(data) # We need to t...
18,864
[ 0.06240170821547508, -0.028029847890138626, -0.007840719074010849, 0.014443125575780869, 0.005063194781541824, 0.026409626007080078, 0.026317041367292404, 0.01642211154103279, 0.00024086341727524996, -0.020704127848148346, 0.0003052383253816515, 0.004409319721162319, -0.01981300488114357, ...
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": "msg", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def flash(self, msg, queue="", allow_duplicate=True): queue_key = self._get_flash_queue_key(queue) # If we're not allowing duplicates check if this message is already # in the queue, and if it is just return immediately. if not allow_duplicate and msg in self[queue_key]: ret...
18,865
[ 0.07277064770460129, 0.011487074196338654, 0.03728025406599045, -0.014970911666750908, 0.02032770961523056, 0.019496703520417213, 0.01541837677359581, 0.010649674572050571, 0.00861051119863987, 0.02238605171442032, 0.07241267710924149, 0.012062386609613895, -0.038635432720184326, -0.010112...
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 invalidate(self): self.clear() self.new = True self.created = int(time.time()) self._changed = False # If the current session id isn't None we'll want to record it as one # of the ones that have been invalidated. if self._sid is not None: self.inv...
18,866
[ 0.0563807412981987, -0.024427451193332672, 0.0158610250800848, 0.010421608574688435, 0.008272118866443634, -0.01925606280565262, 0.019056355580687523, 0.0462481863796711, 0.039605263620615005, -0.040761470794677734, -0.0017763507785275578, -0.012308323755860329, -0.027980152517557144, 0.01...
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": "scope", "annotation": null, "type_comment": null}}], "kwarg": nul...
def get_scoped_csrf_token(self, scope): # Here we want to do # HMAC_sha512(scope + unscoped_token, session_id). This will make it # possible to have scope specific CSRF tokens which means that a single # scope token being leaked cannot be used for other scopes. unscoped = self.ge...
18,867
[ -0.0004909076960757375, -0.018952801823616028, 0.018072353675961494, -0.058155909180641174, 0.06306788325309753, 0.038461677730083466, -0.0043095615692436695, 0.027965810149908066, -0.002781810238957405, -0.033850912004709244, 0.0646897628903389, -0.04589914530515671, -0.02050517126917839, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "session_id"}}, "targets": [{"_type": "Name", "_fields": {"id": "cookie_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment"...
class SessionFactory: cookie_name = "session_id" max_age = 12 * 60 * 60 # 12 hours def __init__(self, secret, url): self.redis = redis.StrictRedis.from_url(url) self.signer = crypto.TimestampSigner(secret, salt="session") def __call__(self, request): return self._process_requ...
18,868
[ 0.008554172702133656, 0.013457315973937511, 0.031220974400639534, -0.05031866207718849, 0.03674432262778282, 0.007208440452814102, 0.013071149587631226, 0.02820185385644436, 0.0216838326305151, 0.004929473623633385, 0.062067482620477676, -0.045708067715168, -0.014124331064522266, -0.002232...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "...
def _process_response(self, request, response): # If the request has an InvalidSession, then the view can't have # accessed the session, and we can just skip all of this anyways. if isinstance(request.session, InvalidSession): return # Check to see if the session has been ma...
18,869
[ 0.030214333906769753, 0.013170351274311543, 0.0112863564863801, -0.01859343610703945, 0.05606202781200409, 0.02516687475144863, 0.02446257695555687, 0.037797264754772186, 0.0341818742454052, -0.011368525214493275, 0.025753788650035858, -0.03272632509469986, -0.004977031145244837, -0.012442...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": n...
def _process_request(self, request): # Register a callback with the request so we can save the session once # it's finished. request.add_response_callback(self._process_response) # Load our session ID from the request. session_id = request.cookies.get(self.cookie_name) ...
18,870
[ 0.016110815107822418, 0.016068611294031143, -0.013589213602244854, -0.03663179278373718, 0.01542502362281084, -0.020763643085956573, -0.012724061496555805, -0.013378201052546501, 0.03532351553440094, -0.01719752885401249, 0.03912174329161644, -0.006425334606319666, 0.024561870843172073, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mapper", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def session_mapper_factory(mapper): class SessionMapper(mapper): def __call__(self, view): view = super().__call__(view) @functools.wraps(view) def wrapped(context, request): # Check if we're allowing access to the session for this # requ...
18,871
[ 0.014110184274613857, 0.00578572042286396, -0.02044069953262806, -0.031554512679576874, 0.023012131452560425, -0.01728088967502117, -0.023251840844750404, -0.014502436853945255, 0.00887470692396164, -0.013837787322700024, 0.028786955401301384, -0.025213101878762245, 0.0051483106799423695, ...
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": "view", "annotation": n...
class SessionMapper(mapper): def __call__(self, view): view = super().__call__(view) @functools.wraps(view) def wrapped(context, request): # Check if we're allowing access to the session for this # request. If we're not allowing it, then we'l...
18,872
[ 0.004946563858538866, -0.010360383428633213, -0.023789655417203903, -0.005315753631293774, 0.05417857691645622, -0.022543640807271004, -0.03230408951640129, 0.0056676375679671764, 0.03297324851155281, -0.002885736059397459, 0.03980325534939766, 0.020893825218081474, 0.01349849533289671, 0....
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg"...
def wrapped(context, request): # Check if we're allowing access to the session for this # request. If we're not allowing it, then we'll replace it with # an InvalidSession() which won't allow using the session. if not getattr(request, "_allow_session", Fal...
18,873
[ 0.006608856841921806, -0.03192673623561859, -0.006937881466001272, -0.026775797829031944, 0.0435447096824646, -0.03505814075469971, -0.02686656266450882, -0.009524695575237274, 0.009229708462953568, 0.008214269764721394, 0.029975278303027153, 0.007567566819489002, 0.024302439764142036, 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": "view", "annotation": null, "type_comment": null}}], "kwarg": null...
def __call__(self, view): view = super().__call__(view) @functools.wraps(view) def wrapped(context, request): # Check if we're allowing access to the session for this # request. If we're not allowing it, then we'll replace it with # an...
18,874
[ 0.036908965557813644, 0.01642325147986412, 0.027000518515706062, -0.03329238295555115, 0.014131923206150532, 0.026381241157650948, 0.029329003766179085, -0.0019244062714278698, 0.05043399706482887, -0.018132459372282028, 0.060837868601083755, -0.04686695709824562, 0.022355934605002403, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "config", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def includeme(config): config.set_session_factory( SessionFactory( config.registry.settings["sessions.secret"], config.registry.settings["sessions.url"], ), ) # We need to commit what's happened so far so that we can get the current # default ViewMapper confi...
18,875
[ 0.015643281862139702, -0.0116646783426404, -0.0011898974189534783, -0.039279140532016754, -0.002135184360668063, -0.011505533941090107, -0.010273640044033527, -0.05347244068980217, -0.014806302264332771, 0.08270781487226486, -0.009501496329903603, 0.02006395347416401, -0.005502262618392706, ...
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": "version_str", "annotation": null, "type_comment": null}}], "kwarg...
def __init__(self, version_str): self.version_str = version_str version_parts = re.match(r'^([0-9]+)\.([0-9]+)\.([0-9]+)(\.[0-9]+)?(-\S*)?( \(\S*\))?$', version_str) if version_parts: major, minor, micro, patch, status, extra = version_parts.groups() # The patch and status matches are optional...
18,876
[ -0.01028760988265276, 0.04005091264843941, 0.016118619590997696, -0.019194960594177246, 0.011989539489150047, 0.08300270885229111, 0.032728519290685654, -0.032564759254455566, -0.03467024117708206, 0.03368768095970154, 0.002623077481985092, -0.055537886917591095, -0.02849416434764862, 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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __ge__(self, other): if isinstance(other, _VersionRequirements): for rule in other.rules: if rule(self): return True return False return self._compare(other, lambda s, o: s >= o)
18,877
[ 0.018664555624127388, 0.029750367626547813, 0.021270425990223885, -0.022649366408586502, 0.03163962438702583, -0.023018531501293182, -0.018121665343642235, -0.0014468015870079398, -0.03617818281054497, 0.024755779653787613, -0.024017449468374252, -0.001928616431541741, -0.024408331140875816,...
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": "key", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def check_key(self, key, current_app): if (key[1] != "__first__" and key[1] != "__latest__") or key in self.graph: return key # Special-case __first__, which means "the first migration" for # migrated apps, and is ignored for unmigrated apps. It allows # makemigrations to dec...
18,878
[ 0.008235455490648746, 0.016790321096777916, 0.024594571441411972, 0.016843555495142937, 0.014916447922587395, -0.014554450288414955, 0.010780088603496552, -0.021975409239530563, 0.031280890107154846, 0.0965895876288414, -0.031898412853479385, -0.07959698140621185, 0.013766571879386902, -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 __init__(self): self.module_arg_spec = dict( name=dict(type='str'), resource_group=dict(type='str'), tags=dict(type='list'), return_publish_profile=dict(type=bool, default=False) ) self.results = dict( changed=False, w...
18,879
[ 0.016529474407434464, 0.05679244175553322, 0.059797801077365875, -0.0420750230550766, -0.021810948848724365, 0.017711728811264038, 0.0287276953458786, 0.011220374144613743, -0.012850118800997734, -0.00569029338657856, 0.0011194132966920733, 0.005043920129537582, -0.02213137410581112, -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": "key", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def add_external_dependencies(self, key, migration): for parent in migration.dependencies: # Skip internal dependencies if key[0] == parent[0]: continue parent = self.check_key(parent, key[0]) if parent is not None: self.graph.add_d...
18,880
[ 0.014852986671030521, 0.044921230524778366, 0.033349353820085526, -0.04541805386543274, -0.012958843261003494, -0.004145380575209856, -0.026166098192334175, 0.03187958151102066, 0.030554715543985367, 0.032790426164865494, -0.013673028908669949, -0.09787445515394211, 0.0020623398013412952, ...
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 exec_module(self, **kwargs): for key in self.module_arg_spec: setattr(self, key, kwargs[key]) if self.name: self.results['webapps'] = self.list_by_name() elif self.resource_group: self.results['webapps'] = self.list_by_resource_group() else: ...
18,881
[ -0.010322346352040768, -0.003574698930606246, 0.016210775822401047, -0.01237508561462164, -0.03786424174904823, -0.05081409588456154, -0.04215740039944649, -0.01619904488325119, 0.04544178396463394, 0.03145969659090042, -0.0037887701764702797, -0.06958199292421341, 0.01969456672668457, -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 list_by_name(self): self.log('Get web app {0}'.format(self.name)) item = None result = [] try: item = self.web_client.web_apps.get(self.resource_group, self.name) except CloudError: pass if item and self.has_tags(item.tags, self.tags): ...
18,882
[ -0.029811497777700424, -0.0037811610382050276, 0.030812162905931473, -0.006921270862221718, -0.017918169498443604, -0.025662904605269432, -0.03258417546749115, 0.0042971293441951275, 0.050241753458976746, 0.047114674001932144, -0.011330453678965569, -0.05937282741069794, 0.02464139088988304,...
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 list_all(self): self.log('List web apps in current subscription') try: response = list(self.web_client.web_apps.list()) except CloudError as exc: request_id = exc.request_id if exc.request_id else '' self.fail("Error listing web apps, request id {0} - {1}"...
18,883
[ -0.032955102622509, 0.011607338674366474, 0.05056903511285782, 0.002518812892958522, -0.004159973002970219, -0.06554494053125381, -0.03644542023539543, -0.0171776432543993, 0.06026887521147728, 0.033705927431583405, -0.01599052920937538, -0.05913249030709267, 0.021591274067759514, -0.03776...
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 list_by_resource_group(self): self.log('List web apps in resource groups {0}'.format(self.resource_group)) try: response = list(self.web_client.web_apps.list_by_resource_group(self.resource_group)) except CloudError as exc: request_id = exc.request_id if exc.request_i...
18,884
[ -0.02572336234152317, 0.00906402338296175, 0.05182439461350441, -0.025933178141713142, -0.012169291265308857, -0.05904204025864601, -0.03396910801529884, -0.018149029463529587, 0.06814803183078766, 0.00042684312211349607, -0.030507152900099754, -0.07339341193437576, 0.038312286138534546, -...
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": "resource_group", "annotation": null, "type_comment": null}}, {"_t...
def list_webapp_configuration(self, resource_group, name): self.log('Get web app {0} configuration'.format(name)) response = [] try: response = self.web_client.web_apps.get_configuration(resource_group_name=resource_group, name=name) except CloudError as ex: req...
18,885
[ -0.04535241052508354, -0.0030956005211919546, 0.04846399649977684, -0.033843811601400375, -0.023443445563316345, -0.0596742257475853, 0.006990409456193447, -0.019010502845048904, 0.0627431869506836, 0.007091642357409, -0.023038513958454132, -0.07169432193040848, 0.016879281029105186, -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": "resource_group", "annotation": null, "type_comment": null}}, {"_t...
def list_webapp_appsettings(self, resource_group, name): self.log('Get web app {0} app settings'.format(name)) response = [] try: response = self.web_client.web_apps.list_application_settings(resource_group_name=resource_group, name=name) except CloudError as ex: ...
18,886
[ -0.007883792743086815, 0.0031837336719036102, 0.0020492365583777428, -0.0028293749783188105, 0.012064674869179726, -0.04799498990178108, -0.02755756303668022, -0.037160955369472504, 0.030150698497891426, 0.018239853903651237, 0.01750366762280464, -0.0703662782907486, 0.028612397611141205, ...
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": "resource_group", "annotation": null, "type_comment": null}}, {"_t...
def get_curated_webapp(self, resource_group, name, webapp): pip = self.serialize_obj(webapp, AZURE_OBJECT_CLASS) try: site_config = self.list_webapp_configuration(resource_group, name) app_settings = self.list_webapp_appsettings(resource_group, name) publish_cred = s...
18,887
[ -0.0005846660351380706, 0.0002735875023063272, 0.03870107978582382, -0.009152980521321297, 0.03921819478273392, -0.0497673936188221, -0.013186497613787651, 0.017344122752547264, 0.014303471893072128, -0.015368733555078506, 0.019774574786424637, -0.03735657408833504, 0.005445247981697321, -...
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": "resource_group", "annotation": null, "type_comment": null}}, {"_t...
def get_publish_credentials(self, resource_group, name): self.log('Get web app {0} publish credentials'.format(name)) try: poller = self.web_client.web_apps.list_publishing_credentials(resource_group, name) if isinstance(poller, AzureOperationPoller): response = s...
18,888
[ 0.017960231751203537, -0.007805931381881237, 0.012628475204110146, -0.021974027156829834, 0.013503123074769974, 0.03587253764271736, 0.007608237210661173, 0.00833311676979065, 0.020056990906596184, 0.014569474384188652, 0.03951490670442581, -0.04392408952116966, 0.007638190872967243, -0.06...
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": "step", "annotation": n...
class Progress(object): def __init__(self, step=None, total=None, stop=None, name='items', level=logging.DEBUG): if total is None and step is None: raise Exception('Both step and total arguments are None') if total and not step: step = int(total / 20) if step == 0: ...
18,889
[ 0.03636926785111427, -0.029513563960790634, 0.014768937602639198, -0.03299003839492798, -0.023800477385520935, -0.03632064536213875, -0.00810164399445057, -0.04453776776790619, 0.02593984641134739, 0.049934811890125275, 0.03357350081205368, -0.08236569911241531, 0.024396097287535667, -0.05...
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": "webapp", "annotation": null, "type_comment": null}}, {"_type": "a...
def construct_curated_webapp(self, webapp, configuration=None, app_settings=None, deployment_slot=None, ftp_publish_url=None, ...
18,890
[ 0.030987804755568504, 0.02147831954061985, 0.018691057339310646, -0.042300812900066376, -0.03778029605746269, -0.02653755247592926, -0.0031356706749647856, 0.013620112091302872, 0.012074235826730728, 0.06099186837673187, 0.04101258143782616, -0.02567092515528202, 0.001272859750315547, -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": "step", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, step=None, total=None, stop=None, name='items', level=logging.DEBUG): if total is None and step is None: raise Exception('Both step and total arguments are None') if total and not step: step = int(total / 20) if step == 0: step = total ...
18,891
[ 0.039343997836112976, -0.00422178627923131, -0.0014679291052743793, -0.015284901484847069, -0.014788968488574028, 0.05534100905060768, -0.006234128959476948, 0.031078452244400978, 0.0048575978726148605, 0.025890232995152473, 0.06307247281074524, -0.00871061347424984, -0.03369799256324768, ...
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 tick(self): self.count += 1 if not self.count % self.step: if self.total: percents = ' [%d%%]' % int((self.count / float(self.total)) * 100) else: percents = '' logger.log(self.logging_level, 'Processed %d %s%s' % (self.count, self....
18,892
[ 0.0024640134070068598, -0.03208504989743233, -0.013589086942374706, 0.021869441494345665, 0.023836422711610794, -0.009263844229280949, -0.012996877543628216, 0.004933314397931099, 0.005263788625597954, -0.009485922753810883, 0.025803402066230774, 0.01960635557770729, 0.009353733621537685, ...
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 is_port_8000_in_use(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind(("127.0.0.1", 8000)) except socket.error as e: if e.errno == errno.EADDRINUSE: return True else: raise e finally: s.close() return False
18,893
[ -0.022069105878472328, 0.040446482598781586, 0.04764419049024582, -0.0030154918786138296, -0.035988546907901764, -0.011295760050415993, 0.03557061403989792, 0.045717064291238785, 0.015196453779935837, 0.048387181013822556, 0.016229674220085144, 0.026213593780994415, 0.01795944571495056, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value...
def init_manifest(): # See https://github.com/pypa/virtualenv/issues/1710 if sys.version_info[0] >= 3 and platform.system() == "Windows": pytest.xfail(reason="virtualenv activation fails in Windows for python3") with pytest.raises(SystemExit) as excinfo: wpt.main(argv=["manifest", "--no-down...
18,894
[ 0.043163418769836426, 0.03722238540649414, 0.06275670230388641, -0.04047176614403725, 0.014937452040612698, -0.05363903194665909, 0.008074954152107239, -0.03838634118437767, 0.011003034189343452, -0.002418848918750882, 0.05087463557720184, 0.028759445995092392, 0.01413723174482584, -0.0977...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg...
def temp_test(): os.makedirs("../../.tools-tests") test_count = {"value": 0} def make_test(body): test_count["value"] += 1 test_name = ".tools-tests/%s.html" % test_count["value"] test_path = "../../%s" % test_name with open(test_path, "w") as handle: handle.wri...
18,895
[ -0.000071279464464169, 0.03808998689055443, 0.008091776631772518, -0.01633600704371929, -0.02507277950644493, 0.017754999920725822, 0.07125454396009445, -0.005766856484115124, -0.013802928850054741, 0.01695754937827587, 0.020147349685430527, 0.005963287316262722, 0.05413281172513962, -0.10...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Try", "_fields": {"body": [{"_type": "Assign", "_fields": {"va...
def manifest_dir(): try: path = tempfile.mkdtemp() shutil.copyfile(get_persistent_manifest_path(), os.path.join(path, "MANIFEST.json")) yield path finally: shutil.rmtree(path)
18,896
[ 0.0034572870936244726, -0.010600926354527473, 0.034583527594804764, -0.037332307547330856, 0.006376537494361401, -0.04781603813171387, 0.03756670281291008, -0.0034519601613283157, -0.036586515605449677, 0.022672133520245552, 0.010734104551374912, 0.05020257830619812, -0.01127214077860117, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"val...
def test_install_chromedriver(): if sys.platform == "win32": chromedriver_path = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(), "Scripts", "chromedriver.exe") else: chromedriver_path = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(), "bin", "chromedriver") if os.path.exists(chr...
18,897
[ 0.05925698205828667, 0.021289797499775887, 0.031082650646567345, -0.032991234213113785, 0.010747143998742104, -0.030900880694389343, -0.010502890683710575, -0.016063913702964783, 0.01742718741297722, -0.0008435258641839027, 0.05430375412106514, 0.05216795578598976, -0.005035593640059233, -...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "body", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def make_test(body): test_count["value"] += 1 test_name = ".tools-tests/%s.html" % test_count["value"] test_path = "../../%s" % test_name with open(test_path, "w") as handle: handle.write(""" <!DOCTYPE html> <script src="/resources/testharness.js"></s...
18,898
[ -0.049515917897224426, -0.0015753033803775907, 0.009150166064500809, -0.01657978817820549, -0.0017987505998462439, -0.011764499358832836, 0.006809555925428867, 0.015652481466531754, 0.0013064683880656958, 0.02473561465740204, 0.026389123871922493, 0.027819186449050903, 0.004139360971748829, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"val...
def test_install_firefox(): if sys.platform == "darwin": fx_path = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(), "browsers", "nightly", "Firefox Nightly.app") else: fx_path = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(), "browsers", "nightly", "firefox") if os.path.exists(f...
18,899
[ 0.010087602771818638, 0.023073868826031685, 0.046301648020744324, -0.03393744304776192, 0.0065572625026106834, -0.011581825092434883, -0.018482182174921036, -0.033783528953790665, 0.03565611690282822, 0.0034309395123273134, 0.05125246196985245, -0.012409098446369171, 0.01837957464158535, 0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "capsys", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def test_files_changed(capsys): commit = "9047ac1d9f51b1e9faa4f9fad9c47d109609ab09" with pytest.raises(SystemExit) as excinfo: wpt.main(argv=["files-changed", "%s~..%s" % (commit, commit)]) assert excinfo.value.code == 0 out, err = capsys.readouterr() expected = """html/browsers/offline/appc...
18,900
[ -0.001252252608537674, 0.029581330716609955, 0.04325816407799721, -0.03015119954943657, -0.01324295625090599, 0.004824450705200434, 0.00067671830765903, -0.03849199414253235, 0.028830140829086304, 0.011455642059445381, 0.03970944136381149, 0.028286175802350044, 0.026071462780237198, 0.0308...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "capsys", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "manifest_dir", "annotation": null, "type_comment": null}}], "kw...
def test_tests_affected(capsys, manifest_dir): # This doesn't really work properly for random commits because we test the files in # the current working directory for references to the changed files, not the ones at # that specific commit. But we can at least test it returns something sensible. # The te...