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 |
|---|---|---|---|---|---|
15,101 | [
0.03423922136425972,
0.006712823174893856,
0.02309364080429077,
-0.032659731805324554,
0.04565229266881943,
0.013896944932639599,
0.008285942487418652,
0.03395899012684822,
0.05986768379807472,
-0.050518136471509933,
0.060071490705013275,
-0.002420183038339019,
0.035640377551317215,
-0.007... | 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_pop(self):
self.session['some key'] = 'exists'
# Need to reset these to pretend we haven't accessed it:
self.accessed = False
self.modified = False
self.assertEqual(self.session.pop('some key'), 'exists')
self.assertTrue(self.session.accessed)
self.asser... | |
15,102 | [
0.01543903723359108,
-0.01973598636686802,
0.036773886531591415,
-0.0780445858836174,
0.04234493151307106,
0.04751626029610634,
0.02778027392923832,
0.03147764876484871,
0.04739134758710861,
-0.013977575115859509,
0.060307178646326065,
-0.029379138723015785,
-0.03180241957306862,
-0.007806... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "backend", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"... | class SessionTestsMixin(object):
# This does not inherit from TestCase to avoid any tests being run with this
# class, which wouldn't work, and to allow different TestCase subclasses to
# be used.
backend = None # subclasses must specify
def setUp(self):
self.session = self.backend()
... | |
15,103 | [
0.04600466787815094,
-0.007977943867444992,
0.023559965193271637,
-0.044357117265462875,
0.04831123724579811,
0.00016138861246872693,
-0.02566375955939293,
0.05454657971858978,
0.0430644229054451,
-0.016298072412610054,
0.01892147772014141,
-0.03396487608551979,
-0.009150239638984203,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_iterkeys(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
i = six.iterkeys(self.session)
self.assertTrue(hasattr(i, '__iter__'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
... | |
15,104 | [
0.0025419415906071663,
-0.009791680611670017,
0.03825336694717407,
-0.057433780282735825,
0.05662787705659866,
0.007743352092802525,
-0.003032197244465351,
0.01134975254535675,
0.08875641226768494,
-0.005221557803452015,
0.053323689848184586,
-0.01828048937022686,
-0.018481964245438576,
-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_itervalues(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
i = six.itervalues(self.session)
self.assertTrue(hasattr(i, '__iter__'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
... | |
15,105 | [
0.025090107694268227,
-0.020198803395032883,
0.013799559324979782,
-0.03773653507232666,
0.05094052106142044,
0.028663547709584236,
-0.026737438514828682,
0.02250506728887558,
0.07425658404827118,
-0.014547194354236126,
0.0648287832736969,
0.0024614916183054447,
-0.022340333089232445,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_clear(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
self.assertEqual(list(self.session.items()), [('x', 1)])
self.session.clear()
self.assertEqual(list(self.session.items()), [])
self.assertTrue(self.session.acce... | |
15,106 | [
0.027718035504221916,
-0.007310106884688139,
0.004468746017664671,
-0.03994967043399811,
0.05338871851563454,
-0.014082127250730991,
-0.029975375160574913,
0.03595995157957077,
0.0601082406938076,
-0.014751454815268517,
0.028557976707816124,
-0.02853172831237316,
-0.0014165793545544147,
-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_iteritems(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
i = six.iteritems(self.session)
self.assertTrue(hasattr(i, '__iter__'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
... | |
15,107 | [
0.050972215831279755,
-0.03490383177995682,
0.03453974425792694,
-0.07092420011758804,
0.03487956151366234,
0.046384718269109726,
0.025049204006791115,
0.041870035231113434,
0.05704033747315407,
-0.014150858856737614,
0.028544440865516663,
-0.053011104464530945,
-0.036044638603925705,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cycle(self):
self.session['a'], self.session['b'] = 'c', 'd'
self.session.save()
prev_key = self.session.session_key
prev_data = list(self.session.items())
self.session.cycle_key()
self.assertNotEqual(self.session.session_key, prev_key)
self.assertEqual(l... | |
15,108 | [
0.02076985500752926,
-0.014360595494508743,
-0.008999466896057129,
-0.04305769130587578,
0.05108131468296051,
0.027901962399482727,
0.01636047661304474,
0.04062410071492195,
0.06549009680747986,
-0.03727490082383156,
0.05570754408836365,
0.011095728725194931,
0.0006833179504610598,
0.00566... | 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_flush(self):
self.session['foo'] = 'bar'
self.session.save()
prev_key = self.session.session_key
self.session.flush()
self.assertFalse(self.session.exists(prev_key))
self.assertNotEqual(self.session.session_key, prev_key)
self.assertTrue(self.session.modi... | |
15,109 | [
0.051654212176799774,
-0.027148067951202393,
0.06919113546609879,
-0.025895431637763977,
0.04381953179836273,
0.015999596565961838,
0.011205410584807396,
0.06550154834985733,
0.04343235492706299,
-0.008261713199317455,
0.026328159496188164,
-0.02648758701980114,
-0.0392644889652729,
0.0265... | 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_invalid_key(self):
# Submitting an invalid session key (either by guessing, or if the db has
# removed the key) results in a new key being generated.
try:
session = self.backend('1')
try:
session.save()
except AttributeError:
... | |
15,110 | [
0.0190587155520916,
-0.01835283637046814,
0.06461679935455322,
-0.020401041954755783,
0.04924948140978813,
0.015413605608046055,
0.026939095929265022,
0.026545654982328415,
0.0664219930768013,
0.01719565875828266,
0.03920517861843109,
-0.04043178632855415,
-0.039320897310972214,
-0.0034628... | 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_default_expiry(self):
# A normal session has a max age equal to settings
self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)
# So does a custom session with an idle expiration time of 0 (but it'll
# expire at browser close)
self.session.set_expi... | |
15,111 | [
0.02867717482149601,
-0.01780080422759056,
0.06081656739115715,
-0.03940549120306969,
0.029269395396113396,
0.06291212141513824,
0.01311997789889574,
0.013154145330190659,
0.0636410042643547,
0.017766637727618217,
0.030476616695523262,
-0.04548714682459831,
-0.04357381537556648,
-0.0557143... | 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_custom_expiry_seconds(self):
modification = timezone.now()
self.session.set_expiry(10)
date = self.session.get_expiry_date(modification=modification)
self.assertEqual(date, modification + timedelta(seconds=10))
age = self.session.get_expiry_age(modification=modificati... | |
15,112 | [
0.03362050652503967,
-0.02276388369500637,
0.045084163546562195,
-0.026873057708144188,
0.021503115072846413,
0.045737896114587784,
0.01490742526948452,
0.013915153220295906,
0.06135742366313934,
0.007576287724077702,
0.0327799916267395,
-0.02416473813354969,
-0.03270994871854782,
-0.06355... | 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_custom_expiry_timedelta(self):
modification = timezone.now()
# Mock timezone.now, because set_expiry calls it on this code path.
original_now = timezone.now
try:
timezone.now = lambda: modification
self.session.set_expiry(timedelta(seconds=10))
f... | |
15,113 | [
-0.014217385090887547,
-0.006302552297711372,
0.05916957929730415,
-0.055020492523908615,
-0.000016328483980032615,
0.016032610088586807,
0.04563995078206062,
-0.008952104486525059,
0.06467162817716599,
0.03077990561723709,
0.027758289128541946,
-0.03528978303074837,
-0.029810283333063126,
... | 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_get_expire_at_browser_close(self):
# Tests get_expire_at_browser_close with different settings and different
# set_expiry calls
with override_settings(SESSION_EXPIRE_AT_BROWSER_CLOSE=False):
self.session.set_expiry(10)
self.assertFalse(self.session.get_expire_at_... | |
15,114 | [
0.03395920619368553,
-0.01887505315244198,
0.06292441487312317,
-0.03990660607814789,
0.02306320331990719,
0.0555696114897728,
0.02245030365884304,
0.020157603546977043,
0.0602458119392395,
0.006236826069653034,
0.02250705473124981,
-0.02994130551815033,
-0.04142750799655914,
-0.0728216096... | 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_custom_expiry_datetime(self):
modification = timezone.now()
self.session.set_expiry(modification + timedelta(seconds=10))
date = self.session.get_expiry_date(modification=modification)
self.assertEqual(date, modification + timedelta(seconds=10))
age = self.session.get... | |
15,115 | [
0.005404800642281771,
-0.013667311519384384,
0.044781699776649475,
-0.06973598897457123,
0.031807560473680496,
0.01630922220647335,
0.02269166149199009,
0.038137685507535934,
0.04412776231765747,
0.0009866295149549842,
0.061103999614715576,
-0.03128441050648689,
-0.02299247309565544,
-0.02... | 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_actual_expiry(self):
# Regression test for #19200
old_session_key = None
new_session_key = None
try:
self.session['foo'] = 'bar'
self.session.set_expiry(-timedelta(seconds=10))
self.session.save()
old_session_key = self.session.ses... | |
15,116 | [
0.020568624138832092,
-0.04168881103396416,
0.060212064534425735,
-0.062372345477342606,
0.016604280099272728,
0.03929871320724487,
0.018235981464385986,
0.023877989500761032,
0.022131381556391716,
-0.030910391360521317,
0.0092328991740942,
-0.024866202846169472,
0.007170291617512703,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "CacheDBSession", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "backend", "ctx": {"_type": "Store", "_fields": {}... | class CacheDBSessionTests(SessionTestsMixin, TestCase):
backend = CacheDBSession
@unittest.skipIf('DummyCache' in
settings.CACHES[settings.SESSION_CACHE_ALIAS]['BACKEND'],
"Session saving tests require a real cache backend")
def test_exists_searches_cache_first(self):
self.session.... | |
15,117 | [
0.01540863886475563,
-0.021910032257437706,
0.048340827226638794,
-0.046908508986234665,
0.03826982155442238,
0.007004944141954184,
0.04614758491516113,
0.0167626291513443,
0.014054648578166962,
0.0096066202968359,
0.036255620419979095,
-0.00021313465549610555,
0.01657239906489849,
-0.0311... | 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):
# Do file session tests in an isolated directory, and kill it after we're done.
self.original_session_file_path = settings.SESSION_FILE_PATH
self.temp_session_store = settings.SESSION_FILE_PATH = tempfile.mkdtemp()
# Reset the file session backend's internal caches
... | |
15,118 | [
0.008902624249458313,
-0.0324796698987484,
0.014738316647708416,
-0.059805192053318024,
0.025941140949726105,
0.03699487820267677,
0.02645229548215866,
0.0004928524140268564,
0.016591254621744156,
-0.015973608940839767,
-0.005596087779849768,
-0.029625719413161278,
-0.02021194063127041,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "CacheSession", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "backend", "ctx": {"_type": "Store", "_fields": {}}}... | class CacheSessionTests(SessionTestsMixin, unittest.TestCase):
backend = CacheSession
def test_load_overlong_key(self):
# Some backends might issue a warning
with warnings.catch_warnings():
warnings.simplefilter("ignore")
self.session._session_key = (string.ascii_letter... | |
15,119 | [
0.009145116433501244,
-0.06005748361349106,
-0.016356565058231354,
-0.01429777592420578,
0.04072079434990883,
0.007717614062130451,
-0.014366022311151028,
0.08021313697099686,
0.05605364963412285,
-0.024364229291677475,
0.04194924235343933,
-0.022498806938529015,
-0.022407811135053635,
-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_secure_session_cookie(self):
request = RequestFactory().get('/')
response = HttpResponse('Session test')
middleware = SessionMiddleware()
# Simulate a request the modifies the session
middleware.process_request(request)
request.session['hello'] = 'world'
... | |
15,120 | [
-0.002070048125460744,
-0.057265978306531906,
0.01889777183532715,
-0.028048641979694366,
0.04298454523086548,
0.015391692519187927,
0.0035382192581892014,
0.044877827167510986,
0.04179247468709946,
-0.01481903251260519,
0.02741754800081253,
-0.03442970663309097,
-0.04784630984067917,
0.02... | 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 SessionMiddlewareTests(unittest.TestCase):
@override_settings(SESSION_COOKIE_SECURE=True)
def test_secure_session_cookie(self):
request = RequestFactory().get('/')
response = HttpResponse('Session test')
middleware = SessionMiddleware()
# Simulate a request the modifies t... | |
15,121 | [
0.0037539354525506496,
-0.07797563821077347,
-0.014895036816596985,
-0.033652644604444504,
0.048764947801828384,
-0.005368369165807962,
-0.005105834919959307,
0.056876346468925476,
0.056779783219099045,
-0.013518995605409145,
0.06991252303123474,
-0.016693545505404472,
-0.015486492775380611,... | 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_no_httponly_session_cookie(self):
request = RequestFactory().get('/')
response = HttpResponse('Session test')
middleware = SessionMiddleware()
# Simulate a request the modifies the session
middleware.process_request(request)
request.session['hello'] = 'world'
... | |
15,122 | [
-0.007644025143235922,
-0.08687306940555573,
-0.013689377345144749,
-0.03232872113585472,
0.04587599262595177,
-0.001640120055526495,
-0.011966363526880741,
0.07299422472715378,
0.06442059576511383,
-0.013949901796877384,
0.07792050391435623,
-0.010432821698486805,
-0.0237314123660326,
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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_httponly_session_cookie(self):
request = RequestFactory().get('/')
response = HttpResponse('Session test')
middleware = SessionMiddleware()
# Simulate a request the modifies the session
middleware.process_request(request)
request.session['hello'] = 'world'
... | |
15,123 | [
0.03661772236227989,
-0.025241583585739136,
-0.010361745022237301,
-0.02676006220281124,
0.01723845861852169,
0.007106974720954895,
-0.025341156870126724,
0.03455159813165665,
0.0698997750878334,
-0.03208718076348305,
0.058249808847904205,
-0.04087444022297859,
-0.032833974808454514,
-0.02... | 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_session_save_on_500(self):
request = RequestFactory().get('/')
response = HttpResponse('Horrible error')
response.status_code = 500
middleware = SessionMiddleware()
# Simulate a request the modifies the session
middleware.process_request(request)
request... | |
15,124 | [
-0.05661866068840027,
0.03286193311214447,
0.06932897120714188,
-0.04765211418271065,
-0.009203420951962471,
0.010699771344661713,
0.0006589863332919776,
-0.009902488440275192,
0.007366203237324953,
-0.004564157221466303,
0.009370965883135796,
-0.004122185055166483,
0.014397316612303257,
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 TestSubProcessBase(base.BaseTestCase):
def setUp(self):
super(TestSubProcessBase, self).setUp()
self.execute_p = mock.patch('neutron.agent.common.utils.execute')
self.execute = self.execute_p.start()
def test_execute_wrapper(self):
ip_lib.SubProcessBase._execute(['o'], 'li... | |
15,125 | [
-0.027561336755752563,
-0.004119540564715862,
0.01992626115679741,
-0.02484038844704628,
0.007840320467948914,
0.011646131053566933,
-0.053152333945035934,
-0.039664868265390396,
0.03567727282643318,
0.01956268586218357,
0.010637503117322922,
0.00998658686876297,
-0.007805136032402515,
0.0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestIpWrapper(base.BaseTestCase):
def setUp(self):
super(TestIpWrapper, self).setUp()
self.execute_p = mock.patch.object(ip_lib.IPWrapper, '_execute')
self.execute = self.execute_p.start()
@mock.patch('os.path.islink')
@mock.patch('os.listdir', return_value=['lo'])
def tes... | |
15,126 | [
0.010373016819357872,
0.004075964447110891,
-0.01750669814646244,
-0.03182169795036316,
0.004534473177045584,
-0.015613117255270481,
-0.06735910475254059,
-0.05040023848414421,
0.032988812774419785,
0.014553187415003777,
0.013612351380288601,
-0.009706094861030579,
0.008336523547768593,
-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": "mocked_execute", "annotation": null, "type_comment": null}}], "kw... | def test_get_devices_namespaces(self, mocked_execute):
fake_str = mock.Mock()
fake_str.split.return_value = ['lo']
mocked_execute.return_value = fake_str
retval = ip_lib.IPWrapper(namespace='foo').get_devices()
mocked_execute.assert_called_once_with(
['ip', 'netns... | |
15,127 | [
-0.025680555030703545,
0.0003113457059953362,
0.013754216954112053,
-0.035700034350156784,
-0.02800489403307438,
0.018132096156477928,
-0.030577462166547775,
-0.014532756991684437,
0.02484559826552868,
0.025906220078468323,
0.026696043089032173,
0.021900683641433716,
0.009607641957700253,
... | 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_add_veth_with_namespaces(self):
ns2 = 'ns2'
with mock.patch.object(ip_lib.IPWrapper, 'ensure_namespace') as en:
ip_lib.IPWrapper().add_veth('tap0', 'tap1', namespace2=ns2)
en.assert_has_calls([mock.call(ns2)])
self.execute.assert_called_once_with([], 'link',
... | |
15,128 | [
0.004915543366223574,
-0.004952090326696634,
0.049411263316869736,
-0.0399334616959095,
-0.001331673702225089,
-0.013010658323764801,
-0.05321212857961655,
-0.018626682460308075,
0.03328194469213486,
0.041346605867147446,
-0.00753473024815321,
0.012054350227117538,
0.04149278998374939,
-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_get_namespaces(self):
self.execute.return_value = '\n'.join(NETNS_SAMPLE)
retval = ip_lib.IPWrapper.get_namespaces()
self.assertEqual(retval,
['12345678-1234-5678-abcd-1234567890ab',
'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb',
... | |
15,129 | [
-0.020871872082352638,
0.031229069456458092,
0.011580679565668106,
-0.006208261474967003,
-0.0008729421533644199,
0.014657554216682911,
-0.033191487193107605,
-0.02517222985625267,
0.011193041689693928,
-0.01752849668264389,
0.04479639232158661,
-0.04038701206445694,
0.003927861340343952,
... | 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_garbage_collect_namespace_does_not_exist(self):
with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd_cls:
ip_ns_cmd_cls.return_value.exists.return_value = False
ip = ip_lib.IPWrapper(namespace='ns')
with mock.patch.object(ip, 'namespace_is_empty') as mock_is... | |
15,130 | [
-0.028038453310728073,
0.029813341796398163,
-0.007267451845109463,
-0.01880423165857792,
-0.004305305890738964,
0.011344900354743004,
-0.03799222409725189,
-0.05444592610001564,
0.0004182382544968277,
0.02225807122886181,
0.02940559759736061,
0.011806610971689224,
-0.0069856285117566586,
... | 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_ensure_namespace(self):
with mock.patch.object(ip_lib, 'IPDevice') as ip_dev:
ip = ip_lib.IPWrapper()
with mock.patch.object(ip.netns, 'exists') as ns_exists:
with mock.patch('neutron.agent.common.utils.execute'):
ns_exists.return_value = Fals... | |
15,131 | [
-0.004471843596547842,
0.024638738483190536,
0.007978317327797413,
-0.03044341504573822,
0.005624059587717056,
-0.0030533724930137396,
-0.011515932157635689,
-0.04656198248267174,
0.014835559763014317,
0.0005126582691445947,
0.030293937772512436,
-0.028026875108480453,
-0.012169891968369484,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_garbage_collect_namespace_existing_not_empty(self):
lo_device = mock.Mock()
lo_device.name = 'lo'
tap_device = mock.Mock()
tap_device.name = 'tap1'
with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd_cls:
ip_ns_cmd_cls.return_value.exists.return_va... | |
15,132 | [
-0.01795647293329239,
0.02826741524040699,
0.013572568073868752,
-0.009153592400252819,
0.01303480938076973,
0.010310943238437176,
-0.025882571935653687,
-0.029880691319704056,
0.01136892568320036,
0.01138646062463522,
0.04510160908102989,
-0.04215562343597412,
-0.013327069580554962,
-0.00... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_garbage_collect_namespace_existing_empty_ns(self):
with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd_cls:
ip_ns_cmd_cls.return_value.exists.return_value = True
ip = ip_lib.IPWrapper(namespace='ns')
with mock.patch.object(ip, 'namespace_is_empty') as moc... | |
15,133 | [
-0.006393601652234793,
-0.008508818224072456,
0.03859604150056839,
-0.03505824878811836,
0.0025401245802640915,
0.028963014483451843,
-0.05617844685912132,
-0.039874762296676636,
0.04795201122760773,
0.04311418533325195,
-0.02250547707080841,
0.030881095677614212,
-0.007235425990074873,
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_add_vxlan_valid_port_length(self):
retval = ip_lib.IPWrapper().add_vxlan('vxlan0', 'vni0',
group='group0',
dev='dev0', ttl='ttl0',
tos='tos0',
... | |
15,134 | [
-0.0096646249294281,
-0.020655978471040726,
0.027181757614016533,
-0.026059972122311592,
0.018660493195056915,
0.014809743501245975,
-0.03654436394572258,
-0.051213882863521576,
0.006488027051091194,
-0.021378668025135994,
-0.0031253627967089415,
-0.026771875098347664,
0.0036808631848543882,... | 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 TestIPDevice(base.BaseTestCase):
def test_eq_same_name(self):
dev1 = ip_lib.IPDevice('tap0')
dev2 = ip_lib.IPDevice('tap0')
self.assertEqual(dev1, dev2)
def test_eq_diff_name(self):
dev1 = ip_lib.IPDevice('tap0')
dev2 = ip_lib.IPDevice('tap1')
self.assertNo... | |
15,135 | [
-0.005844260565936565,
-0.015560979023575783,
0.01672983169555664,
-0.008974751457571983,
0.0011866389540955424,
0.005940817762166262,
-0.017085568979382515,
-0.0085936039686203,
0.00231610587798059,
-0.03915146365761757,
0.00034716178197413683,
-0.008166719228029251,
0.004113851115107536,
... | 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 TestIPDeviceCommandBase(base.BaseTestCase):
def setUp(self):
super(TestIPDeviceCommandBase, self).setUp()
self.ip_dev = mock.Mock()
self.ip_dev.name = 'eth0'
self.ip_dev._execute = mock.Mock(return_value='executed')
self.ip_cmd = ip_lib.IpDeviceCommandBase(self.ip_dev)
... | |
15,136 | [
-0.04920446500182152,
-0.006594241131097078,
0.053330715745687485,
-0.019777176901698112,
0.007664626929908991,
-0.006893727462738752,
-0.03476257622241974,
-0.017192723229527473,
-0.006999101955443621,
-0.009694477543234825,
-0.0020215315744280815,
-0.019533151760697365,
0.00334148900583386... | 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 TestIPCommandBase(base.BaseTestCase):
def setUp(self):
super(TestIPCommandBase, self).setUp()
self.ip = mock.Mock()
self.ip.namespace = 'namespace'
self.ip_cmd = ip_lib.IpCommandBase(self.ip)
self.ip_cmd.COMMAND = 'foo'
def test_run(self):
self.ip_cmd._run(... | |
15,137 | [
-0.015957869589328766,
-0.025766640901565552,
0.026979438960552216,
0.0015412642387673259,
-0.014979120343923569,
-0.02506449446082115,
0.005452272016555071,
-0.011830100789666176,
-0.010234314016997814,
-0.0011296841548755765,
-0.0001790273527149111,
-0.007239553611725569,
0.019330300390720... | 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 TestIPCmdBase(base.BaseTestCase):
def setUp(self):
super(TestIPCmdBase, self).setUp()
self.parent = mock.Mock()
self.parent.name = 'eth0'
def _assert_call(self, options, args):
self.parent.assert_has_calls([
mock.call._run(options, self.command, args)])
de... | |
15,138 | [
-0.002611687406897545,
-0.0003059664450120181,
0.04577998071908951,
-0.009924412705004215,
0.0006688821595162153,
0.012164659798145294,
-0.026325810700654984,
0.00029871176229789853,
-0.0057108900509774685,
0.020313125103712082,
0.029250899329781532,
-0.020394377410411835,
0.0257686506956815... | 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 TestIpRuleCommand(TestIPCmdBase):
def setUp(self):
super(TestIpRuleCommand, self).setUp()
self.parent._as_root.return_value = ''
self.command = 'rule'
self.rule_cmd = ip_lib.IpRuleCommand(self.parent)
def _test_add_rule(self, ip, table, priority):
ip_version = neta... | |
15,139 | [
-0.013788674026727676,
-0.034155867993831635,
0.004448247607797384,
-0.011852062307298183,
-0.004650847055017948,
-0.0033786422573029995,
-0.018591471016407013,
-0.0018651059363037348,
0.005422512535005808,
0.024645617231726646,
0.04371379315853119,
0.004841528832912445,
0.011631586588919163... | 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 TestIpLinkCommand(TestIPCmdBase):
def setUp(self):
super(TestIpLinkCommand, self).setUp()
self.parent._run.return_value = LINK_SAMPLE[1]
self.command = 'link'
self.link_cmd = ip_lib.IpLinkCommand(self.parent)
def test_set_address(self):
self.link_cmd.set_address('a... | |
15,140 | [
-0.01434502936899662,
-0.009483788162469864,
0.007224911358207464,
-0.02680378034710884,
0.014787489548325539,
0.0003580435586627573,
0.004939836449921131,
-0.033836569637060165,
0.028806496411561966,
0.04843776300549507,
0.04762270301580429,
0.00035131204640492797,
-0.01695321686565876,
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__parse_line(self):
def test(ip_version, line, expected):
actual = self.rule_cmd._parse_line(ip_version, line)
self.assertEqual(expected, actual)
test(4, "4030201:\tfrom 1.2.3.4/24 lookup 10203040",
{'from': '1.2.3.4/24',
'table': '10203040',
... | |
15,141 | [
-0.013799777254462242,
-0.008090605027973652,
0.03614764288067818,
-0.01319815218448639,
-0.020542992278933525,
-0.006436135619878769,
-0.03268830105662346,
0.004101704806089401,
0.01667002961039543,
0.03218694403767586,
0.04898231476545334,
-0.01077285036444664,
0.012314515188336372,
-0.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 TestIpAddrCommand(TestIPCmdBase):
def setUp(self):
super(TestIpAddrCommand, self).setUp()
self.parent.name = 'tap0'
self.command = 'addr'
self.addr_cmd = ip_lib.IpAddrCommand(self.parent)
def test_add_address(self):
self.addr_cmd.add('192.168.45.100/24')
se... | |
15,142 | [
-0.0043928539380431175,
-0.02986901067197323,
-0.0062866355292499065,
-0.012321566231548786,
-0.0017319710459560156,
0.018278587609529495,
0.006987814325839281,
0.003374047577381134,
0.01274107489734888,
0.04015296325087547,
0.03423190116882324,
-0.012465397827327251,
-0.018662137910723686,
... | 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_settings_property(self):
expected = {'mtu': 1500,
'qlen': 1000,
'state': 'UP',
'qdisc': 'mq',
'brd': 'ff:ff:ff:ff:ff:ff',
'link/ether': 'cc:dd:ee:ff:ab:cd',
'alias': 'openvswitch'}
... | |
15,143 | [
-0.005243041552603245,
-0.021183472126722336,
0.036371126770973206,
-0.030745090916752815,
-0.013602853752672672,
-0.019057201221585274,
-0.03843136131763458,
-0.018264802172780037,
0.01776294969022274,
0.06175431236624718,
0.026175588369369507,
-0.02605672925710678,
0.021341953426599503,
... | 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_list(self):
expected = [
dict(scope='global', dadfailed=False, tentative=False,
dynamic=False, cidr='172.16.77.240/24'),
dict(scope='global', dadfailed=False, tentative=False,
dynamic=True, cidr='2001:470:9:1224:5595:dd51:6ba2:e788/64'),
... | |
15,144 | [
0.0037241296377032995,
-0.005556448828428984,
0.04378529265522957,
0.008798702619969845,
-0.02853183075785637,
-0.008495299145579338,
-0.0013102868106216192,
0.026485342532396317,
0.010565581731498241,
0.03293415531516075,
0.05668291822075844,
-0.011225930415093899,
-0.031101835891604424,
... | 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_wait_until_address_ready_timeout(self):
tentative_address = 'fe80::3023:39ff:febc:22ae'
self.addr_cmd.list = mock.Mock(return_value=[
dict(scope='link', dadfailed=False, tentative=True, dynamic=False,
cidr=tentative_address + '/64')])
with testtools.Expected... | |
15,145 | [
-0.019950779154896736,
-0.05043989419937134,
0.016685696318745613,
-0.014771683141589165,
-0.012970258481800556,
-0.03873063251376152,
-0.00613047368824482,
0.009902207180857658,
-0.017552632838487625,
0.04715229198336601,
-0.003622552612796426,
-0.013566980138421059,
0.002274298807606101,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
super(TestIpRouteCommand, self).setUp()
self.parent.name = 'eth0'
self.command = 'route'
self.route_cmd = ip_lib.IpRouteCommand(self.parent)
self.ip_version = 4
self.table = 14
self.metric = 100
self.cidr = '192.168.45.100/24'
self... | |
15,146 | [
-0.03321203589439392,
-0.019506847485899925,
0.007694572675973177,
-0.0013920293422415853,
0.007842072285711765,
-0.0002260511100757867,
0.008622592315077782,
0.017982682213187218,
0.01473768800497055,
0.04262743890285492,
0.001940544112585485,
0.0063978033140301704,
-0.02046559564769268,
... | 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_pullup_route(self):
# NOTE(brian-haley) Currently we do not have any IPv6-specific usecase
# for pullup_route, hence skipping. Revisit, if required, in future.
if self.ip_version == 6:
return
# interface is not the first in the list - requires
# deleting and ... | |
15,147 | [
-0.029020613059401512,
-0.019021915271878242,
-0.004252495244145393,
-0.006566218566149473,
0.011157084256410599,
0.00048469300963915884,
0.006194315850734711,
0.014863919466733932,
0.019729139283299446,
0.025411326438188553,
0.008596442639827728,
-0.0031367868650704622,
-0.01152898743748664... | 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_pullup_route_first(self):
# NOTE(brian-haley) Currently we do not have any IPv6-specific usecase
# for pullup_route, hence skipping. Revisit, if required, in future.
if self.ip_version == 6:
return
# interface is first in the list - no changes
output = [DEVIC... | |
15,148 | [
-0.047085441648960114,
0.009782006032764912,
0.025336800143122673,
-0.03207375109195709,
0.011222152039408684,
0.018636461347341537,
-0.055067263543605804,
-0.009074138477444649,
0.003704103408381343,
0.025824984535574913,
0.029388735070824623,
-0.0027246824465692043,
0.019686058163642883,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestIpNetnsCommand(TestIPCmdBase):
def setUp(self):
super(TestIpNetnsCommand, self).setUp()
self.command = 'netns'
self.netns_cmd = ip_lib.IpNetnsCommand(self.parent)
def test_add_namespace(self):
with mock.patch('neutron.agent.common.utils.execute') as execute:
... | |
15,149 | [
-0.026881322264671326,
0.013948524370789528,
0.023940440267324448,
-0.034180380403995514,
0.0011581940343603492,
0.024590032175183296,
-0.048896607011556625,
-0.026456134393811226,
0.005601259879767895,
0.017338216304779053,
0.011072601191699505,
0.01200565230101347,
-0.005450672470033169,
... | 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_add_namespace(self):
with mock.patch('neutron.agent.common.utils.execute') as execute:
ns = self.netns_cmd.add('ns')
self._assert_sudo([], ('add', 'ns'), use_root_namespace=True)
self.assertEqual(ns.namespace, 'ns')
execute.assert_called_once_with(
... | |
15,150 | [
-0.042996764183044434,
0.0226949043571949,
0.046118125319480896,
-0.04596205800771713,
0.011809153482317924,
0.006353272590786219,
-0.038028594106435776,
-0.026531578972935677,
0.00935108121484518,
-0.00024385641154367477,
0.004695049021393061,
0.009116978384554386,
0.00829111784696579,
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_namespace_exists_use_helper(self):
self.config(group='AGENT', use_helper_for_ns_read=True)
retval = '\n'.join(NETNS_SAMPLE)
# need another instance to avoid mocking
netns_cmd = ip_lib.IpNetnsCommand(ip_lib.SubProcessBase())
with mock.patch('neutron.agent.common.utils.exe... | |
15,151 | [
-0.027974866330623627,
0.01845368556678295,
0.050933197140693665,
-0.033093780279159546,
-0.00009767927986104041,
0.028179623186588287,
-0.043843500316143036,
-0.027488568797707558,
-0.00719847297295928,
-0.013449947349727154,
0.005230890586972237,
-0.0014069016324356198,
0.00826704688370227... | 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_namespace_doest_not_exist_no_helper(self):
self.config(group='AGENT', use_helper_for_ns_read=False)
retval = '\n'.join(NETNS_SAMPLE)
# need another instance to avoid mocking
netns_cmd = ip_lib.IpNetnsCommand(ip_lib.SubProcessBase())
with mock.patch('neutron.agent.common.... | |
15,152 | [
-0.035996027290821075,
0.022587565705180168,
0.02119327150285244,
-0.04254920780658722,
0.011026542633771896,
-0.00028394217952154577,
-0.03706498444080353,
-0.00823795422911644,
0.011561022140085697,
0.024446623399853706,
0.05089173465967178,
0.00906291138380766,
0.00934177078306675,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_execute(self):
self.parent.namespace = 'ns'
with mock.patch('neutron.agent.common.utils.execute') as execute:
self.netns_cmd.execute(['ip', 'link', 'list'])
execute.assert_called_once_with(['ip', 'netns', 'exec', 'ns', 'ip',
'... | |
15,153 | [
-0.018503958359360695,
0.01934668980538845,
0.0174204483628273,
-0.036911606788635254,
0.011190259829163551,
0.008938965387642384,
-0.020394083112478256,
-0.027497099712491035,
-0.01371243316680193,
0.007337776944041252,
0.023138977587223053,
-0.006013485603034496,
0.0006399486446753144,
-... | 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_execute_env_var_prepend(self):
self.parent.namespace = 'ns'
with mock.patch('neutron.agent.common.utils.execute') as execute:
env = dict(FOO=1, BAR=2)
self.netns_cmd.execute(['ip', 'link', 'list'], env)
execute.assert_called_once_with(
['ip', ... | |
15,154 | [
-0.016812022775411606,
0.030016513541340828,
0.007995539344847202,
-0.041024111211299896,
0.007139906287193298,
0.010007431730628014,
-0.027403365820646286,
-0.010128838941454887,
0.008278822526335716,
-0.0031363556627184153,
0.023934585973620415,
0.011556820012629032,
0.029022129252552986,
... | 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_execute_nosudo_with_no_namespace(self):
with mock.patch('neutron.agent.common.utils.execute') as execute:
self.parent.namespace = None
self.netns_cmd.execute(['test'])
execute.assert_called_once_with(['test'],
check_exit_co... | |
15,155 | [
-0.0032302059698849916,
0.01627589575946331,
-0.0329861044883728,
-0.019967559725046158,
-0.002014128491282463,
-0.00549677899107337,
0.008436538279056549,
-0.01167217269539833,
0.016775354743003845,
0.012019623070955276,
0.04173751920461655,
-0.0022462145425379276,
-0.02666684240102768,
-... | 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_ensure_device_is_ready(self):
ip_lib_mock = mock.Mock()
with mock.patch.object(ip_lib, 'IPDevice', return_value=ip_lib_mock):
self.assertTrue(ip_lib.ensure_device_is_ready("eth0"))
self.assertTrue(ip_lib_mock.link.set_up.called)
ip_lib_mock.reset_mock()
... | |
15,156 | [
-0.02628687582910061,
0.002014386234804988,
0.021185006946325302,
-0.04950623959302902,
-0.00952739454805851,
-0.00602318812161684,
-0.013143437914550304,
-0.03604326769709587,
0.014283103868365288,
-0.007599548436701298,
0.002413801848888397,
0.017702102661132812,
0.019597994163632393,
-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 TestDeviceExists(base.BaseTestCase):
def test_device_exists(self):
with mock.patch.object(ip_lib.IPDevice, '_execute') as _execute:
_execute.return_value = LINK_SAMPLE[1]
self.assertTrue(ip_lib.device_exists('eth0'))
_execute.assert_called_once_with(['o'], 'link', (... | |
15,157 | [
-0.0035401894710958004,
-0.03528622165322304,
0.05001925304532051,
-0.021734267473220825,
-0.005424434784799814,
-0.029782641679048538,
-0.005354422144591808,
0.018203210085630417,
0.012784862890839577,
0.030367093160748482,
0.03984006866812706,
-0.020894117653369904,
0.01406334899365902,
... | 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 TestIpNeighCommand(TestIPCmdBase):
def setUp(self):
super(TestIpNeighCommand, self).setUp()
self.parent.name = 'tap0'
self.command = 'neigh'
self.neigh_cmd = ip_lib.IpNeighCommand(self.parent)
def test_add_entry(self):
self.neigh_cmd.add('192.168.45.100', 'cc:dd:ee... | |
15,158 | [
-0.021145198494195938,
-0.006927461363375187,
0.022063568234443665,
0.011621355079114437,
0.011269880458712578,
-0.000982146244496107,
-0.019523877650499344,
-0.04614528268575668,
0.009744931943714619,
-0.006088456604629755,
0.0021683748345822096,
0.0027210977859795094,
0.013049931265413761,... | 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": "spawn_n", "annotation"... | class TestArpPing(TestIPCmdBase):
@mock.patch.object(ip_lib, 'IPWrapper')
@mock.patch('eventlet.spawn_n')
def test_send_ipv4_addr_adv_notif(self, spawn_n, mIPWrapper):
spawn_n.side_effect = lambda f: f()
ARPING_COUNT = 3
address = '20.0.0.1'
config = mock.Mock()
confi... | |
15,159 | [
-0.0016496500466018915,
-0.007371683605015278,
0.03433220088481903,
0.009386569261550903,
-0.010908386670053005,
-0.03355303034186363,
-0.007310810964554548,
-0.039591602981090546,
0.038155004382133484,
-0.001285935752093792,
-0.0012136494042351842,
0.02327771857380867,
0.0004173584165982902... | 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": "spawn_n", "annotation": null, "type_comment": null}}, {"_type": "... | def test_send_ipv4_addr_adv_notif(self, spawn_n, mIPWrapper):
spawn_n.side_effect = lambda f: f()
ARPING_COUNT = 3
address = '20.0.0.1'
config = mock.Mock()
config.send_arp_for_ha = ARPING_COUNT
ip_lib.send_ip_addr_adv_notif(mock.sentinel.ns_name,
... | |
15,160 | [
0.002983624814078212,
-0.023985205218195915,
0.037023674696683884,
-0.013270883820950985,
-0.006670304108411074,
-0.04690130427479744,
0.02844756841659546,
-0.04685482010245323,
0.01549044530838728,
-0.023415789008140564,
-0.01501399464905262,
0.022509371861815453,
-0.007721981033682823,
-... | 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": "spawn_n", "annotation": null, "type_comment": null}}], "kwarg": n... | def test_no_ipv6_addr_notif(self, spawn_n):
ipv6_addr = 'fd00::1'
config = mock.Mock()
config.send_arp_for_ha = 3
ip_lib.send_ip_addr_adv_notif(mock.sentinel.ns_name,
mock.sentinel.iface_name,
ipv6_addr,
... | |
15,161 | [
0.005081898998469114,
0.002068511676043272,
-0.012040780857205391,
0.01094906684011221,
0.0028553761076182127,
-0.005037209019064903,
-0.011121442541480064,
0.0424172580242157,
0.04103824868798256,
0.05567105486989021,
-0.0029240071307867765,
-0.035011474043130875,
0.03950601816177368,
-0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "user", "annotation": null, "type_comment": null}}], "kwarg": n... | def dashboard_mozillians(request, user):
args = {}
user_profile = user.userprofile
interestform = forms.TrackFunctionalAreasForm(request.POST or None,
instance=user_profile)
reps_email_form = forms.EmailRepsForm(request.POST or None)
if interestform.... | |
15,162 | [
-0.0017381246434524655,
-0.014518927782773972,
0.04868364706635475,
-0.014486615546047688,
0.006209318991750479,
0.0313858725130558,
-0.06686461716890335,
-0.016597677022218704,
0.004949145019054413,
0.0290593970566988,
-0.015466751530766487,
0.0021299095824360847,
0.0037132049910724163,
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 TestAddNamespaceToCmd(base.BaseTestCase):
def test_add_namespace_to_cmd_with_namespace(self):
cmd = ['ping', '8.8.8.8']
self.assertEqual(['ip', 'netns', 'exec', 'tmp'] + cmd,
ip_lib.add_namespace_to_cmd(cmd, 'tmp'))
def test_add_namespace_to_cmd_without_namespace(... | |
15,163 | [
-0.017816824838519096,
-0.0005341207724995911,
0.04261292889714241,
0.008251032792031765,
-0.004552505910396576,
-0.02366565726697445,
-0.023419909179210663,
0.05023115873336792,
0.01022317074239254,
0.03538789972662926,
0.018578646704554558,
-0.06905555725097656,
-0.02343219704926014,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def kpi(request):
countries = product_details.get_regions('en').values()
countries.sort()
categories = FunctionalArea.active_objects.all()
initiatives = Campaign.active_objects.all()
reps = (User.objects
.filter(userprofile__registration_complete=True,
groups__name... | |
15,164 | [
-0.007984552532434464,
0.02949022315442562,
-0.0460541658103466,
-0.013109307736158371,
0.01937798224389553,
-0.03919065371155739,
-0.05564020201563835,
0.024273954331874847,
0.01242295652627945,
0.01330377347767353,
0.020373191684484482,
-0.05948377028107643,
-0.010918703861534595,
-0.042... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def list_action_items(request):
user = request.user
action_items = ActionItem.objects.filter(user=user,
resolved=False)
pageheader = 'My Action Items'
if 'query' in request.GET:
query = request.GET['query'].strip()
reversed_priority = dict((v... | |
15,165 | [
-0.019428784027695656,
-0.022593826055526733,
0.018284792080521584,
0.013584895059466362,
-0.018847255036234856,
-0.016940603032708168,
-0.015138816088438034,
0.00480476301163435,
0.0017481615068390965,
0.03405280411243439,
-0.046369776129722595,
-0.020610908046364784,
0.01849452406167984,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vpn_connection_id", "annotation": null, "type_comment": nul... | def add_routes(connection, vpn_connection_id, routes_to_add):
for route in routes_to_add:
try:
connection.create_vpn_connection_route(VpnConnectionId=vpn_connection_id,
DestinationCidrBlock=route)
except (BotoCoreError, ClientError) as e... | |
15,166 | [
0.008764226920902729,
-0.015008983202278614,
0.007778986357152462,
-0.0010869504185393453,
-0.028429817408323288,
0.010724904015660286,
-0.0345863439142704,
0.030115999281406403,
0.018087245523929596,
0.042781975120306015,
-0.00707804411649704,
-0.04866400361061096,
0.013960020616650581,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vpn_connection_id", "annotation": null, "type_comment": nul... | def remove_routes(connection, vpn_connection_id, routes_to_remove):
for route in routes_to_remove:
try:
connection.delete_vpn_connection_route(VpnConnectionId=vpn_connection_id,
DestinationCidrBlock=route)
except (BotoCoreError, ClientEr... | |
15,167 | [
-0.008881434798240662,
0.0053454176522791386,
0.0012683541281148791,
-0.006794120650738478,
-0.015409467741847038,
0.05160929635167122,
-0.0007232427014969289,
0.02757856994867325,
0.04862910881638527,
0.08751347661018372,
0.02006896771490574,
-0.07407897710800171,
0.03765444830060005,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
argument_spec = dict(
state=dict(type='str', default='present', choices=['present', 'absent']),
filters=dict(type='dict', default={}),
vpn_gateway_id=dict(type='str'),
tags=dict(default={}, type='dict'),
connection_type=dict(default='ipsec.1', type='str'),
... | |
15,168 | [
0.007893534377217293,
-0.0160199161618948,
-0.024924008175730705,
-0.009677146561443806,
-0.03367907926440239,
0.0025147541891783476,
-0.029040753841400146,
0.01534000039100647,
0.033381033688783646,
0.016345901414752007,
-0.004682565573602915,
-0.0109065817669034,
0.022837692871689796,
0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vpn_connection_id", "annotation": null, "type_comment": nul... | def remove_tags(connection, vpn_connection_id, remove):
# format tags since they are a list in the format ['tag1', 'tag2', 'tag3']
key_dict_list = [{'Key': tag} for tag in remove]
try:
connection.delete_tags(Resources=[vpn_connection_id],
Tags=key_dict_list)
except... | |
15,169 | [
-0.0008731989073567092,
-0.010865121148526669,
0.0508175864815712,
-0.07142721116542816,
-0.02380095049738884,
0.006075088866055012,
0.008489898405969143,
-0.05359477177262306,
-0.006888146046549082,
0.05534878000617027,
0.023362448439002037,
-0.025335710495710373,
-0.0026523321866989136,
... | 15 | {"_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": "output", "annotation":... | class Coverage():
def __init__(self, output, enabled, is_single_file):
self.output = output
self.enabled = enabled
self.is_single_file = is_single_file
self.tests_info = {}
def on_test_start(self, test, data):
settings = data.settings()
color_scheme = settings.g... | |
15,170 | [
0.006545688956975937,
-0.02839905582368374,
0.06214330717921257,
-0.0314193069934845,
0.0013172859326004982,
-0.03365733474493027,
0.05697194114327431,
-0.014405948109924793,
-0.017665212973952293,
0.016274593770503998,
0.00044101919047534466,
0.003536301665008068,
0.04163166880607605,
-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": "test", "annotation": null, "type_comment": null}}, {"_type": "arg... | def on_test_start(self, test, data):
settings = data.settings()
color_scheme = settings.get('color_scheme')
syntax = settings.get('syntax')
self.tests_info[test] = {
'color_scheme': color_scheme,
'syntax': syntax
} | |
15,171 | [
0.025248968973755836,
0.012166660279035568,
0.039533063769340515,
-0.019571956247091293,
-0.022502027451992035,
0.0203731469810009,
0.050681065768003464,
0.003161843866109848,
-0.04335588961839676,
0.03799935430288315,
-0.003965896554291248,
-0.02194119244813919,
-0.02575257420539856,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def main():
director.init()
bg_layer = cocos.layer.ColorLayer(255,0,0,255)
translate_layer = cocos.layer.Layer()
x, y = director.get_window_size()
sub = cocos.scene.Scene( bg_layer )
sub.transform_anchor = (0, 0)
sub.scale = 0.5
sub.do( MoveBy( (x//2, y//2), 2) )
sub.do( ScaleBy... | |
15,172 | [
0.003774879267439246,
-0.003513162489980459,
0.07049725949764252,
-0.07724647223949432,
-0.03793353587388992,
0.00434449827298522,
0.013449162244796753,
-0.04534781724214554,
-0.013904857449233532,
0.06123556196689606,
0.007679077330976725,
-0.02896742708981037,
-0.0047232178039848804,
-0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def on_tests_end(self):
if not self.enabled:
return
cs_tested_syntaxes = {} # type: dict
for test, info in self.tests_info.items():
cs = info['color_scheme']
s = info['syntax']
if cs not in cs_tested_syntaxes:
cs_tested_syntaxes[c... | |
15,173 | [
0.0028934970032423735,
0.00020594216766767204,
0.05047358199954033,
-0.031100129708647728,
0.0017849593423306942,
-0.02980531007051468,
-0.003994400147348642,
0.005252575036138296,
-0.019141361117362976,
0.007384143304079771,
0.034227244555950165,
-0.006767271086573601,
-0.012740547768771648... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "output_file_url", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "selenium", "annotation": null, "type_comment": null}}]... | def test_select_rectangle_glyph(output_file_url, selenium):
save(make_plot('tap'))
selenium.get(output_file_url)
canvas = selenium.find_element_by_tag_name('canvas')
wait = WebDriverWait(selenium, 10)
# Initial plot
wait.until(value_to_be_present_in_datahash(canvas, '0c2cc32a505f9b16f1dc87bf8e... | |
15,174 | [
-0.033832188695669174,
0.01470633503049612,
-0.03792514652013779,
0.04092954844236374,
-0.019354451447725296,
0.010139860212802887,
0.03533439338207245,
-0.03254770115017891,
-0.006917746737599373,
0.06243933364748955,
0.0035241865552961826,
-0.01451039593666792,
0.03681482374668121,
-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": "name", "annotation": null, "type_comment": null}}], "kwarg": null... | def __init__(self, name='wrappoly2d'):
self._actual = Polynomial2D(degree=2)
self.c0_0 = model.Parameter(name, 'c0_0', 0)
self.c1_0 = model.Parameter(name, 'c1_0', 0)
self.c2_0 = model.Parameter(name, 'c2_0', 0)
self.c0_1 = model.Parameter(name, 'c0_1', 0)
self.c0_2 = mod... | |
15,175 | [
0.008319058455526829,
0.002558075124397874,
0.014094214886426926,
-0.03948364034295082,
-0.012209316715598106,
-0.00846078060567379,
0.015135868452489376,
-0.04452893137931824,
0.01269825641065836,
0.013158852234482765,
0.07125762850046158,
-0.018041161820292473,
-0.008800912648439407,
0.0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class Payload:
def __init__(self):
# required options
self.description = "pure windows/meterpreter/reverse_tcp stager, no shellcode"
self.language = "c"
self.extension = "c"
self.rating = "Excellent"
# optional
# options we require user ineraction for- forma... | |
15,176 | [
-0.0048968978226184845,
-0.0037047958467155695,
0.00907996203750372,
-0.03146577998995781,
-0.0037333492655307055,
-0.011828221380710602,
0.007248979527503252,
-0.04631351679563522,
-0.0015213576843962073,
0.013184504583477974,
0.06607242673635483,
-0.011428474448621273,
-0.01385550852864980... | 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 generate(self):
winsock_init_name = helpers.randomString()
punt_name = helpers.randomString()
recv_all_name = helpers.randomString()
wsconnect_name = helpers.randomString()
# the real includes needed
includes = [ "#include <stdio.h>" , "#include <stdlib.h>", "#inclu... | |
15,177 | [
0.029382625594735146,
-0.02158723585307598,
-0.02506517805159092,
-0.018840858712792397,
0.02039993740618229,
-0.008658879436552525,
-0.033220358192920685,
0.013000313192605972,
0.04118364676833153,
-0.0031781208235770464,
-0.0028588096611201763,
-0.0376097597181797,
0.010709667578339577,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}},... | def wrapped_f(request, *args, **kwargs):
secret_id = request.GET.get("secret_id")
if not secret_id and request.user.is_authenticated:
return f(request, *args, **kwargs)
if not param_tools.get_global_parameter("self_service"):
return redirect_to_login(
... | |
15,178 | [
0.0433700866997242,
-0.011890612542629242,
-0.02731163240969181,
-0.038564808666706085,
0.01746816746890545,
-0.012387075461447239,
-0.04138423502445221,
-0.009291838854551315,
0.031087208539247513,
0.013864208944141865,
0.019552089273929596,
-0.045355942100286484,
-0.006021921057254076,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def decorator(f):
@wraps(f)
def wrapped_f(request, *args, **kwargs):
secret_id = request.GET.get("secret_id")
if not secret_id and request.user.is_authenticated:
return f(request, *args, **kwargs)
if not param_tools.get_global_parameter("self_service")... | |
15,179 | [
0.02559749409556389,
0.03236572444438934,
-0.01928594335913658,
0.02714318037033081,
-0.007997753098607063,
-0.016077473759651184,
-0.019180556759238243,
-0.02166302129626274,
-0.007693300023674965,
0.0541926808655262,
0.03601916506886482,
-0.042693715542554855,
0.02454361692070961,
-0.010... | 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": "users", "annotation": ... | class playerAvatar(QtGui.QDialog):
def __init__(self, users = [], idavatar = 0, parent=None, *args, **kwargs):
QtGui.QDialog.__init__(self, *args, **kwargs)
self.parent = parent
self.users = users
self.checkBox = {}
self.idavatar = idavatar
self.setS... | |
15,180 | [
0.02273165062069893,
-0.014250334352254868,
0.0724140852689743,
-0.006920668296515942,
-0.054848719388246536,
-0.026283470913767815,
-0.05975668877363205,
-0.006527815479785204,
-0.0207620058208704,
0.04247116297483444,
0.003089007455855608,
-0.042212847620248795,
0.06005805358290672,
0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "address", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "exact_extension", "annotation": null, "type_comment": null}}, ... | def make_query_args(address, exact_extension=True, wildcard=None,
domain_search=False):
assert isinstance(address, str), "address should be of type str"
conf = dict(param_tools.get_global_parameters("modoboa_amavis"))
local_part, domain = split_address(address)
if not conf["localpart... | |
15,181 | [
0.028032569214701653,
0.041235003620386124,
-0.026495298370718956,
0.04697715863585472,
0.00038643687730655074,
-0.02990894205868244,
-0.016276976093649864,
0.01314591895788908,
-0.01648043841123581,
0.050051700323820114,
0.02529713325202465,
-0.024822387844324112,
0.04073765128850937,
-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": "users", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, users = [], idavatar = 0, parent=None, *args, **kwargs):
QtGui.QDialog.__init__(self, *args, **kwargs)
self.parent = parent
self.users = users
self.checkBox = {}
self.idavatar = idavatar
self.setStyleSheet(self.parent.styleSheet())
... | |
15,182 | [
0.06208052113652229,
0.016533000394701958,
-0.00451307650655508,
0.041126761585474014,
-0.01777798682451248,
-0.006995136849582195,
0.0022895094007253647,
0.0031309304758906364,
-0.012798041105270386,
0.018674800172448158,
-0.006689165718853474,
-0.03431098908185959,
0.03671655431389809,
-... | 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 createUserSelection(self):
groupBox = QtGui.QGroupBox("Select the users you want to remove this avatar :")
vbox = QtGui.QVBoxLayout()
for user in self.users :
self.checkBox[user["iduser"]] = QtGui.QCheckBox(user["login"])
vbox.addWidget(self.checkBox[user["id... | |
15,183 | [
0.011588658206164837,
0.031052380800247192,
0.0006636419566348195,
-0.00487370602786541,
-0.006556331645697355,
-0.029559476301074028,
0.0036545018665492535,
-0.027967046946287155,
-0.013572975061833858,
0.06086067482829094,
0.008167422376573086,
-0.019756080582737923,
0.003103993833065033,
... | 15 | {"_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": "parent", "annotation":... | class avatarWidget(QtGui.QDialog):
def __init__(self, parent, user, personal = False, *args, **kwargs):
QtGui.QDialog.__init__(self, *args, **kwargs)
self.user = user
self.personal = personal
self.parent = parent
self.setStyleSheet(self.parent.styleSheet())... | |
15,184 | [
0.015774523839354515,
0.055797088891267776,
-0.014130588620901108,
0.02818865142762661,
0.0026381532661616802,
-0.035296253859996796,
0.008026271127164364,
-0.010419647209346294,
-0.00984547846019268,
0.058553099632263184,
0.00346012064255774,
-0.01200918760150671,
0.026858998462557793,
-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": "parent", "annotation": null, "type_comment": null}}, {"_type": "a... | def __init__(self, parent, user, personal = False, *args, **kwargs):
QtGui.QDialog.__init__(self, *args, **kwargs)
self.user = user
self.personal = personal
self.parent = parent
self.setStyleSheet(self.parent.styleSheet())
self.setWindowTitle ( "Avatar ... | |
15,185 | [
0.0339580662548542,
0.011119525879621506,
-0.007251864764839411,
0.01659226603806019,
-0.007110050413757563,
-0.01188016589730978,
-0.017314229160547256,
0.025384748354554176,
-0.015354614704847336,
0.07204163819551468,
-0.003674278035759926,
-0.018938647583127022,
-0.0012392631033435464,
... | 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": "reply", "annotation": null, "type_comment": null}}], "kwarg": nul... | def finishRequest(self, reply):
if reply.url().toString() in self.avatars :
img = QtGui.QImage()
img.loadFromData(reply.readAll())
pix = QtGui.QPixmap(img)
self.avatars[reply.url().toString()].setIcon(QtGui.QIcon(pix))
self.avatars[reply.url().toSt... | |
15,186 | [
0.03200613707304001,
0.024802539497613907,
-0.007613648194819689,
0.0257113017141819,
-0.021910017356276512,
-0.05674218013882637,
0.0070872316136956215,
-0.03980818763375282,
-0.021632956340909004,
0.040606122463941574,
-0.032205622643232346,
0.017089148983359337,
0.02602160908281803,
-0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def addAvatar(self):
options = QtGui.QFileDialog.Options()
options |= QtGui.QFileDialog.DontUseNativeDialog
fileName = QtGui.QFileDialog.getOpenFileName(self,
"Select the PNG file",
"",
"png Files (*.png)", options)
... | |
15,187 | [
-0.009283307939767838,
-0.011944523081183434,
-0.001683373237028718,
0.0030712278094142675,
-0.020274745300412178,
-0.04359441623091698,
0.0063992938958108425,
0.004719015210866928,
-0.004171299748122692,
0.05817539989948273,
-0.018876060843467712,
-0.0007167487638071179,
0.02478024363517761... | 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": "avatar_list", "annotation": null, "type_comment": null}}], "kwarg... | def avatarList(self, avatar_list):
self.listAvatars.clear()
button = QtGui.QPushButton()
#self.group_layout.addWidget(button)
self.avatars["None"] = button
item = QtGui.QListWidgetItem()
item.setSizeHint (QtCore.QSize(40,20))
self.item.append(item)
... | |
15,188 | [
0.055316776037216187,
0.03136736899614334,
-0.000510398589540273,
0.013749715872108936,
0.022028688341379166,
-0.019816545769572258,
0.01896877959370613,
0.00902076717466116,
-0.0051727015525102615,
0.02314138039946556,
0.02549923211336136,
-0.012378718703985214,
0.040825262665748596,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "val", "annotation": null, "type_comment": null}}], "kwarg": null,... | def doit(self, val):
if self.personal == True :
self.parent.send(dict(command="avatar", action="select", avatar=val))
self.close()
else :
if self.user == None :
self.parent.send(dict(command="admin", action="list_avatar_users", avatar=val))
... | |
15,189 | [
0.002304040128365159,
0.0026527035515755415,
-0.038592346012592316,
-0.016423603519797325,
0.06994082033634186,
-0.018952714279294014,
-0.02087816782295704,
0.04858389124274254,
-0.030952977016568184,
0.00942952185869217,
0.013561442494392395,
-0.034887149930000305,
0.016267485916614532,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def get_data_from_request(request):
urlparts = _urlparse.urlsplit(request.url)
try:
form_dict = request.forms.dict
# we only are about the most recent one
formdata = dict([(k, form_dict[k][-1]) for k in form_dict])
except Exception:
formdata = {}
data = {
'reque... | |
15,190 | [
0.019775178283452988,
0.0068076555617153645,
0.011377500370144844,
-0.02162431739270687,
-0.02063496969640255,
0.06162223964929581,
0.025346150621771812,
0.03561652451753616,
0.03990369662642479,
0.0024336189962923527,
0.0550265870988369,
-0.05879553034901619,
0.02300233766436577,
-0.00895... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "cp_mgmt_service_dce_rpc", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Store", "_fie... | class TestCheckpointServiceDceRpc(object):
module = cp_mgmt_service_dce_rpc
@pytest.fixture(autouse=True)
def module_mock(self, mocker):
return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
@pytest.fixture
def connection_mock(self, mocker):
co... | |
15,191 | [
0.05729950964450836,
-0.0016875340370461345,
0.024569014087319374,
-0.03727639839053154,
-0.004923846106976271,
-0.010931308381259441,
-0.008452205918729305,
-0.006337833125144243,
-0.015445495024323463,
0.030742984265089035,
-0.003277278272435069,
0.003311636857688427,
-0.008563211187720299... | 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": "template", "annotation": null, "type_comment": null}}], "kwarg": ... | def create_label(self, template):
label_data = {
'label': 'label1',
}
context = {'template': template}
s = TemplateLabelSerializer(data=label_data, context=context)
s.is_valid(raise_exception=True)
return s.save() | |
15,192 | [
0.050290320068597794,
-0.011467298492789268,
0.01538892276585102,
-0.06040789932012558,
-0.006652945652604103,
-0.013284636661410332,
0.00517303729429841,
-0.022870829328894615,
-0.0031511157285422087,
0.013082710094749928,
0.0017097326926887035,
-0.016653619706630707,
0.01770576275885105,
... | 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 TestTemplateLabelSerializer(TestCase):
def testCreate(self):
template = self.create_template()
label = self.create_label(template)
self.assertEqual(label.template.uuid, template.uuid)
def testRender(self):
template = self.create_template()
label = self.create_labe... | |
15,193 | [
0.03931974992156029,
0.00028217831277288496,
0.015178579837083817,
-0.06083822622895241,
0.007831940427422523,
-0.03675900772213936,
0.007940358482301235,
-0.02440963312983513,
-0.0059320367872715,
0.010413331910967827,
0.005462223663926125,
-0.008647659793496132,
-0.00930333323776722,
-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 TestDataLabelSerializer(TestCase):
def testCreate(self):
file = self.create_file()
label = self.create_label(file)
self.assertEqual(label.data_object.uuid, file.uuid)
def create_file(self):
data = fixtures.data_objects.file_data_object
s = DataObjectSerial... | |
15,194 | [
0.023394625633955002,
0.014324575662612915,
0.013812204822897911,
-0.07295285910367966,
0.001195758581161499,
-0.026708682999014854,
0.02520427480340004,
-0.015163990668952465,
0.008890176191926003,
0.003196865785866976,
-0.017191670835018158,
0.0031614359468221664,
0.017998382449150085,
-... | 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 TestRunLabelSerializer(TransactionTestCase):
def testCreate(self):
run = self.create_run()
label = self.create_label(run)
self.assertEqual(label.run.uuid, run.uuid)
def testRender(self):
run = self.create_run()
label = self.create_label(run)
context = {'ru... | |
15,195 | [
0.03549997881054878,
0.02174651250243187,
0.0062815723940730095,
-0.05225083976984024,
-0.0017145577585324645,
-0.030442651361227036,
0.0201676394790411,
-0.03488323092460632,
0.0012681868392974138,
0.01494995690882206,
0.02126545086503029,
-0.020488347858190536,
-0.01915617473423481,
-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 __init__(self, f, tags):
meta.MetaFile.__init__(self, f, tags);
if self.track:
self.track = int(self.track);
if self.year:
self.year = mutagen.id3.ID3TimeStamp(self.year).year; | |
15,196 | [
0.03916370868682861,
0.0320015624165535,
-0.013662819750607014,
-0.0724882185459137,
-0.03195594251155853,
-0.03430531173944473,
0.01552178431302309,
-0.04972445219755173,
-0.0004875505401287228,
-0.007105122320353985,
0.022193528711795807,
-0.036928389221429825,
-0.003826273838058114,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "album"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "date"}}, {"_type": "Constant",... | class OggVCommentMetaFile(meta.MetaFile):
__translate__ = {
'album': "album",
'date': "year",
'tracknumber': "track",
'artist': "artist",
'title': "title",
};
def __init__(self, f, tags):
meta.MetaFile.__init__(self, f, tags);
if self.track:
... | |
15,197 | [
0.03549997881054878,
0.02174651250243187,
0.0062815723940730095,
-0.05225083976984024,
-0.0017145577585324645,
-0.030442651361227036,
0.0201676394790411,
-0.03488323092460632,
0.0012681868392974138,
0.01494995690882206,
0.02126545086503029,
-0.020488347858190536,
-0.01915617473423481,
-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 __init__(self, f, tags):
meta.MetaFile.__init__(self, f, tags);
if self.track:
self.track = int(self.track);
if self.year:
self.year = mutagen.id3.ID3TimeStamp(self.year).year; | |
15,198 | [
0.012424129992723465,
0.007732341066002846,
-0.0028640409000217915,
-0.0732010155916214,
0.002801407827064395,
-0.030519401654601097,
0.03762541338801384,
-0.06591279804706573,
-0.019473200663924217,
0.025007689371705055,
-0.005665448494255543,
-0.034391265362501144,
0.0019914479926228523,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "album"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "date"}}, {"_type": "Constant",... | class VCFLACMetaFile(meta.MetaFile):
__translate__ = {
'album': "album",
'date': "year",
'tracknumber': "track",
'albumartistsort': "artist",
'artist': "artist",
'title': "title",
};
def __init__(self, f, tags):
meta.MetaFile.__init__(self, f, tag... | |
15,199 | [
0.007864875718951225,
0.03645193949341774,
-0.0163030456751585,
-0.027494220063090324,
-0.001499671139754355,
0.04459748789668083,
-0.02198820933699608,
0.04779838025569916,
-0.022000154480338097,
-0.004186240024864674,
-0.025583241134881973,
-0.057424940168857574,
-0.004359422251582146,
-... | 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 rendered_filter(self):
selection = factory(
'label:select',
name='discount_form_filter',
value=self.default_form,
props={
'vocabulary': self.related_forms,
'label': _('discount_rules', default=u'Discount Rules'),
}
... | |
15,200 | [
-0.007630542386323214,
0.037857141345739365,
-0.001050330582074821,
0.01872348040342331,
-0.02066580019891262,
0.00333572318777442,
0.018783802166581154,
0.03194573149085045,
-0.02678229846060276,
0.012335540726780891,
-0.013934033922851086,
-0.007292747497558594,
0.015623007901012897,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "title", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_t... | class DiscountView(BrowserView):
title = None
related_forms = []
default_form = None
def disable_border(self):
if ISite.providedBy(self.context):
self.request.set('disable_border', True)
def rendered_filter(self):
selection = factory(
'label:select',
... |