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
12,901
[ 0.030336564406752586, 0.00547537999227643, 0.028092151507735252, -0.016512462869286537, -0.026439672335982323, 0.023430678993463516, 0.029399337247014046, 0.025502445176243782, 0.02661231905221939, 0.012029804289340973, 0.037094466388225555, -0.020150383934378624, -0.030879169702529907, 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 MumbleHooksTestCase(TestCase): def setUp(self): self.member = 'member_user' member = AuthUtils.create_member(self.member) MumbleUser.objects.create(user=member) self.none_user = 'none_user' none_user = AuthUtils.create_user(self.none_user) self.service = MumbleS...
12,902
[ 0.004153374582529068, -0.0000361047605110798, 0.040271785110235214, -0.02808208204805851, -0.014283725060522556, -0.0006426809704862535, -0.009464701637625694, -0.047066956758499146, 0.03799748420715332, 0.05913184955716133, 0.03824710100889206, -0.03261681646108627, 0.008147270418703556, ...
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 test_amd64(self): expected_functions = { 0x4004e0, 0x400510, 0x400520, 0x400530, 0x400540, 0x400550, 0x400560, 0x400570, 0x400580, 0x4005ac, 0x400640, 0x400664, 0x4006ed, 0x4006fd, 0x40071d, 0x4007e0, 0x400880 } expected_blocks = { 0x4007...
12,903
[ 0.007330390624701977, 0.015190539881587029, 0.034150995314121246, 0.002662656595930457, -0.0072503103874623775, 0.05691832676529884, 0.05460216850042343, 0.022200610488653183, 0.01472238078713417, 0.010995585471391678, 0.03112027980387211, 0.0017540577100589871, -0.03449595347046852, 0.051...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_update_groups(self): # Check member has Member group updated service = self.service() member = User.objects.get(username=self.member) member.mumble.groups = '' # Remove the group set in setUp member.mumble.save() service.update_groups(member) mumble_us...
12,904
[ 0.043201010674238205, 0.004925876390188932, 0.016225671395659447, -0.0007394347339868546, -0.04441509023308754, -0.010933042503893375, 0.013506638817489147, 0.050789009779691696, 0.006924049463123083, 0.001299444935284555, 0.040949903428554535, -0.01761680468916893, 0.007278156001120806, -...
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): self.member = 'member_user' member = AuthUtils.create_member(self.member) MumbleUser.objects.create(user=member) self.none_user = 'none_user' none_user = AuthUtils.create_user(self.none_user) self.service = MumbleService add_permissions()
12,905
[ 0.024818947538733482, 0.02714860811829567, -0.03021637722849846, -0.01081792451441288, -0.01013747975230217, 0.056373149156570435, -0.012905391864478588, 0.07911616563796997, 0.026249036192893982, -0.01627301797270775, 0.05129864439368248, -0.034598905593156815, 0.003534854855388403, 0.029...
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_delete_user(self): member = User.objects.get(username=self.member) service = self.service() result = service.delete_user(member) self.assertTrue(result) with self.assertRaises(ObjectDoesNotExist): mumble_user = User.objects.get(username=self.member).mumble
12,906
[ 0.04308091849088669, 0.06703074276447296, 0.0004772284592036158, -0.010704301297664642, -0.004489094018936157, 0.032628342509269714, 0.014096594415605068, 0.05283825471997261, 0.04825925827026367, 0.010944039560854435, 0.05892759934067726, -0.014851768501102924, -0.001144748879596591, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_validate_user(self): service = self.service() # Test member is not deleted member = User.objects.get(username=self.member) service.validate_user(member) self.assertTrue(member.mumble) # Test none user is deleted none_user = User.objects.get(username=self...
12,907
[ 0.030575254932045937, -0.011142156086862087, 0.036649301648139954, -0.0023530516773462296, -0.04974565654993057, 0.02351449802517891, 0.01419840008020401, 0.026884695515036583, 0.0312928631901741, 0.029908904805779457, 0.03472713381052017, -0.010475805029273033, -0.003546396503224969, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class MumbleViewsTestCase(TestCase): def setUp(self): self.member = AuthUtils.create_member('auth_member') self.member.email = 'auth_member@example.com' self.member.save() AuthUtils.add_main_character(self.member, 'auth_member', '12345', corp_id='111', corp_name='Test Corporation', ...
12,908
[ 0.017617637291550636, 0.008968254551291466, 0.014083480462431908, -0.023184597492218018, -0.014176485128700733, 0.0007946869591251016, -0.017697354778647423, 0.03635132312774658, 0.048149559646844864, 0.002534362254664302, 0.028804704546928406, -0.055589888244867325, 0.048548150807619095, ...
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_render_services_ctrl(self): service = self.service() member = User.objects.get(username=self.member) request = RequestFactory().get('/services/') request.user = member response = service.render_services_ctrl(request) self.assertTemplateUsed(service.service_ctrl_...
12,909
[ 0.019568894058465958, 0.032541804015636444, -0.03005918301641941, 0.024899227544665337, -0.002481099683791399, 0.010015671141445637, 0.012839044444262981, 0.058755360543727875, 0.03125181421637535, 0.024765359237790108, 0.031057100743055344, -0.007624323479831219, -0.00542769068852067, 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 test_deactivate_post(self): self.login() MumbleUser.objects.create(user=self.member) response = self.client.post(urls.reverse('mumble:deactivate')) self.assertRedirects(response, expected_url=urls.reverse('services:services'), target_status_code=200) with self.assertRaises(...
12,910
[ 0.03992918133735657, 0.024002093821763992, -0.01830500364303589, 0.007499106228351593, -0.013710174709558487, 0.014143649488687515, 0.03703109547495842, 0.05132336542010307, 0.0273955799639225, 0.024101175367832184, 0.015444071963429451, 0.009740788489580154, -0.006124373525381088, 0.03445...
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_activate(self): self.login() expected_username = '[TESTR]auth_member' response = self.client.get(urls.reverse('mumble:activate'), follow=False) self.assertEqual(response.status_code, 200) self.assertContains(response, expected_username) mumble_user = MumbleUser.o...
12,911
[ 0.05286647379398346, 0.006072584073990583, 0.015198491513729095, 0.013266164809465408, -0.029703328385949135, 0.0015289844013750553, 0.040925685316324234, 0.08457645028829575, 0.013551059179008007, 0.028984898701310158, 0.026631424203515053, 0.007797433063387871, 0.05026526376605034, 0.034...
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_reset_password(self): self.login() created = MumbleUser.objects.create(user=self.member) old_pwd = created.credentials.get('password') response = self.client.get(urls.reverse('mumble:reset_password')) self.assertNotEqual(MumbleUser.objects.get(user=self.member).pwhash,...
12,912
[ 0.03545742854475975, -0.015313920564949512, 0.010575341992080212, 0.013069011270999908, -0.020689567551016808, 0.009258733130991459, 0.05062573403120041, 0.056401826441287994, 0.023213574662804604, 0.02043474093079567, 0.034195426851511, 0.01818983070552349, 0.03237523138523102, 0.03014245...
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_set_password(self): self.login() created = MumbleUser.objects.create(user=self.member) old_pwd = created.credentials.get('password') response = self.client.post(urls.reverse('mumble:set_password'), data={'password': '1234asdf'}) self.assertNotEqual(MumbleUser.objects.g...
12,913
[ 0.01322553213685751, -0.02371515892446041, -0.01330916304141283, -0.05720311403274536, -0.01874513179063797, 0.01315384916961193, 0.01808803528547287, -0.04927018657326698, -0.03373884782195091, 0.07034501433372498, 0.009109728038311005, 0.024658987298607826, -0.022592123597860336, -0.0001...
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": "vstring", "annotation": null, "type_comment": null}}], "kwarg": n...
def __init__(self, vstring): self.vstring = vstring ver_main = re.match(r'\d[.]\d+[.]\d+', vstring) if not ver_main: raise ValueError("Not a valid numpy version string") self.version = ver_main.group() self.major, self.minor, self.bugfix = [int(x) for x in ...
12,914
[ -0.0063772317953407764, -0.010738861747086048, -0.0372280552983284, -0.0425589382648468, 0.03506926819682121, 0.055599771440029144, 0.05119408294558525, -0.03498115390539169, -0.009918303228914738, 0.012622293084859848, 0.00649288110435009, -0.026654407382011414, -0.045004092156887054, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def _compare(self, other): if not isinstance(other, (string_types, NumpyVersion)): raise ValueError("Invalid object to compare with NumpyVersion.") if isinstance(other, string_types): other = NumpyVersion(other) vercmp = self._compare_version(other) if vercmp ==...
12,915
[ 0.011555949226021767, 0.04404803737998009, -0.014508766122162342, -0.018249740824103355, 0.028062863275408745, -0.0017511537298560143, 0.016962045803666115, 0.04258272796869278, 0.05026449263095856, 0.00034204390249215066, 0.04946523532271385, -0.012588324956595898, 0.047111861407756805, 0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pidfile", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def check_pid(pidfile): if pidfile and os.path.exists(pidfile): try: pid = int(open(pidfile).read().strip()) os.kill(pid, 0) return pid except BaseException: return 0 return 0
12,916
[ 0.046776287257671356, 0.03185242414474487, 0.031741052865982056, -0.05902721732854843, 0.011248582974076271, 0.002697989344596863, 0.02929086424410343, -0.003107281867414713, -0.020381096750497818, -0.010140431113541126, 0.048201847821474075, 0.016182366758584976, 0.009366394951939583, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pidfile", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def write_pid(pidfile): server_logger.info("Writing pid file") piddir = os.path.dirname(pidfile) if piddir != '' and not os.path.exists(piddir): os.makedirs(piddir) with open(pidfile, 'w') as fobj: fobj.write(str(os.getpid()))
12,917
[ -0.00854913704097271, 0.012101815082132816, 0.026799194514751434, -0.052733197808265686, 0.0006593677680939436, -0.0181797593832016, 0.015649085864424706, -0.006369945593178272, 0.026734303683042526, -0.0026658601127564907, 0.029632683843374252, -0.002291396027430892, 0.010663440451025963, ...
8
{"_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_spool_handler(filename): handler = logging.handlers.TimedRotatingFileHandler( filename=filename, when='d', encoding='utf8', backupCount=7 # keep one week of historical logs ) formatter = logging.Formatter(get_log_format()) handler.setFormatter(formatter) retu...
12,918
[ 0.008649569936096668, -0.0026612775400280952, 0.013408167287707329, -0.06401748955249786, -0.00815568957477808, 0.014255772344768047, 0.007935445755720139, -0.0018854192458093166, 0.017325835302472115, 0.014082246460020542, -0.020289113745093346, -0.025428133085370064, -0.029365822672843933,...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "n", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": 300...
def run(n=3000): if n == "short": n = 500 with model: trace = pm.sample(n, step) burn = n/10 pm.traceplot(trace[burn:]); pm.plots.summary(trace[burn:])
12,919
[ -0.0024715738836675882, 0.012159006670117378, 0.006871610414236784, -0.035641465336084366, 0.009224534966051579, 0.031042566522955894, -0.013997229747474194, -0.014384927228093147, 0.03187143802642822, 0.039705608040094376, 0.04860929027199745, -0.01771378144621849, -0.004024036228656769, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "f", "annotation": null...
class RoundtripLegalSyntaxTestCase(unittest.TestCase): def roundtrip(self, f, s): st1 = f(s) t = st1.totuple() try: st2 = parser.sequence2st(t) except parser.ParserError as why: self.fail("could not roundtrip %r: %s" % (s, why)) self.assertEqual(t, s...
12,920
[ 0.009115025401115417, 0.007042964454740286, 0.028008542954921722, -0.03709294646978378, 0.024436024948954582, -0.018352536484599113, 0.008395417593419552, 0.011636202223598957, 0.0091456463560462, 0.011105428449809551, 0.024721825495362282, -0.029131334275007248, -0.009870357811450958, -0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": "...
def download_to_file(url, filename, headers={}): errors = open("errors.txt", 'a') with open(filename, "wb") as file: try: print("Downloading " + url) response = get(url, headers=headers) if response.status_code == 200: file.write(response.content) ...
12,921
[ -0.028680307790637016, -0.03931783139705658, 0.0393901951611042, -0.04679545760154724, -0.04100632667541504, 0.008321872912347317, -0.03905249759554863, 0.015582405030727386, 0.032949790358543396, 0.04353907331824303, 0.024097248911857605, -0.038304734975099564, -0.033528704196214676, -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": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def roundtrip(self, f, s): st1 = f(s) t = st1.totuple() try: st2 = parser.sequence2st(t) except parser.ParserError as why: self.fail("could not roundtrip %r: %s" % (s, why)) self.assertEqual(t, st2.totuple(), "could not re-generat...
12,922
[ 0.024265244603157043, -0.008042299188673496, -0.011922091245651245, -0.05394415557384491, 0.011428846046328545, 0.0001402289344696328, -0.037895649671554565, -0.025744980201125145, 0.07632063329219818, 0.008391179144382477, 0.0087099839001894, -0.028078870847821236, -0.0002996312687173486, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_flags_passed(self): # The unicode literals flags has to be passed from the paser to AST # generation. suite = parser.suite("from __future__ import unicode_literals; x = ''") code = suite.compile() scope = {} exec(code, {}, scope) self.assertIsInstance(sco...
12,923
[ 0.01687682420015335, 0.019241398200392723, 0.008873648941516876, -0.03910641744732857, 0.034429240971803665, 0.03138907253742218, 0.005008480045944452, 0.009776604361832142, 0.04612218961119652, 0.061894677579402924, 0.02072250470519066, -0.050097789615392685, 0.0002572042867541313, 0.0017...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_expressions(self): self.check_expr("foo(1)") self.check_expr("[1, 2, 3]") self.check_expr("[x**3 for x in range(20)]") self.check_expr("[x**3 for x in range(20) if x % 3]") self.check_expr("[x**3 for x in range(20) if x % 2 if x % 3]") self.check_expr("list(x**3 ...
12,924
[ 0.023833157494664192, -0.0008592098020017147, 0.020171603187918663, -0.014593347907066345, -0.012491588480770588, 0.009953615255653858, -0.022048644721508026, 0.0059351567178964615, 0.05932513251900673, 0.011506802402436733, 0.0381489135324955, -0.03190973028540611, -0.04317198693752289, -...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_yield_statement(self): self.check_suite("def f(): yield 1") self.check_suite("def f(): yield") self.check_suite("def f(): x += yield") self.check_suite("def f(): x = yield 1") self.check_suite("def f(): x = y = yield 1") self.check_suite("def f(): x = yield") ...
12,925
[ 0.015819258987903595, 0.005935396067798138, 0.01725391112267971, -0.059823714196681976, 0.005233940202742815, 0.026204615831375122, -0.043166518211364746, -0.026204615831375122, 0.07323072850704193, 0.04408063367009163, 0.04133828729391098, -0.037834182381629944, -0.008100070059299469, 0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_function_defs(self): self.check_suite("def f(): pass") self.check_suite("def f(*args): pass") self.check_suite("def f(*args, **kw): pass") self.check_suite("def f(**kw): pass") self.check_suite("def f(foo=bar): pass") self.check_suite("def f(foo=bar, *args): pass...
12,926
[ 0.025783082470297813, 0.0418362133204937, 0.013369006104767323, -0.018130745738744736, -0.001088812598027289, 0.015265959315001965, 0.0368034802377224, -0.015730518847703934, 0.030506109818816185, 0.02733161672949791, 0.004032639320939779, -0.025666942819952965, -0.007768476381897926, -0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_simple_augmented_assignments(self): self.check_suite("a += b") self.check_suite("a -= b") self.check_suite("a *= b") self.check_suite("a /= b") self.check_suite("a //= b") self.check_suite("a %= b") self.check_suite("a &= b") self.check_suite("a |...
12,927
[ 0.02415289729833603, 0.013734232634305954, 0.026194153353571892, -0.07273007184267044, 0.00890837237238884, 0.03070143610239029, -0.037143781781196594, -0.012530717067420483, 0.03771014139056206, 0.007150296121835709, 0.019539423286914825, -0.02340955100953579, 0.018536493182182312, 0.0032...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_class_defs(self): self.check_suite("class foo():pass") self.check_suite("class foo(object):pass") self.check_suite("@class_decorator\n" "class foo():pass") self.check_suite("@class_decorator(arg)\n" "class foo():pass") se...
12,928
[ -0.012414221651852131, -0.015629010275006294, 0.010878893546760082, -0.04278864338994026, 0.03128308802843094, 0.0043709841556847095, -0.009519032202661037, -0.020291393622756004, 0.007921038195490837, 0.02323671616613865, 0.033188145607709885, -0.01646874099969864, 0.01132382545620203, -0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_import_from_statement(self): self.check_suite("from sys.path import *") self.check_suite("from sys.path import dirname") self.check_suite("from sys.path import (dirname)") self.check_suite("from sys.path import (dirname,)") self.check_suite("from sys.path import dirname ...
12,929
[ -0.00795876607298851, 0.007086740806698799, 0.017980916425585747, -0.05330407992005348, 0.033407166600227356, 0.01163109764456749, 0.0048913247883319855, -0.009610701352357864, 0.0005929925828240812, 0.019909197464585304, 0.02161640115082264, 0.02655378356575966, 0.01580699346959591, 0.000...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_relative_imports(self): self.check_suite("from . import name") self.check_suite("from .. import name") # check all the way up to '....', since '...' is tokenized # differently from '.' (it's an ellipsis token). self.check_suite("from ... import name") self.check_...
12,930
[ 0.00922312494367361, 0.0016773284878581762, -0.012278102338314056, -0.059633173048496246, -0.018248403444886208, 0.01787598617374897, -0.0006855516694486141, -0.0026461929082870483, 0.0427347794175148, 0.020180312916636467, 0.005429132375866175, -0.02858295664191246, 0.007576345931738615, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_try_stmt(self): self.check_suite("try: pass\nexcept: pass\n") self.check_suite("try: pass\nfinally: pass\n") self.check_suite("try: pass\nexcept A: pass\nfinally: pass\n") self.check_suite("try: pass\nexcept A: pass\nexcept: pass\n" "finally: pass\n") ...
12,931
[ -0.006877576000988483, 0.0020642217714339495, 0.03447013348340988, -0.03444482386112213, 0.01961406134068966, 0.01650112122297287, -0.010781406424939632, -0.03821578621864319, 0.008187289349734783, 0.045479316264390945, 0.014982611872255802, -0.012869355268776417, -0.02596648596227169, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_position(self): # An absolutely minimal test of position information. Better # tests would be a big project. code = "def f(x):\n return x + 1" st1 = parser.suite(code) st2 = st1.totuple(line_info=1, col_info=1) def walk(tree): node_type = tree[0]...
12,932
[ -0.01772833615541458, -0.012519601732492447, -0.019436966627836227, -0.054676175117492676, -0.038231901824474335, -0.04800733923912048, 0.011618686839938164, 0.028663570061326027, -0.014176455326378345, 0.0865706130862236, 0.024997781962156296, -0.0013681987766176462, 0.032847125083208084, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "tree", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def walk(tree): node_type = tree[0] next = tree[1] if isinstance(next, tuple): for elt in tree[1:]: for x in walk(elt): yield x else: yield tree
12,933
[ -0.007473511155694723, 0.012434800155460835, 0.024280140176415443, -0.019452180713415146, 0.02698884904384613, 0.012940051034092903, -0.03090454824268818, -0.018567992374300957, 0.01434352807700634, 0.017894322052598, 0.038651738315820694, -0.027915144339203835, -0.01852588728070259, 0.016...
32
{"_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": "tree", "annotation": n...
class IllegalSyntaxTestCase(unittest.TestCase): def check_bad_tree(self, tree, label): try: parser.sequence2st(tree) except parser.ParserError: pass else: self.fail("did not detect invalid tree for %r" % label) def test_junk(self): # not even...
12,934
[ -0.02533225156366825, -0.012609731405973434, 0.06798878312110901, -0.06496606022119522, -0.006626312620937824, 0.012880424037575722, 0.0014338212786242366, -0.012226251885294914, 0.037558503448963165, 0.0041816262528300285, 0.007500421721488237, -0.06834971159696579, 0.011312666349112988, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class CompileTestCase(unittest.TestCase): # These tests are very minimal. :-( def test_compile_expr(self): st = parser.expr('2 + 3') code = parser.compilest(st) self.assertEqual(eval(code), 5) def test_compile_suite(self): st = parser.suite('x = 2; y = x + 3') code...
12,935
[ -0.020448461174964905, -0.0011416701599955559, -0.008887380361557007, 0.005419590976089239, 0.022844096645712852, 0.02235213667154312, 0.007069264072924852, 0.0027017744723707438, 0.06211540848016739, 0.05432959273457527, 0.007481013890355825, -0.018951188772916794, 0.03165661543607712, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "match", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}], "kwarg": ...
def JSONNumber(match, context): match = JSONNumber.regex.match(match.string, *match.span()) integer, frac, exp = match.groups() if frac or exp: res = float(integer + (frac or '') + (exp or '')) else: res = int(integer) return res, None
12,936
[ 0.0003104469506070018, 0.00315041933208704, 0.05463562160730362, -0.04680970311164856, -0.0005365890101529658, 0.03509512543678284, 0.011580904945731163, -0.00033683967194519937, 0.049483153969049454, -0.003514980897307396, 0.03861922025680542, -0.07884250581264496, 0.0000674533803248778, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_issue_9011(self): # Issue 9011: compilation of an unary minus expression changed # the meaning of the ST, so that a second compilation produced # incorrect results. st = parser.expr('-3') code1 = parser.compilest(st) self.assertEqual(eval(code1), -3) code...
12,937
[ 0.017937537282705307, 0.010418775491416454, -0.007339610252529383, -0.032359227538108826, 0.011241751722991467, 0.02238273061811924, -0.000007840061698516365, -0.013861841522157192, 0.014735205098986626, -0.027835652232170105, 0.009030351415276527, -0.020915929228067398, 0.04823652282357216,...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "match", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": ...
def JSONObject(match, context, _w=WHITESPACE.match): pairs = {} s = match.string end = _w(s, match.end()).end() nextchar = s[end:end + 1] # trivial empty object if nextchar == '}': return pairs, end + 1 if nextchar != '"': raise ValueError(errmsg("Expecting property name", s,...
12,938
[ 0.05088970810174942, 0.027811817824840546, 0.006925559137016535, -0.03351006284356117, -0.02559826895594597, -0.0066242096945643425, 0.02822822704911232, 0.035307202488183975, 0.017478270456194878, 0.04685710370540619, -0.02651875466108322, -0.029411708936095238, -0.01367578748613596, 0.03...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "s", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "end", "annotation": null, "type_comment": null}}, {"_type": "arg", "...
def scanstring(s, end, encoding=None, _b=BACKSLASH, _m=STRINGCHUNK.match): if encoding is None: encoding = DEFAULT_ENCODING chunks = [] _append = chunks.append begin = end - 1 while 1: chunk = _m(s, end) if chunk is None: raise ValueError( errmsg("...
12,939
[ -0.04183531180024147, -0.03128183260560036, 0.0026339327450841665, -0.024230407550930977, -0.0057204109616577625, -0.0410781130194664, -0.023768987506628036, -0.005442376714199781, 0.042166586965322495, -0.019628049805760384, 0.0032742994371801615, -0.03440528362989426, -0.005122932605445385...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "available_apps", "ctx": {"_type": "Store", "_fields": {}}}}],...
class TransactionsPerRequestTests(TransactionTestCase): available_apps = [] def test_no_transaction(self): response = self.client.get('/in_transaction/') self.assertContains(response, 'False') def test_auto_transaction(self): old_atomic_requests = connection.settings_dict['ATOMIC_...
12,940
[ 0.008251136168837547, -0.01810465008020401, -0.011461456306278706, -0.044198937714099884, 0.02238878607749939, 0.0054302820935845375, 0.0032798682805150747, -0.018661031499505043, 0.056350305676460266, 0.02866476960480213, 0.020419197157025337, -0.03827903792262077, 0.035296835005283356, -...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "match", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": ...
def JSONArray(match, context, _w=WHITESPACE.match): values = [] s = match.string end = _w(s, match.end()).end() # look-ahead for trivial empty array nextchar = s[end:end + 1] if nextchar == ']': return values, end + 1 iterscan = JSONScanner.iterscan while True: try: ...
12,941
[ -0.007506002672016621, -0.05072017386555672, 0.0184856578707695, 0.0047671617940068245, 0.032210227102041245, -0.005419990047812462, -0.03626686707139015, 0.004621414467692375, 0.05125458166003227, 0.03910894691944122, -0.0024807460140436888, -0.07481711357831955, -0.015947218984365463, -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_invalid_urls(self): response = self.client.get('~%A9helloworld') self.assertEqual(response.status_code, 404) self.assertContains(response, '~%A9helloworld', status_code=404) response = self.client.get('d%aao%aaw%aan%aal%aao%aaa%aad%aa/') self.assertEqual(response.status...
12,942
[ -0.015300927683711052, -0.04422048479318619, 0.028496118262410164, -0.024170201271772385, 0.028061239048838615, -0.011615888215601444, -0.02714570052921772, -0.0031614669132977724, 0.028084127232432365, 0.04010056331753731, -0.019249185919761658, -0.061341043561697006, 0.0031385784968733788,...
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 HandlerNotFoundTest(TestCase): def test_invalid_urls(self): response = self.client.get('~%A9helloworld') self.assertEqual(response.status_code, 404) self.assertContains(response, '~%A9helloworld', status_code=404) response = self.client.get('d%aao%aaw%aan%aal%aao%aaa%aad%aa/'...
12,943
[ 0.013660299591720104, 0.011008532717823982, 0.0044081672094762325, 0.015995122492313385, -0.010316537693142891, 0.03682892769575119, 0.03644859790802002, 0.03746281936764717, -0.010501421988010406, 0.01220235601067543, 0.0028234454803168774, -0.0016520721837878227, -0.042829740792512894, 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": "shutdown_timeout", "annotation": null, "type_comment": null}}], "...
def __init__(self, shutdown_timeout=DEFAULT_TIMEOUT): self._queue = Queue(-1) self._lock = threading.Lock() self._thread = None self.options = { 'shutdown_timeout': shutdown_timeout, } self.start()
12,944
[ -0.022885490208864212, -0.013237925246357918, 0.0843612402677536, 0.0034835038240998983, -0.040983833372592926, -0.022091703489422798, 0.01202892605215311, -0.04574655741453171, -0.01952715963125229, 0.04887285456061363, -0.013555440120398998, -0.019441675394773483, 0.03861468657851219, 0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "grid", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def find_paths(grid): if grid[0][0] == 1: return 0 rows = len(grid) columns = len(grid[0]) dp_paths = [[0] * columns for _ in range(rows)] dp_paths[0][0] = 1 for row in range(1, rows): if grid[row][0] == 1: dp_paths[row][0] = 0 else: dp_paths[ro...
12,945
[ 0.057152923196554184, 0.03239157795906067, 0.027148868888616562, -0.008756309747695923, -0.028158029541373253, 0.0668507069349289, 0.04841507226228714, 0.05055646225810051, 0.011469966731965542, -0.005522690247744322, 0.021918466314673424, -0.00020613941887859255, -0.04041563346982002, 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 main_thread_terminated(self): self._lock.acquire() try: if not self._thread: # thread not started or already stopped - nothing to do return # wake the processing thread up self._queue.put_nowait(self._terminator) timeo...
12,946
[ 0.029918575659394264, 0.04392557963728905, 0.024855803698301315, -0.01212654635310173, -0.017719704657793045, 0.04843385890126228, 0.06808224320411682, 0.06740720570087433, -0.0074314274825155735, -0.010951260104775429, 0.05670305714011192, -0.023481622338294983, -0.05438864603638649, -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 _target(self): while True: record = self._queue.get() try: if record is self._terminator: break callback, args, kwargs = record try: callback(*args, **kwargs) except Exception: ...
12,947
[ -0.008682116866111755, -0.013140184804797173, -0.03161600977182388, -0.05953451246023178, 0.004695012699812651, 0.004844199866056442, 0.0025274085346609354, -0.01017984002828598, 0.026303771883249283, 0.002903302200138569, 0.03154580295085907, -0.06931652128696442, -0.029580041766166687, 0...
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 MidiPlayer: def __init__(self): self.fs = fluidsynth.Synth() self.fs.start() # connect fluidsynth to JACK audio output if this is linux if 'linux' in sys.platform: print('Since this is linux, we assume JACK is installed and use it to connect audio....
12,948
[ 0.008286423049867153, -0.025239378213882446, -0.01013122871518135, 0.009365938603878021, 0.059844695031642914, 0.040443822741508484, 0.004604412708431482, 0.020921315997838974, -0.014798993244767189, -0.04086954891681671, -0.00168262526858598, 0.0385584719479084, -0.005052943713963032, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "http"}}, {"_type": "Constant", "_fields": {"kind": null, ...
class ThreadedHTTPTransport(AsyncTransport, HTTPTransport): scheme = ['http', 'https', 'threaded+http', 'threaded+https'] def get_worker(self): if not hasattr(self, '_worker') or not self._worker.is_alive(): self._worker = AsyncWorker() return self._worker def send_sync(self, ...
12,949
[ 0.04714846983551979, 0.04890337586402893, 0.01379355974495411, -0.015127288177609444, -0.00832995306700468, 0.0003502499603200704, -0.0055835251696407795, -0.059853989630937576, -0.012588524259626865, -0.034115370362997055, 0.03481733053922653, -0.030816147103905678, 0.010488486848771572, ...
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": "data", "annotation": n...
class XGS(object): def __init__(self, data=None, filename=None): # open in little endian initially stream = BinaryStream(data=data, filename=filename) del data # check sig to find actual endianess h_sig = stream.peek(len(XGS_L_SIGNATURE)) if h_sig == XGS_L_SIGNATURE:...
12,950
[ 0.0006161403143778443, 0.0012255915207788348, 0.005119390320032835, -0.035389792174100876, 0.0033148201182484627, -0.014721962623298168, -0.000733942782972008, -0.025852622464299202, 0.027826650068163872, -0.005491006653755903, 0.02573370561003685, -0.015673302114009857, -0.02773151732981205...
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): self.fs = fluidsynth.Synth() self.fs.start() # connect fluidsynth to JACK audio output if this is linux if 'linux' in sys.platform: print('Since this is linux, we assume JACK is installed and use it to connect audio.') os.syst...
12,951
[ 0.08345945924520493, 0.054901592433452606, 0.012166463769972324, -0.00882831122726202, 0.005433675833046436, -0.0028975841123610735, 0.01713697798550129, -0.05598606914281845, -0.032805394381284714, 0.004541242960840464, 0.04220418632030487, -0.012708702124655247, 0.007371047046035528, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, data=None, filename=None): # open in little endian initially stream = BinaryStream(data=data, filename=filename) del data # check sig to find actual endianess h_sig = stream.peek(len(XGS_L_SIGNATURE)) if h_sig == XGS_L_SIGNATURE: big_endian...
12,952
[ 0.015638763085007668, 0.009425196796655655, -0.044631727039813995, -0.0405261404812336, -0.018640698865056038, 0.0101315351203084, 0.02434658631682396, -0.04586781933903694, -0.005189928226172924, 0.0485607348382473, 0.05045901611447334, -0.028981927782297134, -0.07818277925252914, 0.01397...
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": "cyclevars", "annotatio...
class CycleNode(Node): def __init__(self, cyclevars, variable_name=None, silent=False, escape=False): self.cyclevars = cyclevars self.variable_name = variable_name self.silent = silent self.escape = escape # only while the "future" version exists def render(self, context)...
12,953
[ 0.039526816457509995, -0.011212709359824657, -0.041094060987234116, -0.010745992884039879, 0.018461212515830994, -0.021261509507894516, 0.016029680147767067, -0.016870921477675438, -0.004586493596434593, 0.02345104143023491, 0.03692242503166199, 0.005542973522096872, -0.04651027172803879, ...
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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def render(self, context): if self not in context.render_context: # First time the node is rendered in template context.render_context[self] = itertools_cycle(self.cyclevars) cycle_iter = context.render_context[self] value = next(cycle_iter).resolve(context) if se...
12,954
[ -0.035323865711688995, 0.03240138664841652, -0.06154146045446396, -0.057560112327337265, 0.046590231359004974, -0.004431366454809904, -0.004719907883554697, 0.02727646194398403, -0.03362967446446419, 0.09318046271800995, 0.03490031883120537, -0.0005949519691057503, -0.033820271492004395, -...
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": "filter_expr", "annotat...
class FilterNode(Node): def __init__(self, filter_expr, nodelist): self.filter_expr, self.nodelist = filter_expr, nodelist def render(self, context): output = self.nodelist.render(context) # Apply filters. context.update({'var': output}) filtered = self.filter_expr.resol...
12,955
[ -0.0075365351513028145, 0.0016047375975176692, -0.00041300500743091106, -0.019646571949124336, -0.002001623623073101, -0.014488487504422665, 0.0063559068366885185, -0.010826247744262218, -0.011238894425332546, 0.028014132753014565, 0.037711333483457565, -0.013628806918859482, -0.050663858652...
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": "variables", "annotatio...
class FirstOfNode(Node): def __init__(self, variables, escape=False): self.vars = variables self.escape = escape # only while the "future" version exists def render(self, context): for var in self.vars: value = var.resolve(context, True) if value: ...
12,956
[ 0.012967227026820183, 0.008937639184296131, -0.028926892206072807, -0.014350095763802528, 0.006976685486733913, -0.033460889011621475, -0.03207802027463913, -0.035886574536561966, 0.0398084819316864, 0.021513808518648148, 0.014078056439757347, 0.011590026319026947, -0.01717250794172287, -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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def render(self, context): for var in self.vars: value = var.resolve(context, True) if value: if not self.escape: value = mark_safe(value) return render_value_in_context(value, context) return ''
12,957
[ 0.022285964339971542, 0.01603713259100914, -0.04155127704143524, -0.0694519653916359, 0.0311980452388525, 0.013258593156933784, -0.007078935857862234, -0.05695430189371109, -0.0014800624921917915, 0.0516047477722168, 0.018020156770944595, -0.012520723044872284, -0.019576599821448326, -0.03...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "nodelist_loop"}}, {"_type": "Constant", "_fields": {"kin...
class ForNode(Node): child_nodelists = ('nodelist_loop', 'nodelist_empty') def __init__(self, loopvars, sequence, is_reversed, nodelist_loop, nodelist_empty=None): self.loopvars, self.sequence = loopvars, sequence self.is_reversed = is_reversed self.nodelist_loop = nodelist_loop ...
12,958
[ 0.028181303292512894, 0.00689299451187253, -0.04250045120716095, -0.061897311359643936, 0.016502564772963524, 0.0011210637167096138, 0.011412158608436584, -0.03554398566484451, -0.014217594638466835, 0.04003776237368584, 0.012300757691264153, -0.005842542741447687, -0.03493466228246689, -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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def render(self, context): if 'forloop' in context: parentloop = context['forloop'] else: parentloop = {} context.push() try: values = self.sequence.resolve(context, True) except VariableDoesNotExist: values = [] if values i...
12,959
[ -0.005888477433472872, 0.036607347428798676, 0.010167473927140236, -0.029081640765070915, -0.01381932944059372, 0.005624855402857065, -0.009057488292455673, -0.0012848090846091509, -0.005716429557651281, 0.02025724947452545, 0.0295256357640028, -0.01183245424181223, -0.029858632013201714, ...
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": "target", "annotation":...
class RegroupNode(Node): def __init__(self, target, expression, var_name): self.target, self.expression = target, expression self.var_name = var_name def resolve_expression(self, obj, context): # This method is called for each object in self.target. See regroup() # for the reaso...
12,960
[ -0.0068216691724956036, 0.013619465753436089, -0.008421150967478752, -0.03688356652855873, -0.044713862240314484, -0.01979059912264347, -0.04194461181759834, -0.004458256531506777, 0.01778527908027172, 0.023407338187098503, 0.0025543959345668554, -0.022177886217832565, 0.015123455785214901, ...
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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def render(self, context): obj_list = self.target.resolve(context, True) if obj_list == None: # target variable wasn't found in context; fail silently. context[self.var_name] = [] return '' # List of dictionaries in the format: # {'grouper': 'key', 'li...
12,961
[ 0.042094673961400986, -0.018946824595332146, 0.037323661148548126, -0.034874822944402695, -0.010945881716907024, -0.039160288870334625, 0.004515044391155243, -0.008333436213433743, 0.001643993309698999, 0.020825674757361412, -0.01902071200311184, 0.02586056850850582, 0.0578010119497776, -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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def render(self, context): filepath = self.filepath.resolve(context) if not include_is_allowed(filepath): if settings.DEBUG: return "[Didn't have permission to include file]" else: return '' # Fail silently for invalid includes. try: ...
12,962
[ 0.03916601836681366, -0.009431080892682076, 0.00420221034437418, -0.04235522076487541, -0.003178279846906662, -0.047226399183273315, 0.009179877117276192, -0.032787613570690155, 0.0033503002487123013, 0.01554189808666706, 0.010195615701377392, 0.002733211498707533, -0.0027646119706332684, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filepath", "annotation...
class SsiNode(Node): def __init__(self, filepath, parsed): self.filepath = filepath self.parsed = parsed def render(self, context): filepath = self.filepath.resolve(context) if not include_is_allowed(filepath): if settings.DEBUG: return "[Didn't have...
12,963
[ 0.036560870707035065, 0.00744225550442934, -0.018671829253435135, -0.018073227256536484, -0.0031311577185988426, -0.021100779995322227, -0.03849482163786888, -0.006181734148412943, 0.017831481993198395, 0.031035298481583595, 0.005934234708547592, 0.005997548345476389, -0.02184903435409069, ...
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": "context", "annotation": null, "type_comment": null}}], "kwarg": n...
def render(self, context): try: value = self.val_expr.resolve(context) max_value = self.max_expr.resolve(context) max_width = int(self.max_width.resolve(context)) except VariableDoesNotExist: return '' except (ValueError, TypeError): ra...
12,964
[ 0.04338625818490982, 0.025264233350753784, 0.006140167824923992, -0.022641869261860847, 0.027609435841441154, -0.01936924457550049, -0.0012338965898379683, -0.015979360789060593, -0.018036743625998497, 0.06165752187371254, 0.008639940991997719, 0.004453220870345831, -0.03198004141449928, 0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "val_expr", "annotation...
class WidthRatioNode(Node): def __init__(self, val_expr, max_expr, max_width): self.val_expr = val_expr self.max_expr = max_expr self.max_width = max_width def render(self, context): try: value = self.val_expr.resolve(context) max_value = self.max_expr.re...
12,965
[ -0.013357290998101234, 0.018561990931630135, -0.0036011773627251387, -0.040968116372823715, 0.028982188552618027, 0.006241321098059416, -0.03204885870218277, -0.0611606240272522, -0.010128648951649666, 0.019749784842133522, 0.03021317534148693, -0.005390967708081007, -0.0309690460562706, -...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "var", "annotation": nu...
class WithNode(Node): def __init__(self, var, name, nodelist, extra_context=None): self.nodelist = nodelist # var and name are legacy attributes, being left in case they are used # by third-party subclasses of this Node. self.extra_context = extra_context or {} if name: ...
12,966
[ 0.0531131774187088, -0.01474146731197834, -0.0005014415364712477, -0.06862281262874603, -0.007754816208034754, 0.008602237328886986, 0.007638982031494379, 0.004148704931139946, -0.01646069437265396, 0.03675002604722977, 0.038822855800390244, -0.09900803118944168, 0.029580479487776756, -0.0...
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": "pieces", "annotation": null, "type_comment": null}}], "kwarg": nul...
def forme(cls, pieces): for groupe in pieces: if len(groupe) == 2: autres = list(pieces) autres.remove(groupe) exterieures = [] for o_groupe in autres: exterieures.extend(o_groupe) pa...
12,967
[ 0.036053407937288284, 0.0028456617146730423, 0.013777014799416065, -0.06448495388031006, 0.0006134783034212887, -0.004957970231771469, 0.0007192504126578569, 0.003256214316934347, -0.026275362819433212, 0.03329549729824066, 0.02710273489356041, -0.09371880441904068, 0.028306186199188232, -...
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": "pieces", "annotation": null, "type_comment": null}}], "kwarg": nul...
def forme(cls, pieces): for groupe in pieces: if len(groupe) == 3: autres = list(pieces) autres.remove(groupe) exterieures = [] for o_groupe in autres: exterieures.extend(o_groupe) br...
12,968
[ 0.053931914269924164, -0.020095650106668472, 0.02292965166270733, -0.06266701966524124, -0.005901103373616934, 0.00954482052475214, 0.01336029451340437, 0.005907237529754639, -0.02304006740450859, 0.0357501357793808, 0.03209415078163147, -0.08641865104436874, 0.033689044415950775, -0.02995...
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": "pieces", "annotation": null, "type_comment": null}}], "kwarg": nul...
def forme(cls, pieces): groupes = [] for groupe in pieces: if len(groupe) == 2: groupes.append(groupe) if len(groupes) != 2: continue autres = list(pieces) for o_groupe in groupes: ...
12,969
[ 0.043891265988349915, -0.0062117185443639755, 0.01599675603210926, -0.056534294039011, -0.02322324365377426, -0.018259191885590553, -0.013241906650364399, -0.009369147941470146, -0.01801964081823826, 0.03723704069852829, 0.04527534544467926, -0.07937159389257431, 0.015078472904860973, -0.0...
13
{"_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": "pieces", "annotation": null, "type_comment": null}}], "kwarg": nul...
def forme(cls, pieces): a_pieces = [] for groupe in pieces: a_pieces.extend(groupe) a_pieces = sorted(a_pieces, key=lambda piece: piece.points, reverse=True) for i, piece in enumerate(a_pieces): t_pieces = [piece] nb = 1 ...
12,970
[ 0.0457318052649498, -0.003988019656389952, 0.0017127428436651826, -0.05028235539793968, 0.003944022580981255, -0.019496984779834747, 0.004135723691433668, -0.01576351933181286, -0.019584977999329567, 0.0331612154841423, 0.04472615569829941, -0.08945231139659882, 0.00786918867379427, -0.045...
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": "pieces", "annotation": null, "type_comment": null}}], "kwarg": nul...
def forme(cls, pieces): a_pieces = [] for groupe in pieces: a_pieces.extend(groupe) a_pieces = sorted(a_pieces, key=lambda piece: piece.points, reverse=True) couleurs = {} for piece in a_pieces: liste = couleurs.get(piece._couleur,...
12,971
[ 0.03860727697610855, -0.009817278943955898, 0.031130947172641754, -0.03975936770439148, -0.004504182375967503, -0.006569365039467812, -0.024071330204606056, -0.005389698315411806, -0.0202228594571352, 0.03341061621904373, 0.042063549160957336, -0.08927473425865173, 0.035910896956920624, -0...
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": "pieces", "annotation": null, "type_comment": null}}], "kwarg": nul...
def forme(cls, pieces): print("carré", pieces) for groupe in pieces: if len(groupe) == 4: autres = list(pieces) autres.remove(groupe) exterieures = [] for o_groupe in autres: exterieures.extend(o_groupe) ...
12,972
[ -0.01350867934525013, -0.037675388157367706, 0.05611952021718025, -0.02663443423807621, 0.030612582340836525, -0.009131654165685177, -0.0045365761034190655, -0.008211575448513031, -0.013806507922708988, 0.03059130720794201, 0.003252187976613641, -0.03861142322421074, 0.0002268620446557179, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "localhost"}}, "targets": [{"_type": "Name", "_fields": {"id": "seleniumHost", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment"...
class TestDefaultServer(unittest.TestCase): seleniumHost = 'localhost' seleniumPort = str(4444) #browserStartCommand = "c:\\program files\\internet explorer\\iexplore.exe" browserStartCommand = "*firefox" browserURL = "http://localhost:4444" def setUp(self): print("Using selenium serve...
12,973
[ 0.018227161839604378, -0.01901916228234768, 0.02962750382721424, -0.03255009651184082, 0.006146368570625782, -0.03176925331354141, 0.019922712817788124, -0.014133301563560963, 0.004955579526722431, 0.04926018789410591, 0.04493207484483719, -0.02744113653898239, -0.027552686631679535, -0.01...
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 testLinks(self): selenium = self.selenium selenium.open("/selenium-server/tests/html/test_click_page1.html") self.failUnless(selenium.get_text("link").find("Click here for next page") != -1, "link 'link' doesn't contain expected text") links = selenium.get_all_links() self.fa...
12,974
[ -0.02862291969358921, 0.02010529302060604, 0.011247191578149796, -0.014923159033060074, -0.027168691158294678, -0.01276489906013012, 0.0016677466919645667, -0.022471299394965172, 0.011189484037458897, 0.04999777674674988, 0.0029171141795814037, -0.014957783743739128, -0.04981311410665512, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "voxelsize", "annotation": null, "type_comment": null}}, {"_type":...
def fv_function_intensity_and_smoothing(data, voxelsize, seeds=None, unique_cls=None): data2 = scipy.ndimage.filters.gaussian_filter(data, sigma=5) # data2 = data2 - data arrs = [data.reshape(-1, 1), data2.reshape(-1, 1)] fv = np.concatenate(arrs, axis=1) fv2 = np.stack(arrs, -1) return return_...
12,975
[ 0.06540697067975998, 0.02302544005215168, -0.0138461384922266, -0.014428009279072285, 0.03522096574306488, 0.04704837128520012, 0.00044234018423594534, 0.034532222896814346, -0.006317449267953634, 0.010426166467368603, 0.0392821840941906, 0.04498213902115822, -0.03191974386572838, 0.004883...
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": "n", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def read(self, n=None): if n is None: n = self.length - self.readBytes if n == 0 or self.finished: return '' data = self.chunkingZipFile.fp.read( min(n, self.length - self.readBytes)) self.readBytes += len(data) if self.readBytes == self.length...
12,976
[ 0.06450983881950378, 0.027789246290922165, -0.05116385594010353, -0.014634649269282818, 0.03156593069434166, 0.03707784786820412, 0.010698476806282997, 0.036567483097314835, 0.0019776553381234407, 0.024306021630764008, 0.031591448932886124, 0.055425383150577545, -0.039961397647857666, -0.0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "n", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def read(self, n=None): if self.finished: return "" if n is None: result = [self.buffer,] result.append( self.decomp.decompress( self.chunkingZipFile.fp.read( self.length - self.readBytes))) resul...
12,977
[ -0.005633539520204067, -0.005441350396722555, -0.008065931499004364, 0.005282193887978792, 0.0005592999514192343, -0.017681386321783066, -0.04725446552038193, 0.02474433183670044, 0.001135116210207343, 0.0019909576512873173, 0.021693332120776176, -0.04016749560832977, -0.022209839895367622, ...
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 __init__(self, **kwargs): FateComponent.__init__(self, **kwargs) # print (self.name) LOGGER.debug(f"{self.name} component created") new_kwargs = self.erase_component_base_param(**kwargs) HomoLogisticParam.__init__(self, **new_kwargs) self.input = Input(self.name, d...
12,978
[ 0.008957717567682266, 0.01494726724922657, -0.012830525636672974, -0.009974699467420578, 0.0024315915070474148, -0.032756272703409195, -0.04772718995809555, 0.028688346967101097, 0.011240013875067234, -0.0034943968057632446, 0.009590374305844307, -0.04933544248342514, -0.0025335855316370726,...
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": {"_type": "arg", "_fields": {"arg": "kwargs", "an...
class HomoLR(FateComponent, HomoLogisticParam): def __init__(self, **kwargs): FateComponent.__init__(self, **kwargs) # print (self.name) LOGGER.debug(f"{self.name} component created") new_kwargs = self.erase_component_base_param(**kwargs) HomoLogisticParam.__init__(self, *...
12,979
[ 0.04147568717598915, -0.014931246638298035, -0.032232534140348434, -0.004626962821930647, 0.04916753992438316, 0.007390213198959827, -0.0028952183201909065, 0.021965954452753067, 0.016719549894332886, 0.07170446217060089, -0.026393618434667587, -0.02803109958767891, 0.030896693468093872, 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": "function", "annotation": null, "type_comment": null}}, {"_type": ...
def can_combine(self, function, argument): # Can only combine two functions, and both functions must # allow composition. if not (function.is_function() and argument.is_function()): return False if function.dir().can_compose() and argument.dir().can_compose(): ret...
12,980
[ 0.026480047032237053, 0.014624600298702717, -0.05577251687645912, 0.013359010219573975, 0.01894058845937252, -0.020152093842625618, -0.015511595644056797, 0.039914775639772415, 0.04629681259393692, 0.053782183676958084, -0.0037237564101815224, -0.025182005017995834, 0.02306186966598034, 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": "function", "annotation": null, "type_comment": null}}, {"_type": ...
def combine(self, function, argument): if not function.is_function(): return subs = function.arg().can_unify(argument) if subs is None: return yield function.res().substitute(subs)
12,981
[ 0.016780510544776917, 0.015603724867105484, -0.06196228787302971, 0.008984305895864964, 0.0272471122443676, -0.009289816953241825, -0.0157508235424757, 0.02530089020729065, 0.038449205458164215, 0.06694099307060242, -0.004907988011837006, -0.027790244668722153, 0.03408152237534523, 0.00334...
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": "function", "annotation": null, "type_comment": null}}, {"_type": ...
def combine(self, function, argument): if not (function.is_function() and argument.is_function()): return if function.dir().can_compose() and argument.dir().can_compose(): subs = function.arg().can_unify(argument.res()) if not subs is None: yield Funct...
12,982
[ 0.040298618376255035, 0.006164771970361471, 0.028770945966243744, -0.001458292710594833, 0.009634529240429401, -0.014289007522165775, -0.0066139413975179195, 0.029518557712435722, -0.009109996259212494, 0.029277391731739044, -0.01883496157824993, -0.059808842837810516, 0.04526660963892937, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "left", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "right", "annotation": null, "type_comment": null}}], "kwarg": nul...
def backwardBxConstraint(left, right): # The functors must be crossed inwards if not crossedDirs(left, right): return False # Permuting combinators must be allowed if not left.dir().can_cross() and right.dir().can_cross(): return False # The resulting argument category is restricted ...
12,983
[ 0.03615850210189819, -0.002195629756897688, -0.023174632340669632, 0.013439650647342205, 0.05768531560897827, 0.017845518887043, -0.004116623196750879, 0.011102319695055485, 0.010973766446113586, 0.050299350172281265, -0.008700712583959103, -0.029146511107683182, 0.0314137227833271, 0.0191...
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": "function", "annotation": null, "type_comment": null}}, {"_type": ...
def can_combine(self, function, arg): # The argument must be a function. # The restriction that arg.res() must be a function # merely reduces redundant type-raising; if arg.res() is # primitive, we have: # X Y\X =>(<T) Y/(Y\X) Y\X =>(>) Y # which is equivalent to ...
12,984
[ 0.03438273444771767, 0.032226644456386566, -0.008739040233194828, -0.0036470009945333004, 0.04959003999829292, 0.025758378207683563, 0.003598259761929512, 0.02490970492362976, 0.019301580265164375, 0.03766274079680443, -0.013337931595742702, -0.04798443987965584, 0.06390279531478882, 0.017...
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": "function", "annotation": null, "type_comment": null}}, {"_type": ...
def can_combine(self, function, argument): if function.is_primitive() or argument.is_primitive(): return False # These could potentially be moved to the predicates, as the # constraints may not be general to all languages. if function.res().is_primitive(): return...
12,985
[ 0.030520351603627205, 0.0031663435511291027, 0.0666646808385849, 0.017100540921092033, 0.002113277092576027, -0.023433228954672813, 0.022747378796339035, 0.007401471026241779, -0.022004373371601105, 0.030840415507555008, -0.02505640871822834, 0.0014402862871065736, 0.005338203627616167, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "env", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def find(env): # First search in the SCons path path=env.WhereIs(key_program) if (path): return path # then the OS path: path=SCons.Util.WhereIs(key_program) if (path): return path # If that doesn't work try default location for mingw save_path=env['ENV']['PATH'] env...
12,986
[ 0.003055497771129012, 0.005458511412143707, -0.02265569195151329, 0.018946200609207153, 0.030497582629323006, -0.01295301504433155, -0.02073449082672596, 0.02196696028113365, 0.02154405415058136, 0.0477038249373436, 0.003646056167781353, -0.032527532428503036, 0.023018183186650276, -0.0055...
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": "function", "annotation": null, "type_comment": null}}, {"_type": ...
def combine(self, function, arg): if not (function.is_primitive() and arg.is_function() and arg.res().is_function()): return # Type-raising matches only the innermost application. arg = innermostFunction(arg) subs = function.can_unify(arg.arg()) if s...
12,987
[ 0.01229320839047432, -0.015285206958651543, 0.05745503306388855, -0.03607742488384247, 0.016380105167627335, -0.01260758563876152, 0.0007412240956909955, -0.012965324334800243, -0.03263012319803238, -0.0002876139187719673, -0.007268603425472975, 0.027448328211903572, 0.030223514884710312, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "target", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "source", "annotation": null, "type_comment": null}}, {"_type": ...
def shlib_emitter(target, source, env): dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') no_import_lib = env.get('no_import_lib', 0) if not dll: raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")) if not no...
12,988
[ 0.0023815229069441557, -0.005677280016243458, 0.05354476347565651, -0.01963909901678562, -0.029797254130244255, -0.022144777700304985, -0.007274367846548557, -0.01285570953041315, -0.01680610328912735, 0.010276666842401028, -0.0000587709218962118, 0.02116282284259796, 0.048081934452056885, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "target", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "source", "annotation": null, "type_comment": null}}, {"_type": ...
def shlib_generator(target, source, env, for_signature): cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS']) dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') if dll: cmd.extend(['-o', dll]) cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS']) implib = env.FindIxes(target, 'LIBPREFIX',...
12,989
[ -0.030219702050089836, -0.013941261917352676, 0.05454971641302109, 0.00019683415303006768, 0.038563426584005356, -0.0030091158114373684, -0.011335309594869614, 0.030663765966892242, -0.01345045492053032, 0.06347773224115372, -0.012433783151209354, -0.012363667599856853, 0.013018077239394188,...
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": "x", "annotation": null...
class ReshapeTest(tf.test.TestCase): def _testReshape(self, x, y, use_gpu=False): with self.test_session(use_gpu=use_gpu): np_ans = x.reshape(y) tf_ans = tf.reshape(x, y) out = tf_ans.eval() self.assertEqual(tf_ans.get_shape(), out.shape) self.assertShapeEqual(np_ans, tf_ans) def...
12,990
[ 0.008714715950191021, 0.008117482997477055, 0.05265394598245621, 0.006036311853677034, -0.011292564682662487, -0.0242915078997612, 0.030787931755185127, -0.013163486495614052, -0.039124805480241776, 0.03505387529730797, 0.00015397394599858671, 0.0021223074290901423, 0.03739405423402786, 0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "env", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def generate(env): mingw = find(env) if mingw: dir = os.path.dirname(mingw) env.PrependENVPath('PATH', dir ) # Most of mingw is the same as gcc and friends... gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'gfortran', 'm4'] for tool in gnu_tools: SCons.Tool.Tool...
12,991
[ -0.002926870249211788, -0.039441708475351334, 0.05496832728385925, -0.017731718719005585, 0.0484212301671505, -0.025415463373064995, 0.0013781863963231444, 0.018390974029898643, 0.0369638130068779, 0.06287939846515656, -0.0039072297513484955, -0.01542432140558958, -0.018311409279704094, 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 testFloatEmpty(self): x = np.empty((0, 0, 0, 0), dtype=np.float32) self._testBothReshape(x, [1, 2, 3, 0]) self._testBothReshape(x, [1, 0, 0, 4]) self._testBothReshape(x, [0, 0, 0, 0]) self._testBothReshape(x, [1, 2, 0]) self._testBothReshape(x, [0, 0, 0]) self._testBothReshape(x, [1, -1,...
12,992
[ -0.008481470867991447, 0.009478297084569931, 0.05392998829483986, -0.007805656176060438, 0.05347944423556328, -0.033835772424936295, -0.017176948487758636, 0.02960067056119442, 0.014822862111032009, 0.04147247597575188, -0.0013199499808251858, 0.008396993391215801, -0.004781386815011501, 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 testFloatReshapeGradThreeDimensions(self): x = np.arange(1., 25.).reshape([2, 3, 4]).astype(np.float32) s = list(np.shape(x)) with self.test_session(): input_tensor = tf.constant(x) reshape_out = tf.reshape(input_tensor, [1, 8, 3]) err = tf.test.compute_gradient_error(input_tensor, ...
12,993
[ 0.003445671172812581, 0.012473387643694878, 0.04407185688614845, 0.00493616471067071, 0.0352574847638607, 0.01536085456609726, -0.012543528340756893, 0.028336917981505394, -0.018131420016288757, 0.048771295696496964, -0.007288807071745396, -0.013361838646233082, 0.023543957620859146, 0.035...
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 testErrors(self): x = tf.constant(0.0, shape=[1, 0, 3]) with self.assertRaisesRegexp( ValueError, "cannot infer the missing input size"): tf.reshape(x, [0, -1, 5]) y = tf.constant(0.0, shape=[23, 29, 31]) with self.assertRaisesRegexp(ValueError, "isn't divisible by 17"): tf.resh...
12,994
[ -0.012739380821585655, -0.02748083509504795, 0.04294923320412636, 0.008538602851331234, 0.025168918073177338, -0.012477205134928226, 0.017101040109992027, 0.028910888358950615, -0.004546374082565308, 0.026908814907073975, -0.01865026354789734, -0.006727203726768494, -0.0050170994363725185, ...
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 testPartialShapes(self): x = tf.placeholder(tf.float32) # Unknown input shape, partial new shape. y = tf.reshape(x, [1, 1, -1, 1]) self.assertEqual([1, 1, None, 1], y.get_shape().as_list()) # Unknown input shape, unknown new shape. y = tf.reshape(x, tf.placeholder(tf.int32)) self.asser...
12,995
[ 0.00554853118956089, -0.003899320960044861, -0.04245492070913315, -0.027615291997790337, -0.04781077057123184, 0.004085469525307417, -0.03811798617243767, -0.0021129485685378313, -0.025263942778110504, -0.01126688253134489, 0.0181968305259943, -0.021749980747699738, -0.04269005358219147, -...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "opt", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "...
def plot_optimizer(opt, x, fx): model = opt.models[-1] x_model = opt.space.transform(x.tolist()) # Plot true function. plt.plot(x, fx, "r--", label="True (unknown)") plt.fill(np.concatenate([x, x[::-1]]), np.concatenate([fx - 1.9600 * noise_level, fx[::-1] ...
12,996
[ 0.004604493733495474, 0.014609354548156261, -0.019066249951720238, -0.012351966463029385, -0.04588865488767624, 0.014644083566963673, -0.02033964917063713, 0.009006400592625141, 0.038688164204359055, 0.07501475512981415, 0.014308369718492031, -0.03558570146560669, 0.0053540621884167194, 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 main(): argument_spec = VmwareRestClient.vmware_client_argument_spec() argument_spec.update( category_name=dict(type='str', required=True), category_description=dict(type='str', default='', required=False), category_cardinality=dict(type='str', choices=["multiple", "single"], default...
12,997
[ -0.0032479737419635057, 0.021890904754400253, 0.06276489794254303, -0.04744675010442734, -0.018752658739686012, 0.03441096469759941, 0.04950965195894241, -0.00033878779504448175, -0.011521528474986553, 0.06531060487031937, 0.017392020672559738, -0.0064355963841080666, -0.001824241946451366, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): # Parse args parser = ArgumentParser() parser.add_argument('current', metavar='<path/to/current.db>') parser.add_argument('updated', metavar='<path/to/updated.db>') args = parser.parse_args() dbFileName = abspath(args.current) newDbFileName = abspath(args.updated) if not os...
12,998
[ 0.03446665406227112, 0.028934219852089882, 0.08811509609222412, -0.029176516458392143, -0.0136190727353096, -0.024512311443686485, 0.031236033886671066, 0.04409793019294739, -0.010974004864692688, -0.005789872724562883, 0.04280568286776543, 0.017657345160841942, -0.002824266441166401, -0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "workFileName", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "finalFileName", "annotation": null, "type_comment": null}...
def createFinalDb(workFileName, finalFileName): dumpFileName = "dump.sql" print("Dumping into %s" % dumpFileName) dumpFile = open(dumpFileName, "w", encoding='utf-8') dump.dumpDatabase(workFileName, dumpFile) dumpFile.close() print("Restoring dump from %s into %s" % (dumpFileName, finalFileName...
12,999
[ 0.008699801750481129, 0.02714105322957039, 0.03163352608680725, -0.05782021954655647, -0.006540853995829821, 0.03375173732638359, 0.00417823251336813, -0.0036894141230732203, 0.0034915590658783913, 0.026954837143421173, 0.020914439111948013, -0.06038069725036621, 0.01713191717863083, -0.00...
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": "config_file", "annotation": null, "type_comment": null}}, {"_type"...
def parser(cls, config_file, logname=__name__): logger = logging.getLogger(logname) try: with open(config_file, 'r') as stream: conf = yaml.load(stream) except yaml.YAMLError as ex: mark = ex.problem_mark errormsg = "Error in file: {0} at ({1},...
13,000
[ 0.023717455565929413, 0.002037604572251439, 0.022852620109915733, -0.013719433918595314, 0.02468711882829666, 0.04628179594874382, -0.022944344207644463, -0.022145027294754982, 0.022000888362526894, 0.02809404581785202, 0.031238902360200882, -0.03296857327222824, 0.006168503779917955, 0.03...
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 sanity_check(self): assert 'dp_id' in self.__dict__ assert isinstance(self.dp_id, (int, long)) for vid, vlan in self.vlans.iteritems(): assert isinstance(vid, int) assert isinstance(vlan, VLAN) assert all(isinstance(p, Port) for p in vlan.get_ports()) ...