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 |
|---|---|---|---|---|---|
19,401 | [
-0.02213883399963379,
-0.011327682994306087,
0.047809310257434845,
-0.0410102978348732,
0.00912341009825468,
0.01715369150042534,
-0.03281784802675247,
-0.007753997575491667,
0.03368274122476578,
0.02120186761021614,
0.04096224904060364,
-0.03767085447907448,
0.03272175043821335,
-0.013321... | 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 TestFastA(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
self.fasta_paths = {
"one": os.path.join(self.tempdir, "one.fa")
}
with open(self.fasta_paths["one"], 'w') as fa:
fa.write(FA_TEST)
def tearDown(self):
shutil.r... | |
19,402 | [
0.00297032599337399,
-0.021624967455863953,
0.040764305740594864,
-0.04581013321876526,
0.023364907130599022,
0.02156282775104046,
-0.019288476556539536,
0.003520271275192499,
0.03807982802391052,
-0.005163893103599548,
0.045163869857788086,
-0.049787137657403946,
0.023911746218800545,
-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_save(self):
fa = FastA()
seq = Sequence("AGTC", name="seq1")
fa.append(seq)
fafn = os.path.join(self.tempdir, "test.fa")
fa.save(fafn)
with open(fafn) as fa:
line = fa.readline().strip()
tokens = line.split(" ")
self.assertEqua... | |
19,403 | [
0.01736411824822426,
-0.00013672077329829335,
0.04354024678468704,
-0.04876309633255005,
-0.009183304384350777,
0.04299568384885788,
-0.022339439019560814,
-0.018614137545228004,
0.03589161857962608,
0.010074406862258911,
0.03871344402432442,
-0.03470348194241524,
0.014133872464299202,
-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_save_strict(self):
fa = FastA()
seq = Sequence("AGTC", name="seq1")
fa.append(seq)
fafn = os.path.join(self.tempdir, "test.fa")
fa.save(fafn, strict=True)
with open(fafn) as fa:
line = fa.readline().strip()
self.assertEquals(">seq1", line)... | |
19,404 | [
0.010784628801047802,
0.02517123892903328,
0.017327871173620224,
-0.02504335716366768,
-0.014471863396465778,
0.0020900547970086336,
-0.012969261966645718,
-0.000989745487459004,
-0.011445347219705582,
0.019150175154209137,
0.005096589680761099,
-0.10503290593624115,
-0.006916229613125324,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CharField", "value": {"_type": "Name", "_fields": {"id": "mo... | class AbstractArticle(models.Model):
title = models.CharField(max_length=50)
objects = models.Manager()
on_site = CurrentSiteManager()
class Meta:
abstract = True
def __unicode__(self):
return self.title | |
19,405 | [
0.06267387419939041,
0.02491622045636177,
0.02680889517068863,
0.007726423908025026,
0.0012929780641570687,
-0.02942030504345894,
0.035218119621276855,
0.005600159987807274,
-0.029755717143416405,
0.0629134550690651,
0.02080743946135044,
-0.040560729801654816,
0.0024721561931073666,
-0.006... | 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": "form", "annotation": null, "type_comment": null}}, {"_type": "arg... | def __init__(self, form, field):
empty_aff = filter(lambda x: x['name'] == '' and x['affiliation'] != '',
field.data)
author_names = filter(lambda x: x['name'] != '', field.data)
if empty_aff:
message = field.gettext('Affiliations should have an author na... | |
19,406 | [
0.0619039423763752,
0.03977174684405327,
0.007117298431694508,
-0.009594165720045567,
-0.0005257431184872985,
0.023870142176747322,
0.013064144179224968,
0.025253403931856155,
-0.021009035408496857,
-0.03218153864145279,
0.029296785593032837,
0.004415798932313919,
0.004463090095669031,
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_uses_target_id_for_renameable_content(self):
with checked_out(self.repository['testcontent']) as co:
rn = zeit.cms.repository.interfaces.IAutomaticallyRenameable(co)
rn.renameable = True
rn.rename_to = 'changed'
ref = zope.app.keyreference.interfaces.IKey... | |
19,407 | [
0.05188348516821861,
0.03568395972251892,
0.02904665097594261,
-0.011176548898220062,
0.004828921519219875,
0.015884535387158394,
0.013128366321325302,
0.05759831890463829,
-0.016402021050453186,
-0.020564399659633636,
0.00537171820178628,
-0.01901194453239441,
-0.014568324200809002,
0.030... | 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 KeyReferenceTest(zeit.cms.testing.ZeitCmsTestCase):
def test_uses_target_id_for_renameable_content(self):
with checked_out(self.repository['testcontent']) as co:
rn = zeit.cms.repository.interfaces.IAutomaticallyRenameable(co)
rn.renameable = True
rn.rename_to = 'c... | |
19,408 | [
-0.004592064302414656,
-0.05482983589172363,
0.007685079704970121,
0.0072923158295452595,
0.001981820911169052,
-0.04830995574593544,
0.009282318875193596,
0.03487743064761162,
0.0025300539564341307,
0.0018983586924150586,
-0.002690432360395789,
0.005197574850171804,
-0.030111895874142647,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "xi", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def tt_helper(xi, data, tnew, told, proposer):
if proposer is None: xinew, fb = xi.propose()
else: xinew, fb = proposer(xi)
xinew.compute_posterior(data)
r = (xinew.prior + xinew.likelihood) / tnew - (xi.prior + xi.likelihood) / told - fb
if r > 0.0 or random() < e... | |
19,409 | [
0.019444704055786133,
-0.04600590467453003,
-0.0005320011405274272,
-0.02484160102903843,
-0.030026854947209358,
-0.019696028903126717,
-0.0023627961054444313,
-0.03055596351623535,
0.0033069225028157234,
0.013426104560494423,
0.007116497028619051,
-0.015370575711131096,
-0.00927261076867580... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "inh", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def tempered_transitions_sample(inh, data, steps, proposer=None, skip=0, temperatures=[1.0, 1.05, 1.1], stats=None):
current_sample = inh
LT = len(temperatures)
## TODO: CHECK THIS--STILL NOT SURE THIS IS RIGHT
# a helper function for temperature transitions -- one single MH step, returning a new samp... | |
19,410 | [
0.009424451738595963,
-0.006136204581707716,
0.05461835116147995,
-0.005679193884134293,
0.0075183832086622715,
0.04133160039782524,
0.006375856231898069,
-0.0011919897515326738,
-0.03627104312181473,
0.007791474927216768,
-0.00869434978812933,
-0.06420443207025528,
0.01650811731815338,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "vocabularies"}}, "targets": [{"_type": "Name", "_fields": {"id": "resource", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment":... | class DataUpdate(BaseDataUpdate):
resource = "vocabularies"
update_fields = ["name", "qcode"]
def forwards(self, mongodb_collection, mongodb_database):
for vocabulary in mongodb_collection.find({}):
if "schema" in vocabulary:
schema = vocabulary["schema"]
... | |
19,411 | [
0.03065340593457222,
-0.00036681946949101985,
0.01691557839512825,
-0.00395327340811491,
-0.004523430950939655,
0.030112972483038902,
0.03143163025379181,
-0.0024400586262345314,
-0.047428473830223083,
0.053827207535505295,
0.016948005184531212,
-0.05477837100625038,
0.027864767238497734,
... | 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": "mongodb_collection", "annotation": null, "type_comment": null}}, ... | def forwards(self, mongodb_collection, mongodb_database):
for vocabulary in mongodb_collection.find({}):
if "schema" in vocabulary:
schema = vocabulary["schema"]
for field in self.update_fields:
if field in vocabulary["schema"] and type(vocabulary[... | |
19,412 | [
0.03179563954472542,
-0.034056663513183594,
0.04598759859800339,
-0.047723740339279175,
0.018643347546458244,
0.006338940467685461,
-0.02606233023107052,
0.012556754052639008,
-0.025557637214660645,
0.03981015831232071,
-0.021318219602108,
0.01150699332356453,
0.022024789825081825,
-0.0553... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "start_date", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "end_date", "annotation": null, "type_comment": null}}, {"_t... | def date_range(start_date, end_date=datetime.now(), delta=timedelta(1)):
l = []
if end_date >= start_date:
while start_date <= end_date:
l.append(start_date)
start_date += delta
else:
raise AirflowException("start_date can't be after end_date")
return l | |
19,413 | [
0.017819926142692566,
0.015842460095882416,
0.1040101870894432,
-0.029889291152358055,
-0.02611619420349598,
0.021183893084526062,
0.012569412589073181,
0.03148035705089569,
-0.04977760091423988,
-0.007955324836075306,
0.007915548048913479,
0.009398647584021091,
0.005543156526982784,
-0.03... | 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 upgradedb():
logging.info("Creating tables")
package_dir = os.path.abspath(os.path.dirname(__file__))
directory = os.path.join(package_dir, 'migrations')
config = Config(os.path.join(package_dir, 'alembic.ini'))
config.set_main_option('script_location', directory)
config.set_main_option('sql... | |
19,414 | [
0.01907316967844963,
0.016568271443247795,
0.0018098731525242329,
-0.03962906077504158,
0.036775946617126465,
0.01109793409705162,
0.017129909247159958,
0.050097960978746414,
0.06465557217597961,
0.009789321571588516,
0.06007262319326401,
-0.021432042121887207,
0.02010658010840416,
0.03394... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment"... | def wrapper(*args, **kwargs):
needs_session = False
if 'session' not in kwargs:
needs_session = True
session = settings.Session()
kwargs['session'] = session
result = func(*args, **kwargs)
if needs_session:
session.expunge_all()
... | |
19,415 | [
0.013348956592381,
0.010465930216014385,
-0.02063811756670475,
-0.027285397052764893,
0.007909283973276615,
0.001358558190986514,
-0.04556269943714142,
0.006070674397051334,
0.03770780935883522,
0.07263050973415375,
-0.03509676828980446,
-0.010922862216830254,
0.0403406135737896,
0.0027878... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment"... | def wrapper(*args, **kwargs):
if len(args) > 1:
raise AirflowException(
"Use keyword arguments when initializing operators")
dag_args = {}
dag_params = {}
if 'dag' in kwargs and kwargs['dag']:
dag = kwargs['dag']
dag_args = copy(dag.def... | |
19,416 | [
0.043528273701667786,
-0.02487054280936718,
0.022844625636935234,
-0.013805177062749863,
0.017606183886528015,
-0.08605323731899261,
0.020027635619044304,
0.025198549032211304,
-0.016303807497024536,
-0.02272885851562023,
-0.015030374750494957,
-0.033842459321022034,
0.03100617602467537,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "to", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "subject", "annotation": null, "type_comment": null}}, {"_type": "ar... | def send_email(to, subject, html_content):
SMTP_MAIL_FROM = conf.get('smtp', 'SMTP_MAIL_FROM')
if isinstance(to, basestring):
if ',' in to:
to = to.split(',')
elif ';' in to:
to = to.split(';')
else:
to = [to]
msg = MIMEMultipart('alternative')
... | |
19,417 | [
0.04402031749486923,
-0.0031512342393398285,
0.015093604102730751,
-0.01833641342818737,
0.020975908264517784,
-0.04365402087569237,
0.033677805215120316,
0.05934016406536102,
-0.0014086286537349224,
-0.003512144787237048,
-0.0073959738947451115,
0.0009648971608839929,
0.009205913171172142,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "e_from", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "e_to", "annotation": null, "type_comment": null}}, {"_type": "a... | def send_MIME_email(e_from, e_to, mime_msg):
SMTP_HOST = conf.get('smtp', 'SMTP_HOST')
SMTP_PORT = conf.get('smtp', 'SMTP_PORT')
SMTP_USER = conf.get('smtp', 'SMTP_USER')
SMTP_PASSWORD = conf.get('smtp', 'SMTP_PASSWORD')
SMTP_STARTTLS = conf.getboolean('smtp', 'SMTP_STARTTLS')
s = smtplib.SMTP(... | |
19,418 | [
0.01904609613120556,
-0.004920334555208683,
0.030134959146380424,
-0.012415068224072456,
-0.022155435755848885,
0.0170400720089674,
0.04622774198651314,
0.04029881954193115,
-0.014554828405380249,
0.014153623953461647,
0.005073572508990765,
0.004828391596674919,
0.040610868483781815,
-0.05... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "suffix", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}, {"_type": ... | def TemporaryDirectory(suffix='', prefix=None, dir=None):
name = mkdtemp(suffix=suffix, prefix=prefix, dir=dir)
try:
yield name
finally:
try:
shutil.rmtree(name)
except OSError as e:
# ENOENT - no such file or directory
if e.err... | |
19,419 | [
-0.00812079943716526,
-0.019463665783405304,
-0.025513989850878716,
-0.07160146534442902,
-0.012458655051887035,
-0.01661154069006443,
0.0034547708928585052,
-0.006629102397710085,
-0.02179071307182312,
0.02154010906815529,
0.027614299207925797,
0.0013410358224064112,
-0.029786210507154465,
... | 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": "id", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def _get_stations(self, id):
if not self.channelist:
self.channelist = self.get_document(self.channels_xml_url)
tree = ETree.fromstring(self.channelist)
channel = tree.find('.//channel[@id="%s"]' % id)
plss = channel.findall('.//*[@format]')
rlists = []
i = ... | |
19,420 | [
0.0037042058538645506,
0.0015474508982151747,
0.06057359278202057,
-0.03614095598459244,
-0.008587709628045559,
-0.00461740605533123,
-0.011974412947893143,
-0.007995037361979485,
0.012518703937530518,
0.031496334820985794,
-0.0024054660461843014,
-0.03935832157731056,
-0.015699785202741623,... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 10}}, "targets": [{"_type": "Name", "_fields": {"id": "FUZZ_TIME", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"... | class FuzzTestCase(unittest.TestCase):
# run each test case for 10s
FUZZ_TIME = 10
@defer.inlineCallbacks
def test_fuzz(self):
# note that this will loop if do_fuzz doesn't take long enough
endTime = reactor.seconds() + self.FUZZ_TIME
while reactor.seconds() < endTime:
... | |
19,421 | [
0.060377832502126694,
-0.024016065523028374,
0.037582121789455414,
-0.04009391367435455,
-0.00012190567213110626,
-0.011066109873354435,
-0.0012958841398358345,
-0.011397856287658215,
0.007588697597384453,
0.0029664637986570597,
0.01587643101811409,
0.005633763503283262,
0.028293224051594734... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_create_stack():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
stack = conn.describe_stacks()[0]
stack.stack_name.should.equal('test_stack')
stack.get_template().should.equal({
'GetTemplateResponse': {
... | |
19,422 | [
0.017292143777012825,
-0.045272279530763626,
0.11294733732938766,
-0.013978400267660618,
-0.01333665382117033,
-0.002642827806994319,
0.014631814323365688,
0.004506808705627918,
0.03759466111660004,
0.026556625962257385,
-0.0021527670323848724,
-0.011866471730172634,
0.0040663378313183784,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_creating_stacks_across_regions():
west1_conn = boto.cloudformation.connect_to_region("us-west-1")
west1_conn.create_stack("test_stack", template_body=dummy_template_json)
west2_conn = boto.cloudformation.connect_to_region("us-west-2")
west2_conn.create_stack("test_stack", template_body=dummy_t... | |
19,423 | [
0.061590567231178284,
-0.02723359316587448,
0.04157726466655731,
-0.03886359930038452,
0.007432299666106701,
-0.01573684997856617,
-0.010891014710068703,
0.005503051448613405,
-0.011854124255478382,
-0.006030036136507988,
0.044799745082855225,
0.012338708154857159,
0.02103092521429062,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_create_stack_hosted_zone_by_id():
conn = boto.connect_cloudformation()
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack 1",
"Parameters": {
},
"Resources": {
"Bar": {
"Type" : "AWS::Route53::HostedZone... | |
19,424 | [
0.041503675282001495,
-0.032583825290203094,
0.02024737372994423,
-0.0457228347659111,
0.010370186530053616,
-0.012955567799508572,
0.03205643221735954,
0.023503463715314865,
0.010725605301558971,
-0.002172637265175581,
0.018046073615550995,
-0.005703889299184084,
0.015432029962539673,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_create_stack_from_s3_url():
s3_conn = boto.s3.connect_to_region('us-west-1')
bucket = s3_conn.create_bucket("foobar")
key = boto.s3.key.Key(bucket)
key.key = "template-key"
key.set_contents_from_string(dummy_template_json)
key_url = key.generate_url(expires_in=0, query_auth=False)
... | |
19,425 | [
0.04380502179265022,
-0.0075208102352917194,
0.014097251929342747,
-0.03477094694972038,
0.00133192865177989,
0.013926583342254162,
0.03349661827087402,
-0.035612914711236954,
0.0008476555813103914,
0.016611773520708084,
-0.019251452758908272,
-0.0101889343932271,
0.00702018104493618,
-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 test_create_stack_with_notification_arn():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack_with_notifications",
template_body=dummy_template_json,
notification_arns='arn:aws:sns:us-east-1:123456789012:fake-queue'
)
stack = conn.describe_stacks()[0]
[n... | |
19,426 | [
0.03841279819607735,
-0.04656307399272919,
0.03257794305682182,
-0.03616684302687645,
-0.002062169834971428,
0.009788433089852333,
-0.01581430993974209,
-0.009035921655595303,
0.007270415313541889,
0.0007163326954469085,
-0.0009724759147502482,
-0.016659438610076904,
0.02836388163268566,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_describe_stack_by_stack_id():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
stack = conn.describe_stacks("test_stack")[0]
stack_by_id = conn.describe_stacks(stack.stack_id)[0]
stack_by_id.stack_id.should.equal... | |
19,427 | [
0.0368577316403389,
-0.02402663417160511,
0.03483055531978607,
-0.041073333472013474,
-0.009928551502525806,
0.012151532806456089,
-0.01876288838684559,
-0.02815009281039238,
0.02234499901533127,
-0.009882478974759579,
-0.0033978221472352743,
-0.009646358899772167,
0.025040220469236374,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_describe_stack_by_name():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
stack = conn.describe_stacks("test_stack")[0]
stack.stack_name.should.equal('test_stack') | |
19,428 | [
0.049841634929180145,
-0.021042486652731895,
0.041044723242521286,
-0.05314330384135246,
0.010006771422922611,
-0.00015723916294518858,
-0.007349605672061443,
-0.00710650347173214,
0.03009946271777153,
-0.006371542811393738,
0.016203053295612335,
-0.02092941664159298,
0.018634077161550522,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_get_template_by_name():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
template = conn.get_template("test_stack")
template.should.equal({
'GetTemplateResponse': {
'GetTemplateResult': {
... | |
19,429 | [
0.03348490968346596,
-0.009761543944478035,
0.0030622149351984262,
-0.0519520603120327,
0.0012869222555309534,
0.025624051690101624,
-0.009720479138195515,
0.01628488302230835,
0.028181763365864754,
0.006992644164711237,
0.01940576173365116,
-0.023864157497882843,
0.021388573572039604,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_describe_deleted_stack():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
stack = conn.describe_stacks("test_stack")[0]
stack_id = stack.stack_id
conn.delete_stack(stack.stack_id)
stack_by_id = conn.describe... | |
19,430 | [
0.015255690552294254,
-0.028331996873021126,
0.06140595301985741,
-0.054316964000463486,
0.0027691354043781757,
-0.002960729645565152,
-0.030966417863965034,
-0.003733093850314617,
0.026056814938783646,
0.009998824447393417,
0.013208026997745037,
-0.03101431578397751,
0.030463483184576035,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_list_stacks():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
conn.create_stack(
"test_stack2",
template_body=dummy_template_json,
)
stacks = conn.list_stacks()
stacks.should.have.length_of(... | |
19,431 | [
0.04916028305888176,
-0.008583449758589268,
0.041919976472854614,
-0.05695398524403572,
-0.014250025153160095,
0.01966872438788414,
-0.012232424691319466,
-0.004291724879294634,
0.026125047355890274,
-0.009505781345069408,
0.03428768366575241,
-0.017362894490361214,
0.011044922284781933,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_delete_stack_by_name():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
conn.list_stacks().should.have.length_of(1)
conn.delete_stack("test_stack")
conn.list_stacks().should.have.length_of(0) | |
19,432 | [
0.04970872774720192,
0.030280478298664093,
0.05862962827086449,
-0.06506739556789398,
0.03986814618110657,
0.02692364528775215,
0.0050323763862252235,
0.015174727886915207,
0.022670123726129532,
-0.031935904175043106,
0.022877050563693047,
-0.019221320748329163,
0.02805025316774845,
-0.025... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_delete_stack_with_resource_missing_delete_attr():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json3,
)
conn.list_stacks().should.have.length_of(1)
conn.delete_stack("test_stack")
conn.list_stacks().should.have.lengt... | |
19,433 | [
0.04949783906340599,
-0.02218623273074627,
0.02524721994996071,
-0.04681650921702385,
-0.005715623963624239,
0.01389308925718069,
-0.014854097738862038,
0.012006666511297226,
0.017333734780550003,
0.0039864033460617065,
0.02446417696774006,
-0.017404921352863312,
0.020798109471797943,
-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 test_delete_stack_by_id():
conn = boto.connect_cloudformation()
stack_id = conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
conn.list_stacks().should.have.length_of(1)
conn.delete_stack(stack_id)
conn.list_stacks().should.have.length_of(0)
with asser... | |
19,434 | [
0.042995039373636246,
0.012721558101475239,
0.059016551822423935,
-0.027236567810177803,
0.04120158776640892,
0.017444316297769547,
0.004513522610068321,
-0.01929755136370659,
0.052081868052482605,
0.001223284169100225,
0.011920482851564884,
-0.026877878233790398,
0.021461650729179382,
-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": "Dict", "_fields": {"k... | def test_cloudformation_params_conditions_and_resources_are_distinct():
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack 1",
"Conditions": {
"FooEnabled": {
"Fn::Equals": [
{
"Ref": "Foo... | |
19,435 | [
0.045872051268815994,
-0.0018488280475139618,
0.05516203120350838,
-0.03953797370195389,
0.0043866257183253765,
-0.030003521591424942,
-0.008467660285532475,
-0.008617677725851536,
0.032137103378772736,
-0.0006868861964903772,
0.020069021731615067,
-0.023736119270324707,
0.015657393261790276... | 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": "Dict", "_fields": {"k... | def test_cloudformation_params():
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack 1",
"Resources": {},
"Parameters": {
"APPNAME": {
"Default": "app-name",
"Description": "The name of the app",
... | |
19,436 | [
0.02649427391588688,
-0.03049125336110592,
0.013110097497701645,
-0.027704786509275436,
0.0017643815372139215,
0.017929313704371452,
-0.017152758315205574,
-0.015405505895614624,
0.01843179203569889,
-0.003602992743253708,
0.014583270065486431,
-0.012162242084741592,
0.02946345880627632,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_stack_tags():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
tags={"foo": "bar", "baz": "bleh"},
)
stack = conn.describe_stacks()[0]
dict(stack.tags).should.equal({"foo": "bar", "baz": "bleh"}) | |
19,437 | [
0.04969695955514908,
-0.030946116894483566,
0.024968985468149185,
-0.035043343901634216,
-0.00237247534096241,
0.02192016690969467,
0.0327778197824955,
-0.0040851766243577,
0.0062241703271865845,
0.02392057701945305,
0.014942829497158527,
0.005248066503554583,
-0.02453516237437725,
-0.0302... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_update_stack():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
conn.update_stack("test_stack", dummy_template_json2)
stack = conn.describe_stacks()[0]
stack.stack_status.should.equal("UPDATE_COMPLETE")
sta... | |
19,438 | [
0.05669362470507622,
-0.018269766122102737,
0.01576513610780239,
-0.05130983889102936,
-0.00023919818340800703,
0.026544414460659027,
0.05149710178375244,
-0.019053926691412926,
0.01357650849968195,
0.027480725198984146,
0.021757524460554123,
-0.01582365483045578,
-0.012277376838028431,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_update_stack_with_previous_template():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
)
conn.update_stack("test_stack", use_previous_template=True)
stack = conn.describe_stacks()[0]
stack.stack_status.should.equa... | |
19,439 | [
0.03506549075245857,
-0.04331619292497635,
0.03191353380680084,
-0.04503122717142105,
0.011843004263937473,
0.01835549809038639,
0.010811666026711464,
-0.0048525030724704266,
0.028622524812817574,
0.017845623195171356,
0.018077384680509567,
-0.03914448991417885,
0.007190395146608353,
-0.01... | 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": "Dict", "_fields": {"k... | def test_update_stack_with_parameters():
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack",
"Resources": {
"VPC": {
"Properties": {
"CidrBlock": {"Ref": "Bar"}
},
"Type": "AWS::EC2::VPC"... | |
19,440 | [
0.02592429146170616,
-0.032045621424913406,
-0.017838653177022934,
-0.033141978085041046,
-0.013418961316347122,
0.027842916548252106,
0.02152743935585022,
-0.004002847708761692,
0.012311182916164398,
0.013772993348538876,
0.01510917954146862,
0.014698045328259468,
0.0007994275074452162,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_update_stack_replace_tags():
conn = boto.connect_cloudformation()
conn.create_stack(
"test_stack",
template_body=dummy_template_json,
tags={"foo": "bar"},
)
conn.update_stack(
"test_stack",
template_body=dummy_template_json,
tags={"foo": "baz"},
... | |
19,441 | [
0.054787151515483856,
-0.02642674371600151,
0.01612626388669014,
-0.017948370426893234,
-0.0017849206924438477,
0.014861944131553173,
0.009389426559209824,
-0.0067368363961577415,
0.014019064605236053,
0.034285351634025574,
0.010139341466128826,
-0.007802830543369055,
-0.013448881916701794,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_update_stack_when_rolled_back():
conn = boto.connect_cloudformation()
stack_id = conn.create_stack(
"test_stack", template_body=dummy_template_json)
cloudformation_backends[conn.region.name].stacks[
stack_id].status = 'ROLLBACK_COMPLETE'
with assert_raises(BotoServerError) as ... | |
19,442 | [
0.028624162077903748,
0.0052518961019814014,
-0.002949209650978446,
-0.04898227006196976,
0.006429808679968119,
0.013532710261642933,
0.00024318433133885264,
-0.027962876483798027,
0.02654583938419819,
0.02992311306297779,
0.022873349487781525,
-0.014524636790156364,
0.010167245753109455,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_describe_stack_events_shows_create_update_and_delete():
conn = boto.connect_cloudformation()
stack_id = conn.create_stack(
"test_stack", template_body=dummy_template_json)
conn.update_stack(stack_id, template_body=dummy_template_json2)
conn.delete_stack(stack_id)
# assert begins an... | |
19,443 | [
0.054082296788692474,
-0.0015551113756373525,
0.05840102955698967,
-0.06855986267328262,
0.02834167517721653,
0.0005601621815003455,
-0.009214111603796482,
-0.010545311495661736,
0.020538512617349625,
0.029028747230768204,
0.030942730605602264,
-0.01092565432190895,
0.014931523241102695,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_create_stack_lambda_and_dynamodb():
conn = boto.connect_cloudformation()
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack Lambda Test 1",
"Parameters": {
},
"Resources": {
"func1": {
"Type" : "AWS::Lam... | |
19,444 | [
0.04624773561954498,
-0.020481469109654427,
0.04110140725970268,
-0.06932544708251953,
0.025154706090688705,
-0.006640611682087183,
-0.01075421366840601,
-0.004350148607045412,
0.004823241848498583,
0.005247294902801514,
0.02852405235171318,
0.014331258833408356,
0.045601557940244675,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_create_stack_kinesis():
conn = boto.connect_cloudformation()
dummy_template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack Kinesis Test 1",
"Parameters": {},
"Resources": {
"stream1": {
"Type" : "AWS::Kinesis::Stream",
... | |
19,445 | [
0.02975619025528431,
-0.018503950908780098,
-0.03318866714835167,
-0.01941041462123394,
0.00853889063000679,
-0.017633745446801186,
0.009251975454390049,
0.038289036601781845,
-0.0018068848876282573,
-0.016437213867902756,
0.006484238896518946,
-0.026855506002902985,
0.01377825252711773,
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": "user", "annotation": n... | class TwitterStreamGET(object):
def __init__(self, user, pword, url, action, debug=False, preprocessor=json.loads):
self.debug = debug
self.userpass = "%s:%s" % (user, pword)
self.preprocessor = preprocessor
self.url = url
try:
self.proxy = getproxies()['https']
... | |
19,446 | [
0.07299603521823883,
0.014816144481301308,
0.003695096354931593,
0.0008083023712970316,
-0.006514097563922405,
-0.012098460458219051,
0.020454145967960358,
0.051206883043050766,
0.029179342091083527,
0.003900710726156831,
0.05344778299331665,
-0.01735503412783146,
0.00770606379956007,
-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": "buf", "annotation": null, "type_comment": null}}], "kwarg": null,... | def body_callback(self, buf):
self.contents += buf
q = self.contents.split('\r\n')
for s in q[:-1]:
if s.startswith('{'):
if self.preprocessor:
a = self.preprocessor(s)
else:
a = s
self.action(a)
... | |
19,447 | [
0.028117045760154724,
-0.055182985961437225,
-0.008277447894215584,
0.006990939844399691,
0.06284728646278381,
-0.02244546078145504,
0.018219145014882088,
0.015569484792649746,
0.055577147752046585,
-0.020288506522774696,
-0.017178988084197044,
-0.038890864700078964,
-0.020091423764824867,
... | 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 request(self):
self._request = pycurl.Curl()
self._request.setopt(self._request.URL, self.url)
self._request.setopt(self._request.USERPWD, self.userpass)
if self.proxy:
self._request.setopt(self._request.PROXY, self.proxy)
self._request.setopt(self._request.WRITEF... | |
19,448 | [
0.018047181889414787,
-0.02227562852203846,
-0.030231209471821785,
-0.0026795596349984407,
0.0054354057647287846,
-0.02155635692179203,
0.013153954409062862,
0.0009011330548673868,
-0.013371915556490421,
-0.011421163566410542,
0.006391710601747036,
-0.01503931824117899,
0.009328736923635006,... | 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": "user", "annotation": n... | class TwitterStreamPOST(TwitterStreamGET):
def __init__(self, user, pword, url, action, data=tuple(), debug=False, preprocessor=json.loads):
TwitterStreamGET.__init__(self, user, pword, url, action, debug, preprocessor)
self.data = data
@property
def request(self):
self._request... | |
19,449 | [
0.027912786230444908,
-0.041179150342941284,
-0.01229809783399105,
0.012743277475237846,
0.05039437487721443,
-0.0285805556923151,
0.009371038526296616,
0.023972943425178528,
0.05253123864531517,
-0.021580100059509277,
-0.019632438197731972,
-0.0425814650952816,
-0.024084238335490227,
-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 request(self):
self._request = pycurl.Curl()
self._request.setopt(self._request.URL, self.url)
self._request.setopt(self._request.USERPWD, self.userpass)
if self.proxy:
self._request.setopt(self._request.PROXY, self.proxy)
self._request.setopt(self._request.WRITEF... | |
19,450 | [
-0.003583933925256133,
0.003056307090446353,
-0.027750929817557335,
-0.013269255869090557,
0.01089493464678526,
-0.001152078970335424,
0.006471849512308836,
-0.04283881559967995,
0.024136124178767204,
0.035743918269872665,
-0.025842493399977684,
-0.033925287425518036,
0.007852660492062569,
... | 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": "selected_choices", "annotation": null, "type_comment": null}}, {"... | def render_option(self, selected_choices, option_value, option_label):
if option_value is None and option_label is None:
# Assume that we just want to supply the other attributes
other_attrs_html = ' '.join('%s="%s"' % (escape(force_unicode(name)), escape(force_unicode(val))) for name, v... | |
19,451 | [
-0.01609961874783039,
0.012914193794131279,
0.03781110420823097,
-0.03631613776087761,
0.001144222798757255,
0.006905585993081331,
-0.01376517303287983,
-0.01853756047785282,
0.02373543567955494,
0.0028677445370703936,
0.01074074488133192,
-0.05303674191236496,
0.03525816276669502,
-0.0032... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields":... | class TwoSidedSelectWidget(SelectMultiple):
class Media:
js = ( static('js/TwoSidedSelectWidget.js'), )
def __init__(self, attrs=None, choices=()):
super(TwoSidedSelectWidget, self).__init__(attrs, choices)
## name and id are set by the framework
def render(self, name, value, attrs=Non... | |
19,452 | [
0.0338536873459816,
0.017941314727067947,
0.0025831961538642645,
-0.041308339685201645,
-0.0003918251022696495,
-0.021702837198972702,
-0.04413517937064171,
-0.03173355758190155,
0.026079878211021423,
-0.0010550781153142452,
-0.0006383187137544155,
-0.012811968103051186,
0.006816331762820482... | 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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg... | def render(self, name, value, attrs=None, choices=()):
if value is None: value = []
if 'ko_data' in self.attrs:
data_bind = "error_check: %(value)s, template: {name: 'two_sided_select_widget', data: %(widget)s}" % self.attrs['ko_data']
del self.attrs['ko_data']
attrs[... | |
19,453 | [
0.016975685954093933,
0.042485710233449936,
-0.0201166532933712,
-0.01712033525109291,
-0.002944656414911151,
-0.014134351164102554,
0.0007432674756273627,
-0.06711750477552414,
0.05170196667313576,
-0.005295215640217066,
-0.024631792679429054,
0.006085623521357775,
-0.0017706684302538633,
... | 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": "attrs", "annotation": ... | class SpinnerWidget(TextInput):
def __init__(self, attrs=None):
super(SpinnerWidget, self).__init__(attrs)
## name and id are set by the framework
def render(self, name, value, attrs=None):
if value is None:
value = ''
input_attrs = self.build_attrs(attrs, type=self.inp... | |
19,454 | [
0.04610146954655647,
0.019223608076572418,
-0.04359403997659683,
-0.028373517096042633,
0.007555273827165365,
-0.0273397546261549,
-0.006054116878658533,
-0.05340379849076271,
0.0615859292447567,
-0.019795477390289307,
-0.01277908030897379,
0.023996517062187195,
-0.011998258531093597,
-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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg... | def render(self, name, value, attrs=None):
if value is None:
value = ''
input_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
span_attrs = {}
if value != '':
# Only add the 'value' attribute if a value is non-empty.
input_attrs['value'... | |
19,455 | [
-0.02520024962723255,
0.027701571583747864,
0.05989149957895279,
-0.031815897673368454,
0.019624868407845497,
0.022967759519815445,
-0.037122443318367004,
-0.01141959335654974,
-0.023271657526493073,
0.02973535843193531,
-0.013850785791873932,
-0.05063426494598389,
0.040184810757637024,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "list", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields":... | class FactsBase(object):
COMMANDS = list()
def __init__(self, module):
self.module = module
self.facts = dict()
self.responses = None
def populate(self):
self.responses = run_commands(self.module, self.COMMANDS, check_rc=False)
def run(self, cmd):
return run_c... | |
19,456 | [
-0.004295750986784697,
0.018682191148400307,
0.0551496259868145,
-0.03449414297938347,
0.0066053979098796844,
0.022577518597245216,
-0.05668725445866585,
-0.020245447754859924,
-0.037851300090551376,
0.033750955015420914,
-0.0024618080351501703,
-0.053714506328105927,
-0.008123806677758694,
... | 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": "show version"}}, {"_type": "Constant", "_fields": {"kind"... | class Default(FactsBase):
COMMANDS = [
'show version',
'show inventory',
'show running-config | grep hostname'
]
def populate(self):
super(Default, self).populate()
data = self.responses[0]
self.facts['version'] = self.parse_version(data)
self.facts[... | |
19,457 | [
0.015554191544651985,
0.010899867862462997,
0.058716077357530594,
-0.010747375898063183,
0.021667134016752243,
-0.02004939131438732,
-0.005280866753309965,
0.011861231178045273,
-0.02544628456234932,
0.026997726410627365,
-0.01996983028948307,
-0.03779151290655136,
-0.010548473335802555,
-... | 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 populate(self):
super(Default, self).populate()
data = self.responses[0]
self.facts['version'] = self.parse_version(data)
self.facts['model'] = self.parse_model(data)
self.facts['image'] = self.parse_image(data)
data = self.responses[1]
self.facts['serialnum'... | |
19,458 | [
0.008088460192084312,
0.00807501282542944,
0.04988892376422882,
0.017696449533104897,
0.020654821768403053,
-0.02622194215655327,
-0.017172010615468025,
0.02147509716451168,
-0.007395931985229254,
0.027028771117329597,
0.020305195823311806,
-0.018624301999807358,
-0.024124186486005783,
-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 populate(self):
super(Hardware, self).populate()
data = self.responses[0]
self.facts['filesystems'] = self.parse_filesystems(data)
data = self.responses[1]
match = re.findall(r'\s(\d+)\s', data)
if match:
self.facts['memtotal_mb'] = int(match[0]) // 1024
... | |
19,459 | [
-0.0008238621521741152,
0.01353840995579958,
0.03197865933179855,
-0.01399228349328041,
0.00550808385014534,
0.001385125913657248,
-0.05179349705576897,
-0.0045873685739934444,
-0.02445731870830059,
0.02959257736802101,
0.02644139714539051,
-0.027491791173815727,
-0.0004072707670275122,
-0... | 10 | {"_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": "show file-systems"}}, {"_type": "Constant", "_fields": {"... | class Hardware(FactsBase):
COMMANDS = [
'show file-systems',
'show memory | except Processor'
]
def populate(self):
super(Hardware, self).populate()
data = self.responses[0]
self.facts['filesystems'] = self.parse_filesystems(data)
data = self.responses[1]
... | |
19,460 | [
-0.004547100979834795,
-0.023943735286593437,
0.049160659313201904,
-0.005372075363993645,
0.008483591489493847,
0.001781489234417677,
-0.02576257660984993,
0.0027152688708156347,
-0.01792857050895691,
0.052096787840127945,
-0.005414298269897699,
-0.0314139723777771,
-0.0012431449722498655,
... | 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 populate(self):
super(Interfaces, self).populate()
self.facts['all_ipv4_addresses'] = list()
self.facts['all_ipv6_addresses'] = list()
data = self.responses[0]
interfaces = self.parse_interfaces(data)
for key in list(interfaces.keys()):
if "ManagementEth... | |
19,461 | [
-0.027953557670116425,
-0.004844577983021736,
0.03410184755921364,
-0.017088260501623154,
0.0045147608034312725,
0.020535783842206,
-0.041096460074186325,
-0.017909692600369453,
-0.008046293631196022,
0.03365379199385643,
0.007679138332605362,
-0.02598709985613823,
-0.008593914099037647,
-... | 15 | {"_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": "show interfaces"}}, {"_type": "Constant", "_fields": {"ki... | class Interfaces(FactsBase):
COMMANDS = [
'show interfaces',
'show ipv6 interface',
'show lldp neighbors detail',
'show inventory'
]
def populate(self):
super(Interfaces, self).populate()
self.facts['all_ipv4_addresses'] = list()
self.facts['all_ipv6... | |
19,462 | [
-0.020783502608537674,
-0.0034064939245581627,
0.014937447383999825,
-0.02960815466940403,
-0.02267291210591793,
-0.0033509230706840754,
-0.04352309927344322,
0.0027604824863374233,
-0.01827169954776764,
0.05339248478412628,
0.0020227793138474226,
-0.0038844032678753138,
0.012081105262041092... | 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": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def get_protocol_list(self, data):
start = False
protocol_list = list()
for line in data.split('\n'):
match = re.search(r'Software Protocol Configured\s*', line)
if match:
start = True
continue
if start:
line = l... | |
19,463 | [
-0.0017336079617962241,
-0.030175428837537766,
-0.004863569047302008,
0.004461229778826237,
-0.007188851945102215,
0.00966797024011612,
-0.02152513898909092,
-0.01217667292803526,
0.021323969587683678,
0.04224560037255287,
-0.007005432620644569,
-0.02040095627307892,
-0.0056800805032253265,
... | 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": "interfaces", "annotation": null, "type_comment": null}}], "kwarg"... | def populate_interfaces(self, interfaces):
facts = dict()
for key, value in interfaces.items():
intf = dict()
intf['description'] = self.parse_description(value)
intf['macaddress'] = self.parse_macaddress(value)
ipv4 = self.parse_ipv4(value)
in... | |
19,464 | [
0.03012993559241295,
-0.009937145747244358,
0.04429249092936516,
0.007113127503544092,
-0.017920834943652153,
-0.009326690807938576,
-0.014311187900602818,
0.017920834943652153,
-0.014353654347360134,
0.021339382976293564,
-0.02639288827776909,
0.005215408746153116,
-0.004137823358178139,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def populate_ipv6_interfaces(self, data):
for key, value in data.items():
if key in self.facts['interfaces']:
self.facts['interfaces'][key]['ipv6'] = list()
addresses = re.findall(r'\s+(.+), subnet', value, re.M)
subnets = re.findall(r', subnet is (\S+... | |
19,465 | [
-0.0007924236124381423,
-0.01523845549672842,
0.014138033613562584,
-0.0037856916896998882,
0.01492746639996767,
0.000938199635129422,
-0.017750289291143417,
-0.008402680978178978,
-0.026912499219179153,
0.05851375684142113,
0.019377000629901886,
-0.025118332356214523,
0.0036272068973630667,... | 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": "neighbors", "annotation": null, "type_comment": null}}], "kwarg":... | def parse_neighbors(self, neighbors):
facts = dict()
for entry in neighbors.split(
'========================================================================'):
if entry == '':
continue
intf = self.parse_lldp_intf(entry)
if intf not in... | |
19,466 | [
-0.019011156633496284,
0.01080334559082985,
-0.011241626925766468,
-0.0107407346367836,
-0.0021586769726127386,
0.030258474871516228,
-0.02645624428987503,
-0.01178236398845911,
0.021151334047317505,
0.015470755286514759,
0.037521421909332275,
-0.0020078399684280157,
0.020240619778633118,
... | 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": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def parse_mgmt_interfaces(self, data):
parsed = dict()
interface_start = True
for line in data.split('\n'):
match = re.match(r'^(\S+) (\S+)', line)
if "Time since" in line:
interface_start = True
parsed[key] += '\n%s' % line
... | |
19,467 | [
-0.0025006085634231567,
0.002906004199758172,
-0.018891703337430954,
-0.017050698399543762,
0.015209694392979145,
0.027957579120993614,
0.0017674177652224898,
-0.019448285922408104,
0.02776491641998291,
0.05758490785956383,
0.006882359739392996,
-0.011795273050665855,
0.013689794577658176,
... | 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": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def parse_interfaces(self, data):
parsed = dict()
newline_count = 0
interface_start = True
for line in data.split('\n'):
if interface_start:
newline_count = 0
if len(line) == 0:
newline_count += 1
if newline_count =... | |
19,468 | [
-0.0063873836770653725,
-0.027948856353759766,
-0.02459845133125782,
-0.03869176656007767,
0.00901907216757536,
0.01708706095814705,
-0.017616640776395798,
-0.010694273747503757,
0.018945995718240738,
0.03134249150753021,
0.0029451134614646435,
0.01780037395656109,
0.009197399951517582,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def parse_vlan_interfaces(self, data):
parsed = dict()
interface_start = True
line_before_end = False
for line in data.split('\n'):
match = re.match(r'^(\S+) (\S+)', line)
match_endline = re.match(r'^\s*\d+ packets, \d+ bytes$', line)
if "Output Stati... | |
19,469 | [
0.007878607138991356,
-0.015620449557900429,
-0.009685850702226162,
-0.0016130873700603843,
-0.0027426148299127817,
0.013432218693196774,
-0.025496793910861015,
-0.015444609336555004,
0.0248715840280056,
0.010921615175902843,
-0.004352038726210594,
0.017994288355112076,
0.012601863592863083,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def parse_ipv6_interfaces(self, data):
parsed = dict()
for line in data.split('\n'):
if len(line) == 0:
continue
elif line[0] == ' ':
parsed[key] += '\n%s' % line
else:
match = re.match(r'^(\S+) (\S+)', line)
... | |
19,470 | [
0.014728241600096226,
0.03149823099374771,
0.000018651231584954076,
-0.009379284456372261,
0.011761325411498547,
0.01465380284935236,
0.002754234243184328,
0.029392678290605545,
0.004237692803144455,
0.0021786631550639868,
-0.007358803879469633,
-0.030137065798044205,
0.04123907536268234,
... | 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": "path", "annotation": n... | class SaveDialog(Popup):
def save(self, path, selection):
_file = codecs.open(selection, 'w', encoding='utf8')
_file.write(self.text)
Window.title = selection[selection.rfind(os.sep)+1:]
_file.close()
self.dismiss()
def cancel(self):
self.dismiss() | |
19,471 | [
0.02840379998087883,
0.031102804467082024,
-0.03937118127942085,
-0.004634896293282509,
0.0048491028137505054,
-0.02014613337814808,
-0.02155989781022072,
0.004377848003059626,
-0.01594768464565277,
0.008873510174453259,
-0.03039592131972313,
-0.007266960106790066,
0.06160582974553108,
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}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": n... | class LoadDialog(Popup):
def load(self, path, selection):
self.choosen_file = [None, ]
self.choosen_file = selection
Window.title = selection[0][selection[0].rfind(os.sep)+1:]
self.dismiss()
def cancel(self):
self.dismiss() | |
19,472 | [
-0.009710737504065037,
0.016531938686966896,
0.0038339649327099323,
-0.04379305616021156,
0.01892409473657608,
-0.02941642887890339,
-0.024099208414554596,
-0.023246558383107185,
-0.027853237465023994,
0.018592508509755135,
-0.027687443420290947,
-0.05850126966834068,
-0.026550576090812683,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}], "func":... | class CodeInputTest(App):
files = ListProperty([None, ])
def build(self):
b = BoxLayout(orientation='vertical')
languages = Spinner(
text='language',
values=sorted(['KvLexer', ] + list(lexers.LEXERS.keys())))
languages.bind(text=self.change_lang)
menu ... | |
19,473 | [
-0.009683005511760712,
0.02808530628681183,
0.007640855386853218,
-0.016830533742904663,
0.00443995650857687,
-0.0202608872205019,
-0.009499441832304,
-0.020432978868484497,
-0.04591396823525429,
0.008432475849986076,
-0.05465620756149292,
-0.026043156161904335,
-0.007898992858827114,
0.00... | 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 build(self):
b = BoxLayout(orientation='vertical')
languages = Spinner(
text='language',
values=sorted(['KvLexer', ] + list(lexers.LEXERS.keys())))
languages.bind(text=self.change_lang)
menu = BoxLayout(
size_hint_y=None,
height='30pt... | |
19,474 | [
0.05469592288136482,
0.0073447637259960175,
-0.026609381660819054,
0.002790189580991864,
0.030220216140151024,
0.015448623336851597,
0.019726229831576347,
-0.015428107231855392,
0.011417210102081299,
0.017315588891506195,
-0.008862955495715141,
-0.015941008925437927,
0.00991953443735838,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "empty_strings_allowed", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comme... | class JSONField(Field):
empty_strings_allowed = False
description = _('A JSON object')
default_error_messages = {
'invalid': _("Value must be valid JSON."),
}
def __init__(self, verbose_name=None, name=None, encoder=None, **kwargs):
if encoder and not callable(encoder):
... | |
19,475 | [
0.01898735761642456,
0.03633188083767891,
-0.023231342434883118,
-0.03723754733800888,
0.0278649739921093,
-0.035742148756980896,
0.01238443236798048,
0.010620493441820145,
-0.001715233433060348,
0.005907880142331123,
-0.002653806935995817,
0.0013584964908659458,
0.017186559736728668,
0.02... | 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": "instance", "annotation": null, "type_comment": null}}, {"_type": ... | def _file_menu_selected(self, instance, value):
if value == 'File':
return
instance.text = 'File'
if value == 'Open':
if not hasattr(self, 'load_dialog'):
self.load_dialog = LoadDialog()
self.load_dialog.open()
self.load_dialog.bind... | |
19,476 | [
0.01129839476197958,
0.009464305825531483,
0.005081744398921728,
0.006596641149371862,
0.026123104616999626,
-0.037654560059309006,
0.0034655164927244186,
0.01158212125301361,
-0.059785228222608566,
0.009590969420969486,
-0.03808014839887619,
-0.02393435686826706,
0.01067014317959547,
0.00... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "->"}}, "targets": [{"_type": "Name", "_fields": {"id": "operator", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {... | class KeyTransform(Transform):
operator = '->'
nested_operator = '#>'
def __init__(self, key_name, *args, **kwargs):
super(KeyTransform, self).__init__(*args, **kwargs)
self.key_name = key_name
def as_sql(self, compiler, connection):
key_transforms = [self.key_name]
pre... | |
19,477 | [
0.029997888952493668,
0.008983640000224113,
-0.03487303853034973,
-0.01635533571243286,
0.016433967277407646,
0.020001869648694992,
0.030037205666303635,
-0.03247477859258652,
0.013514776714146137,
0.026872290298342705,
0.02472958341240883,
0.00828578695654869,
-0.021132195368409157,
0.018... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}, {"_type": "ar... | def validate(self, value, model_instance):
super(JSONField, self).validate(value, model_instance)
options = {'cls': self.encoder} if self.encoder else {}
try:
json.dumps(value, **options)
except TypeError:
raise exceptions.ValidationError(
self.err... | |
19,478 | [
0.014119381085038185,
-0.030799631029367447,
0.02259793132543564,
-0.03557530418038368,
0.001594774890691042,
-0.02853868342936039,
-0.00928026344627142,
-0.0037836250849068165,
-0.04752602055668831,
-0.008541994728147984,
-0.028100337833166122,
-0.06067642569541931,
0.04505743831396103,
-... | 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": "compiler", "annotation": null, "type_comment": null}}, {"_type": ... | def as_sql(self, compiler, connection):
key_transforms = [self.key_name]
previous = self.lhs
while isinstance(previous, KeyTransform):
key_transforms.insert(0, previous.key_name)
previous = previous.lhs
lhs, params = compiler.compile(previous)
if len(key_t... | |
19,479 | [
-0.01789257489144802,
-0.008734958246350288,
0.030173175036907196,
-0.031652484089136124,
-0.029093045741319656,
0.005365424789488316,
0.028271209448575974,
0.012045789510011673,
-0.00508071668446064,
0.026744939386844635,
-0.00723216962069273,
0.03569122776389122,
-0.01739947311580181,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__(self):
super(NuagePlugin, self).__init__()
neutron_extensions.append_api_extensions_path(extensions.__path__)
config.nuage_register_cfg_opts()
self.nuageclient_init()
net_partition = cfg.CONF.RESTPROXY.default_net_partition_name
self._create_default_net_parti... | |
19,480 | [
0.02942512370646,
0.04040640965104103,
0.041469115763902664,
-0.02420606091618538,
-0.02413521520793438,
0.03717106580734253,
0.04812873527407646,
0.000783745024818927,
0.018656378611922264,
0.003433127887547016,
0.003385896561667323,
0.03761976212263107,
-0.05686653405427933,
-0.026520397... | 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 _synchronization_thread(self):
sync_interval = cfg.CONF.SYNCMANAGER.sync_interval
fip_quota = str(cfg.CONF.RESTPROXY.default_floatingip_quota)
if sync_interval > 0:
sync_loop = loopingcall.FixedIntervalLoopingCall(
self.syncmanager.synchronize, fip_quota)
... | |
19,481 | [
-0.036723792552948,
0.012671620585024357,
0.01703496277332306,
-0.0005088074249215424,
0.040477462112903595,
0.0027151338290423155,
-0.020752767100930214,
0.004668177105486393,
0.01123112067580223,
0.01226517278701067,
0.02406412549316883,
-0.013412791304290295,
0.06689659506082535,
0.0138... | 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}}, {"_type": "... | def _resource_finder(self, context, for_resource, resource, user_req):
match = re.match(attributes.UUID_PATTERN, user_req[resource])
if match:
obj_lister = getattr(self, "get_%s" % resource)
found_resource = obj_lister(context, user_req[resource])
if not found_resourc... | |
19,482 | [
-0.05049940198659897,
0.02011953480541706,
-0.020256761461496353,
-0.01372266374528408,
0.02596750110387802,
-0.03753676265478134,
-0.01174871064722538,
0.0356789231300354,
0.03690340742468834,
0.04374362900853157,
-0.022251825779676437,
-0.023602981120347977,
0.023539645597338676,
0.03310... | 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}}, {"_type": "... | def _get_router_by_subnet(self, context, subnet_id):
filters = {
'fixed_ips': {'subnet_id': [subnet_id]},
'device_owner': [os_constants.DEVICE_OWNER_ROUTER_INTF]
}
router_port = self.get_ports(context, filters=filters)
if not router_port:
msg = (_("Rou... | |
19,483 | [
-0.027198906987905502,
0.02145843394100666,
0.010239453986287117,
-0.02045612782239914,
-0.027176126837730408,
-0.01576351933181286,
-0.01129870768636465,
-0.005401625297963619,
0.02053585834801197,
0.044306427240371704,
0.008724607527256012,
0.043121885508298874,
0.011446775868535042,
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": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def _create_update_port(self, context, port, np_name):
filters = {'device_id': [port['device_id']]}
ports = self.get_ports(context, filters)
params = {
'port_id': port['id'],
'id': port['device_id'],
'mac': port['mac_address'],
'netpart_name': np_n... | |
19,484 | [
-0.024525875225663185,
0.013882143422961235,
0.03668690472841263,
-0.01490122452378273,
0.003954599145799875,
0.02227257564663887,
-0.005927652586251497,
-0.0017324371729046106,
0.0159316286444664,
0.022623591125011444,
0.023891780525445938,
0.054396264255046844,
0.024389997124671936,
-0.0... | 15 | {"_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}}, {"_type": "... | def create_port(self, context, port):
session = context.session
with session.begin(subtransactions=True):
p = port['port']
self._ensure_default_security_group_on_port(context, port)
port = super(NuagePlugin, self).create_port(context, port)
device_owner = ... | |
19,485 | [
-0.01246793381869793,
0.004963424988090992,
0.04329341650009155,
-0.03144294023513794,
-0.008680056780576706,
0.02199106104671955,
-0.02410467155277729,
-0.012574802152812481,
0.017906328663229942,
0.00879879854619503,
0.03692883253097534,
0.0070710997097194195,
0.04780562222003937,
0.0109... | 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}}, {"_type": "... | def _process_port_create_security_group(self, context, port,
sec_group):
if not attributes.is_attr_set(sec_group):
port[ext_sg.SECURITYGROUPS] = []
return
port_id = port['id']
with context.session.begin(subtransactions=True):
... | |
19,486 | [
-0.015558373183012009,
0.008516970090568066,
0.043582331389188766,
-0.014968146570026875,
0.0005042748525738716,
0.029723811894655228,
0.00929016713052988,
-0.004119781777262688,
-0.004293898586183786,
0.03522472456097603,
0.020055899396538734,
0.035673294216394424,
0.012406563386321068,
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": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def update_port(self, context, id, port):
p = port['port']
sg_groups = None
if p.get('device_owner', '').startswith(
constants.NOVA_PORT_OWNER_PREF):
session = context.session
with session.begin(subtransactions=True):
port = self._get_port(cont... | |
19,487 | [
0.0036673611029982567,
0.022492391988635063,
-0.003295515663921833,
-0.04995786026120186,
-0.018620656803250313,
0.00797055009752512,
-0.03397134691476822,
0.012761962600052357,
0.04512103274464607,
0.04428083077073097,
0.03746839612722397,
0.036401115357875824,
-0.003204683307558298,
0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def _delete_nuage_vport(self, context, port, np_name):
nuage_vif_id = None
params = {
'neutron_port_id': port['id'],
}
nuage_port = self.nuageclient.get_nuage_port_by_id(params)
if constants.NOVA_PORT_OWNER_PREF in port['device_owner']:
# This was a VM Po... | |
19,488 | [
0.0005837037460878491,
0.018842777237296104,
0.027102624997496605,
-0.045053716748952866,
-0.027525003999471664,
0.008764355443418026,
-0.025929352268576622,
0.0213535837829113,
0.022386064752936363,
0.03540940582752228,
0.03799060732126236,
0.029848087579011917,
-0.00038608041359111667,
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}}, {"_type": "... | def delete_port(self, context, id, l3_port_check=True):
if l3_port_check:
self.prevent_l3_port_deletion(context, id)
port = self._get_port(context, id)
# This is required for to pass ut test_floatingip_port_delete
self.disassociate_floatingips(context, id)
if not port... | |
19,489 | [
-0.04848257824778557,
-0.022758569568395615,
0.03245508670806885,
-0.05248356983065605,
0.02288801409304142,
-0.004165736027061939,
0.03153721243143082,
0.004427565727382898,
0.023346951231360435,
0.016062796115875244,
-0.00578672531992197,
0.00013606307038571686,
0.023488162085413933,
-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}}, {"_type": "... | def _process_provider_create(self, context, attrs):
network_type = attrs.get(pnet.NETWORK_TYPE)
physical_network = attrs.get(pnet.PHYSICAL_NETWORK)
segmentation_id = attrs.get(pnet.SEGMENTATION_ID)
network_type_set = attributes.is_attr_set(network_type)
physical_network_set = at... | |
19,490 | [
-0.025614678859710693,
0.00160674424842,
0.01228292565792799,
-0.021955439820885658,
0.010756300762295723,
-0.004900351632386446,
0.02172236703336239,
0.008903373032808304,
-0.029157383367419243,
0.035613492131233215,
0.02225843258202076,
0.01862250082194805,
0.008320691995322704,
0.050390... | 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}}, {"_type": "... | def _validate_update_network(self, context, id, network):
req_data = network['network']
is_external_set = req_data.get(external_net.EXTERNAL)
if not attributes.is_attr_set(is_external_set):
return (None, None)
neutron_net = self.get_network(context, id)
if neutron_net... | |
19,491 | [
-0.0427364706993103,
-0.006270750891417265,
0.0136392991989851,
-0.021745257079601288,
-0.00785091333091259,
-0.019815795123577118,
0.038500525057315826,
0.04129491746425629,
-0.022188810631632805,
0.02268780954182148,
-0.008111502043902874,
0.045686107128858566,
0.04240380600094795,
-0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def create_network(self, context, network):
(network_type, physical_network,
vlan_id) = self._process_provider_create(context,
network['network'])
with context.session.begin(subtransactions=True):
self._ensure_default_security_group(... | |
19,492 | [
-0.052059438079595566,
0.019510626792907715,
-0.0031254321802407503,
-0.02306755632162094,
-0.0199887715280056,
-0.012326797470450401,
-0.022146252915263176,
0.03923116996884346,
-0.048234280198812485,
0.032070666551589966,
-0.01026261318475008,
-0.004583189729601145,
0.04249654710292816,
... | 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}}, {"_type": "... | def get_networks(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None, page_reverse=False):
nets = super(NuagePlugin,
self).get_networks(context, filters, None, sorts,
limit, marker, page_reverse)
... | |
19,493 | [
-0.04321163892745972,
-0.014098497107625008,
0.011108292266726494,
-0.018831927329301834,
-0.01003309153020382,
0.0027070895303040743,
0.042219147086143494,
0.05675026774406433,
-0.018182989209890366,
0.03343939408659935,
0.025868451222777367,
0.019748074933886528,
0.009848589077591896,
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}}, {"_type": "... | def update_network(self, context, id, network):
pnet._raise_if_updates_provider_attributes(network['network'])
with context.session.begin(subtransactions=True):
is_external_set, subnet = self._validate_update_network(context,
... | |
19,494 | [
-0.012977521866559982,
0.012245104648172855,
-0.0027708839625120163,
-0.05332914739847183,
-0.012977521866559982,
0.0032443804666399956,
0.006437262985855341,
0.08871406316757202,
-0.011524131521582603,
0.03181438520550728,
0.046165186911821365,
-0.005166976246982813,
-0.005530324298888445,
... | 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}}, {"_type": "... | def delete_network(self, context, id):
with context.session.begin(subtransactions=True):
self._process_l3_delete(context, id)
filter = {'network_id': [id]}
subnets = self.get_subnets(context, filters=filter)
for subnet in subnets:
self.delete_subne... | |
19,495 | [
-0.02331126295030117,
-0.0034647074062377214,
0.041566334664821625,
0.023717382922768593,
0.005548608489334583,
-0.035048115998506546,
0.013087202794849873,
0.036368004977703094,
0.02258024737238884,
0.05194269120693207,
0.005827815737575293,
0.033525168895721436,
0.05088678002357483,
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}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def _get_net_partition_for_subnet(self, context, subnet):
ent = subnet.get('net_partition', None)
if not ent:
def_net_part = cfg.CONF.RESTPROXY.default_net_partition_name
net_partition = nuagedb.get_net_partition_by_name(context.session,
... | |
19,496 | [
-0.03345746174454689,
0.021451354026794434,
-0.003941062837839127,
-0.03137329965829849,
0.021063346415758133,
-0.03891175985336304,
0.04842352122068405,
0.020109951496124268,
-0.0054681552574038506,
0.0005248514353297651,
0.0051826913841068745,
0.0083532789722085,
0.04121764004230499,
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": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def _create_nuage_sharedresource(self, context, subnet, type):
subn = subnet['subnet']
net_id = subn['network_id']
self._validate_nuage_sharedresource(context, 'subnet', net_id)
with context.session.begin(subtransactions=True):
subn = super(NuagePlugin, self).create_subnet(co... | |
19,497 | [
-0.027302511036396027,
0.02082173153758049,
0.04337960109114647,
-0.018169963732361794,
0.02504315786063671,
-0.04164346307516098,
0.017230547964572906,
0.007223987486213446,
-0.01802726835012436,
0.005957560148090124,
0.02597068063914776,
-0.001893695560283959,
0.03576914221048355,
0.0562... | 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}}, {"_type": "... | def _validate_nuage_sharedresource(self, context, resource, net_id):
filter = {'network_id': [net_id]}
existing_subn = self.get_subnets(context, filters=filter)
if len(existing_subn) > 1:
msg = _('Only one subnet is allowed per '
'external network %s') % net_id
... | |
19,498 | [
-0.025522764772176743,
0.010047399438917637,
0.025440366938710213,
0.0017844305839389563,
-0.01970340870320797,
-0.014574136584997177,
-0.000883846718352288,
0.0028144048992544413,
0.03405095264315605,
0.02896287851035595,
-0.026367343962192535,
0.02463698573410511,
0.03812965005636215,
-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}}, {"_type": "... | def _create_port_gateway(self, context, subnet, gw_ip=None):
if gw_ip is not None:
fixed_ip = [{'ip_address': gw_ip, 'subnet_id': subnet['id']}]
else:
fixed_ip = [{'subnet_id': subnet['id']}]
port_dict = dict(port=dict(
name='',
device_id='',
... | |
19,499 | [
-0.025575028732419014,
0.0047104451805353165,
0.023877572268247604,
-0.033089108765125275,
0.0012384367873892188,
-0.021840622648596764,
-0.00047104450641199946,
0.03659718856215477,
0.004017316736280918,
0.05793989077210426,
-0.0017172613879665732,
0.031889572739601135,
0.055042896419763565... | 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}}, {"_type": "... | def _create_nuage_subnet(self, context, neutron_subnet, netpart_id,
l2dom_template_id, pnet_binding):
net = netaddr.IPNetwork(neutron_subnet['cidr'])
# list(net)[-1] is the broadcast
last_address = neutron_subnet['allocation_pools'][-1]['end']
gw_port = self.... | |
19,500 | [
-0.034933581948280334,
0.015846842899918556,
0.03420625999569893,
-0.01947244256734848,
-0.006501834373921156,
-0.04619608446955681,
0.033699337393045425,
0.01920795999467373,
0.002945110434666276,
0.04037749022245407,
0.006887536030262709,
0.020034465938806534,
0.06995532661676407,
-0.000... | 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}}, {"_type": "... | def create_subnet(self, context, subnet):
subn = subnet['subnet']
net_id = subn['network_id']
if self._network_is_external(context, net_id):
return self._create_nuage_sharedresource(
context, subnet, constants.SR_TYPE_FLOATING)
pnet_binding = nuagedb.get_netw... |