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 |
|---|---|---|---|---|---|
16,601 | [
0.0042634145356714725,
0.007826865650713444,
0.011338252574205399,
-0.021230299025774002,
0.03355197235941887,
0.006802951451390982,
-0.026471348479390144,
0.035148583352565765,
0.03167768940329552,
0.02755889669060707,
0.023764051496982574,
-0.06048610806465149,
0.010158148594200611,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def extract_numbers(data):
ret = []
#print("data:" + data)
arr = re.split("und|oder|sowie|auch|,|;", data)
for a in arr:
if a.find("/") != -1:
ret.extend(extract_slashed_numbers(a))
elif a.find("bis") != -1:
ret.extend(extract_range_numbers(a))
else:
a = extract_number(a)
if ... | |
16,602 | [
0.06281981617212296,
0.008030815981328487,
-0.00626972084864974,
-0.032769739627838135,
-0.027129778638482094,
0.016017045825719833,
-0.059698887169361115,
-0.035444822162389755,
0.03754030168056488,
-0.024878252297639847,
0.03000549040734768,
-0.019360898062586784,
-0.03194492310285568,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def extract_name(data):
s = data
s = s.replace("\n", "").replace("\r", "")
s = re.sub(r'<[^>]*>', " ", s) # remove tags
s = s.replace("&", "&")
s = s.replace(" ", " ")
s = s.strip()
if s.startswith("Firma: "):
s = s[7:]
return s if len(s)<= NAME_MAX_LENGTH else s[0:NAME_MAX_LENGTH-3]+"..." | |
16,603 | [
0.005759100895375013,
-0.028366757556796074,
-0.02081155963242054,
-0.07091689109802246,
0.02431105263531208,
0.02107807621359825,
-0.02261924557387829,
-0.0021625596564263105,
0.00803608912974596,
-0.011923772282898426,
0.06160036101937294,
-0.07439321279525757,
-0.04062657430768013,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "soup", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def parse_page(soup):
ret = []
#if g_debug: print("parse_page...")
list = soup.findAll("section",{"class":"teaser cf"})
date = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S +0000")
for e in list:
numbers = extract_numbers(e.strong.contents[0])
name = extract_name(str(e.p))
for n in numbers:
... | |
16,604 | [
-0.043080247938632965,
0.024490660056471825,
-0.03749487176537514,
-0.040846098214387894,
0.008086653426289558,
-0.007376338820904493,
-0.035382144153118134,
0.01134681235998869,
0.033706530928611755,
0.04541153460741043,
0.026275550946593285,
-0.028655407950282097,
-0.03348797187209129,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "page_nr", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def fetch_page(page_nr):
if g_debug: print("fetch_page: " + str(page_nr))
url = "https://www.ktipp.ch/service/warnlisten/detail/?warnliste_id=7&ajax=ajax-search-form&page=" + str(page_nr)
headers = {"User-Agent": "Mozilla/5.0"}
req = urllib.request.Request(url, headers=headers)
data = urllib.request.urlopen(r... | |
16,605 | [
0.0471949428319931,
-0.0016090469434857368,
-0.014714515767991543,
-0.03903528302907944,
0.028253678232431412,
-0.04477642849087715,
-0.04258394241333008,
-0.04256134107708931,
0.01855701580643654,
0.01242031715810299,
0.05090182647109032,
-0.06152521073818207,
-0.046562060713768005,
0.002... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "content", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def parse_pages(content):
ret = []
soup = BeautifulSoup(content, "lxml")
tmp = str(soup.findAll("li")[-1])
max_page_str = extract_str(tmp, "ajaxPagerWarnlisteLoadIndex(", ")", "Can't extract max pages")
last_page = int(max_page_str)
if g_debug: print("Last page: %s" % last_page)
ret.extend(parse_page(... | |
16,606 | [
0.0058648185804486275,
-0.03318260982632637,
0.02397499978542328,
-0.03308197855949402,
-0.013509523123502731,
-0.037937358021736145,
0.011974921450018883,
0.026893258094787598,
0.02749703638255596,
0.061585310846567154,
0.008188732899725437,
-0.03466689586639404,
-0.020855482667684555,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "arr", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def cleanup_entries(arr):
#if g_debug: print("cleanup_entries...")
seen = set()
uniq = []
for r in arr:
x = r["number"]
# make international format
if x.startswith("00"): x = "+"+x[2:]
elif x.startswith("0"): x = "+41"+x[1:]
r["number"] = x
# filter
if len(x) < 4:
# too dang... | |
16,607 | [
0.04701600223779678,
0.002597194630652666,
0.03759035840630531,
-0.00005851577589055523,
-0.01458730362355709,
-0.021039379760622978,
0.003651501378044486,
0.016027333214879036,
-0.04129328951239586,
-0.008191332221031189,
-0.019468439742922783,
-0.027603667229413986,
0.026088831946253777,
... | 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": "control_field_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment":... | class SelectControlForm(BaseControlForm):
control_field_name = None
def __init__(self, *args, **kwargs):
self.control_field_name = kwargs.pop('control_field_name', self.__class__.control_field_name)
field = forms.ChoiceField(choices=kwargs.pop('choices', ()))
self.base_fields[self.contr... | |
16,608 | [
0.005213586613535881,
0.03960219398140907,
-0.011047420091927052,
-0.008232902735471725,
0.011790546588599682,
0.001844650018028915,
-0.005517859011888504,
0.027150439098477364,
-0.027922824025154114,
0.018654225394129753,
0.01803397759795189,
-0.047045160084962845,
0.034991297870874405,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "form_classes", "ctx": {"_type": "Store", "_fields": {}}}}], "... | class FilterGroup(object):
form_classes = []
def __init__(self, group_id, data=None, form_classes=()):
self.id = group_id
self.forms = SortedDict()
self.data = data
self.form_classes = form_classes or self.__class__.form_classes
def add_form(self, form_class, initial=None):... | |
16,609 | [
0.00303861522115767,
0.041708990931510925,
-0.011904393322765827,
-0.025355717167258263,
0.0038527895230799913,
0.0012205346720293164,
-0.019202884286642075,
0.021947816014289856,
-0.042127709835767746,
0.042662739753723145,
0.028310008347034454,
-0.04433761164546013,
0.05750397592782974,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "(?P<group_id>\\d+)-(?P<form_class_id>\\d+)-(?P<form_id>\\d+)-(?P<field_name>\\w+)"}}], "func": {"_... | class Filter(object):
field_name_ptr = re.compile(r'(?P<group_id>\d+)-(?P<form_class_id>\d+)-(?P<form_id>\d+)-(?P<field_name>\w+)')
control_form_ptr = re.compile(r'(\d+)-control-new-criteria-(\w+)')
control_group_ptr = re.compile(r'control-new-group-(\w+)')
control_remove_field_ptr = re.compile(r'contro... | |
16,610 | [
0.04718626290559769,
0.017711589112877846,
0.008454019203782082,
0.00014334166189655662,
0.013559912331402302,
-0.02410650998353958,
0.02941887080669403,
-0.022611014544963837,
-0.05057903006672859,
0.025981461629271507,
-0.014084451831877232,
-0.002693846821784973,
0.06044484302401543,
-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": "form_class_id", "annotation": null, "type_comment": null}}, {"_ty... | def build_form(self, form_class_id, form_id, initial=None):
form_class = self.form_classes[form_class_id]
form_for_class = self.forms.get(form_class, SortedDict())
if form_id not in form_for_class:
form = form_class(data=self.data, initial=initial, prefix=self.get_prefix(form_class, ... | |
16,611 | [
0.05064352974295616,
0.05772370472550392,
0.02658447064459324,
-0.02029348909854889,
0.012796172872185707,
0.00405869772657752,
0.0050902836956083775,
0.007502953987568617,
0.0005925980512984097,
0.020958663895726204,
0.002119542332366109,
-0.06877238303422928,
0.031184328719973564,
0.0298... | 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": "criteria_form", "annotation": null, "type_comment": null}}, {"_ty... | def _process_criteria_form(self, criteria_form, group, params_copy, params_data, fname):
form_class = criteria_form.get_form_class()
if form_class:
self._add_empty_params(group.add_form(form_class, {'q': ''}), params_copy)
self.has_control_params = True
del params_copy[fname... | |
16,612 | [
0.031068403273820877,
0.025389736518263817,
0.0012334085768088698,
-0.0373806394636631,
0.013879879377782345,
-0.012049565091729164,
0.008881715126335621,
-0.005294417031109333,
-0.05246899276971817,
0.014665975235402584,
0.05425237491726875,
-0.024779632687568665,
0.059977974742650986,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def build_from_params(self):
copy = self.data.copy()
data = self.data.copy()
# first take care of sorting params
self.sort_by = data.get('sort', 'id')
# before everything - try to check if there is something to remove
for fname in data.keys():
match = self.c... | |
16,613 | [
-0.016563285142183304,
0.0554160512983799,
-0.016067082062363625,
-0.025008676573634148,
-0.029653145000338554,
0.0157792828977108,
-0.03332505375146866,
0.02758893556892872,
-0.039239801466464996,
0.04191930592060089,
-0.00017025995475705713,
-0.036778632551431656,
0.0200069397687912,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "MetaFilter", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "__metaclass__", "ctx": {"_type": "Store", "_fields": ... | class ModelFilter(Filter):
__metaclass__ = MetaFilter
def get_form_classes(self):
return [f.create_form_class() for f in self.base_filters.values()]
def queryset(self):
query = Q() if not self.is_valid() else self.construct_Q()
queryset = self._meta.model.objects.filter(query)
... | |
16,614 | [
-0.023074185475707054,
0.001725822570733726,
0.0627112090587616,
-0.0450863242149353,
-0.05563091114163399,
-0.019116804003715515,
0.013756006956100464,
-0.03039470687508583,
-0.01785246469080448,
0.002154117450118065,
0.04225420579314232,
0.01706857420504093,
-0.019243238493800163,
0.0174... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pdf", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "txt", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def text(pdf, txt, stretching, nostamp):
pdf.set_stretching(100)
if not nostamp:
pdf.write(8, "Text: stretching %.2f%%\n" %(stretching))
pdf.set_stretching(stretching)
if not nostamp:
pdf.write(8, txt)
if not nostamp:
txtc = "Cell example: stretching %.2f%%" %(stretching)
... | |
16,615 | [
0.02201046049594879,
0.007362948264926672,
0.001520665711723268,
-0.03302614018321037,
0.03315155580639839,
0.04136628657579422,
-0.027904998511075974,
0.015394779853522778,
-0.011245610192418098,
-0.03413397818803787,
0.02514585293829441,
-0.030956782400608063,
0.044773414731025696,
-0.01... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "processor", "annotatio... | class ThriftHeaderServerProtocol(FramedProtocol):
def __init__(self, processor, server_event_handler, loop=None):
super().__init__(loop=loop)
self.processor = processor
self.server_event_handler = server_event_handler
self.server_context = None
@asyncio.coroutine
def messag... | |
16,616 | [
-0.015703381970524788,
-0.037101663649082184,
0.017569370567798615,
-0.07875924557447433,
-0.03324851766228676,
0.018635649234056473,
-0.005855447147041559,
0.008608991280198097,
0.017739005386829376,
-0.03610808402299881,
0.03276384621858597,
0.03601115196943283,
-0.0546710342168808,
-0.0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "outputname", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "nostamp", "annotation": null, "type_comment": null}}], "kwa... | def dotest(outputname, nostamp):
fpdf.set_global("FPDF_CACHE_MODE", 1)
pdf = FPDF()
if nostamp:
pdf._putinfo = lambda: common.test_putinfo(pdf)
pdf.add_page()
# Add a Unicode font (uses UTF-8)
pdf.add_font('DejaVu', '', \
os.path.join(common.basepath, "font", 'DejaVuSans.ttf'), ... | |
16,617 | [
0.04076305404305458,
0.003103654831647873,
0.009904184378683567,
0.008872497826814651,
0.030033521354198456,
0.016552826389670372,
-0.022548066452145576,
0.058462198823690414,
-0.0009836837416514754,
-0.018822534009814262,
0.02946036122739315,
0.02094322256743908,
0.016254782676696777,
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": "frame", "annotation": null, "type_comment": null}}], "kwarg": nul... | def message_received(self, frame):
# Note: we are using a single `prot` for in and out so that
# we can support legacy clients that only understand FRAMED.
# The discovery of what the client supports happens in iprot's
# transport so we have to reuse a single one here.
buf = TRea... | |
16,618 | [
0.025687187910079956,
0.007943600416183472,
0.015034560114145279,
-0.03969641774892807,
0.03270259499549866,
0.06790915131568909,
0.0010725479805842042,
0.01615702547132969,
0.003637219313532114,
-0.03961007669568062,
0.012886765412986279,
-0.017743587493896484,
0.026054147630929947,
-0.03... | 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": "fname", "annotation": ... | class ThriftHeaderClientProtocol(ThriftHeaderClientProtocolBase):
@asyncio.coroutine
def timeout_task(self, fname, seqid, delay):
yield from asyncio.sleep(delay, loop=self.loop)
self._handle_timeout(fname, seqid)
def wrapAsyncioTransport(self, asyncio_transport):
return SenderTransp... | |
16,619 | [
-0.0026189605705440044,
-0.015136155299842358,
0.06694621592760086,
-0.01637590117752552,
0.05950774624943733,
0.014561365358531475,
-0.017322614789009094,
-0.011856467463076115,
-0.0020145850721746683,
0.009258639067411423,
-0.0188441202044487,
0.0069707464426755905,
0.0007558216457255185,
... | 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": "left_shape", "annotati... | class SquaredDifferenceOpTest(tf.test.TestCase):
def _testGrad(self, left_shape, right_shape):
if len(left_shape) > len(right_shape):
output_shape = left_shape
else:
output_shape = right_shape
l = np.random.randn(*left_shape)
r = np.random.randn(*right_shape)
with self.test_session(... | |
16,620 | [
0.018823036924004555,
-0.0186392180621624,
-0.01115779671818018,
-0.01996271312236786,
0.007898078300058842,
0.04676348343491554,
0.013185929507017136,
0.012511927634477615,
0.0673021599650383,
-0.007303730584681034,
0.01928871124982834,
-0.0289453212171793,
0.050194766372442245,
-0.018896... | 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_debug(self):
url = "/debug/"
# We should have the debug flag in the template.
response = self.client.get(url)
self.assertContains(response, "Have debug")
# And now we should not
with override_settings(DEBUG=False):
response = self.client.get(url)
... | |
16,621 | [
-0.0014762298669666052,
-0.0028218324296176434,
0.047014620155096054,
0.04481221362948418,
0.03908146545290947,
-0.02206900343298912,
0.022529711946845055,
0.04559878632426262,
0.011607577092945576,
0.022349923849105835,
0.008478138595819473,
0.03746337071061134,
-0.002755816327407956,
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": "shape", "annotation": null, "type_comment": null}}, {"_type": "ar... | def _testGrad(self, shape, dtype=None, max_error=None, bias=None, sigma=None):
np.random.seed(7)
if dtype in (tf.complex64, tf.complex128):
value = tf.complex(self._biasedRandN(shape, bias=bias, sigma=sigma),
self._biasedRandN(shape, bias=bias, sigma=sigma))
else:
value ... | |
16,622 | [
0.008266265504062176,
-0.032532114535570145,
0.07825472205877304,
-0.001031201332807541,
0.05427200347185135,
-0.010886600241065025,
-0.004463450517505407,
0.03399772569537163,
-0.0003861800651066005,
0.043746255338191986,
-0.022894613444805145,
0.008266265504062176,
-0.010370304808020592,
... | 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": "left_shape", "annotation": null, "type_comment": null}}, {"_type"... | def _testGrad(self, left_shape, right_shape):
if len(left_shape) > len(right_shape):
output_shape = left_shape
else:
output_shape = right_shape
l = np.random.randn(*left_shape)
r = np.random.randn(*right_shape)
with self.test_session(use_gpu=True):
left_tensor = tf.constant(l, sh... | |
16,623 | [
-0.011969535611569881,
0.010925289243459702,
0.08309058099985123,
-0.03956908360123634,
0.03597597777843475,
-0.01545035745948553,
0.0191669762134552,
0.029620669782161713,
0.02780166082084179,
0.010318952612578869,
-0.028228340670466423,
-0.004774901550263166,
-0.01933540403842926,
0.0311... | 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 MinOrMaxGradientTest(tf.test.TestCase):
def testMinGradient(self):
inputs = tf.constant([1.0], dtype=tf.float32)
outputs = tf.reduce_min(tf.concat(0, [inputs, inputs]))
with self.test_session():
error = tf.test.compute_gradient_error(inputs, [1], outputs, [])
self.assertLess(error, 1e-4... | |
16,624 | [
0.022832557559013367,
0.005661972798407078,
0.02769980952143669,
0.027910854667425156,
0.021711373701691628,
-0.007670208811759949,
0.013196980580687523,
-0.019680054858326912,
0.039360109716653824,
0.04075828939676285,
0.018796298652887344,
0.008507798425853252,
0.0004418778989929706,
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 testComplexAbs(self):
# Bias random test values away from zero to avoid numeric instabilities.
self._testGrad([3, 3], dtype=tf.float32, max_error=2e-5, bias=0.1,
sigma=1.0)
self._testGrad([3, 3], dtype=tf.complex64, max_error=2e-5, bias=0.1,
sigma=1.0)
# Ensure... | |
16,625 | [
-0.02646672911942005,
0.010827822610735893,
0.08168458938598633,
-0.03638886660337448,
0.012298837304115295,
-0.025382215157151222,
0.024551525712013245,
0.06285559386014938,
0.02713589556515217,
0.038742490112781525,
0.0017306056106463075,
0.005263925530016422,
-0.02045575901865959,
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 testSegmentMinGradientWithTies(self):
inputs = tf.constant([1.0], dtype=tf.float32)
data = tf.concat(0, [inputs, inputs])
segment_ids = tf.constant([0, 0], dtype=tf.int64)
segment_min = tf.segment_min(data, segment_ids)
with self.test_session():
error = tf.test.compute_gradient_error(input... | |
16,626 | [
-0.017745399847626686,
0.00886109471321106,
0.07910571992397308,
-0.03660496696829796,
0.024859808385372162,
0.004944107495248318,
0.0008711668779142201,
0.03820657730102539,
0.011164862662553787,
0.020774537697434425,
0.0028216810896992683,
-0.0043812221847474575,
-0.008698612451553345,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class SegmentMinOrMaxGradientTest(tf.test.TestCase):
def testSegmentMinGradient(self):
data = tf.constant([1.0, 2.0, 3.0], dtype=tf.float32)
segment_ids = tf.constant([0, 0, 1], dtype=tf.int64)
segment_min = tf.segment_min(data, segment_ids)
with self.test_session():
error = tf.test.compute_gra... | |
16,627 | [
0.026171080768108368,
0.0002950434572994709,
-0.06598833948373795,
-0.048906758427619934,
-0.018286356702446938,
-0.007837009616196156,
0.01660444214940071,
-0.015805233269929886,
-0.04253695160150528,
0.0008409576839767396,
0.003217706922441721,
-0.038314271718263626,
0.004494054242968559,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "before_replace"}}, "targets": [{"_type": "Name", "_fields": {"id": "hook", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": n... | class FrPhotographie(object):
hook = 'before_replace'
def __init__(self, CommonsDelinker):
self.CommonsDelinker = CommonsDelinker
def __call__(self, page, summary, image, replacement):
site = page.site()
if (site.lang, site.family.name) == ('fr', 'wikibooks') and replacement.get() is... | |
16,628 | [
-0.002467252779752016,
0.02187814936041832,
0.09011796861886978,
-0.041430070996284485,
0.005789393093436956,
-0.001379015389829874,
0.01245693676173687,
0.05261921510100365,
0.025658264756202698,
0.025681527331471443,
0.008665189146995544,
0.011642757803201675,
-0.027286622673273087,
-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 testSegmentMaxGradientWithTies(self):
inputs = tf.constant([1.0], dtype=tf.float32)
data = tf.concat(0, [inputs, inputs])
segment_ids = tf.constant([0, 0], dtype=tf.int64)
segment_max = tf.segment_max(data, segment_ids)
with self.test_session():
error = tf.test.compute_gradient_error(input... | |
16,629 | [
-0.03316040709614754,
0.0020519935060292482,
-0.08618614077568054,
-0.008666924200952053,
-0.010840902104973793,
0.0005492313066497445,
-0.06836917996406555,
0.01421298272907734,
-0.0010223734425380826,
0.02726651169359684,
0.00250248983502388,
-0.05627220496535301,
0.004920436069369316,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs"... | class UrlHandler(object):
@staticmethod
def get_query(url):
parsed = urlparse(url)
parameters = parse_qs(parsed.query)
if 'q' in parameters:
return ''.join(parameters['q'])
return None | |
16,630 | [
0.013817012310028076,
0.04390011727809906,
0.029650915414094925,
-0.017615053802728653,
-0.010798224247992039,
0.016698284074664116,
-0.006784087512642145,
0.0429309606552124,
-0.04117600619792938,
0.0006466492777690291,
0.025774292647838593,
-0.014537329785525799,
-0.014746877364814281,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "key", "annotation": null, "type_comment": null}}], "kwarg": null,... | def queues(self, key):
workers = []
# bit is for negate bindings - if we choose to implement it.
# last stops processing rules if this matches.
for (binding, exchange, bit, last) in self.bindings:
if binding.test(key):
workers.extend(exchange.run(key))
... | |
16,631 | [
0.025111118331551552,
0.0020203818567097187,
-0.0035706216003745794,
-0.0051346891559660435,
0.022099750116467476,
-0.003736554179340601,
0.024545719847083092,
0.02270202524960041,
0.019813569262623787,
-0.0038717584684491158,
0.03957797586917877,
-0.04454365745186806,
-0.0045815808698534966... | 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": "ring", "annotation": null, "type_comment": null}}], "kwarg": null... | def __init__(self, ring=None):
super(RingExchange, self).__init__()
if ring:
self.ring = ring
else:
fh = open(CONF.matchmaker_ringfile, 'r')
self.ring = json.load(fh)
fh.close()
self.ring0 = {}
for k in self.ring.keys():
... | |
16,632 | [
0.008829440921545029,
0.03316303342580795,
0.0011369608109816909,
-0.006885230541229248,
0.016321463510394096,
0.025881530717015266,
-0.019516408443450928,
0.01068077515810728,
0.04624002054333687,
0.021250098943710327,
0.04039500281214714,
0.006687094457447529,
-0.021807357668876648,
0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value... | def killIfDead():
if not self._isalive:
self.log.debug("WampLongPoll: killing inactive WAMP session with transport '{0}'".format(self._transport_id))
self.onClose(False, 5000, "session inactive")
self._receive._kill()
if se... | |
16,633 | [
-0.003026832127943635,
-0.01947646401822567,
0.04184572026133537,
-0.04022476077079773,
0.01702008582651615,
-0.007250681519508362,
-0.014426548965275288,
0.026982760056853294,
-0.031047629192471504,
-0.026633629575371742,
0.016970209777355194,
-0.045661211013793945,
-0.008865407668054104,
... | 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_database_routing(self):
marty = Person.objects.using('default').create(name="Marty Alchin")
pro = Book.objects.using('default').create(title="Pro Django",
published=datetime.date(2008, 12, 16),
... | |
16,634 | [
0.010451502166688442,
-0.026128755882382393,
0.04408101364970207,
-0.015677252784371376,
0.00462884409353137,
0.01829012855887413,
0.02369607798755169,
0.010935785248875618,
0.00901554711163044,
0.0301156435161829,
-0.006239366717636585,
-0.04225650429725647,
0.005687509197741747,
-0.01297... | 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 UserProfileTestCase(TestCase):
def setUp(self):
self.old_auth_profile_module = getattr(settings, 'AUTH_PROFILE_MODULE', _missing)
settings.AUTH_PROFILE_MODULE = 'multiple_database.UserProfile'
def tearDown(self):
if self.old_auth_profile_module is _missing:
del setting... | |
16,635 | [
0.01311305072158575,
-0.07049176096916199,
0.04649456590414047,
-0.009910300374031067,
-0.006764834281057119,
0.0314546562731266,
-0.01715424470603466,
0.0385788232088089,
-0.04836934804916382,
-0.02901744283735752,
0.030225634574890137,
-0.028809133917093277,
0.025663668289780617,
-0.0159... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "multi_db", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {... | class PickleQuerySetTestCase(TestCase):
multi_db = True
def test_pickling(self):
for db in connections:
Book.objects.using(db).create(title='Dive into Python', published=datetime.date(2009, 5, 4))
qs = Book.objects.all()
self.assertEqual(qs.db, pickle.loads(pickle.du... | |
16,636 | [
0.02467467449605465,
-0.02555425837635994,
0.021630847826600075,
-0.0029237521812319756,
0.03439640253782272,
0.006324910558760166,
0.025577405467629433,
0.03694257140159607,
0.024049706757068634,
0.0018228242406621575,
0.013297936879098415,
-0.02188546396791935,
0.02182759717106819,
-0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_user_profiles(self):
alice = User.objects.create_user('alice', 'alice@example.com')
bob = User.objects.db_manager('other').create_user('bob', 'bob@example.com')
alice_profile = UserProfile(user=alice, flavor='chocolate')
alice_profile.save()
bob_profile = UserProfile(... | |
16,637 | [
0.037581611424684525,
-0.018225234001874924,
0.040859613567590714,
-0.030032970011234283,
-0.020349010825157166,
-0.019575679674744606,
0.019541053101420403,
0.05614157021045685,
-0.008622070774435997,
0.01484335120767355,
0.006550234742462635,
-0.08074967563152313,
-0.01637847162783146,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "multi_db", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {... | class RouterModelArgumentTestCase(TestCase):
multi_db = True
def setUp(self):
self.old_routers = router.routers
router.routers = [ModelMetaRouter()]
def tearDown(self):
router.routers = self.old_routers
def test_m2m_collection(self):
b = Book.objects.create(title="Pro ... | |
16,638 | [
0.06204565614461899,
-0.009510391391813755,
0.025922544300556183,
-0.03963248059153557,
0.001228279434144497,
-0.027677228674292564,
0.03621669486165047,
0.04360976815223694,
0.007463259622454643,
-0.029853038489818573,
0.042252808809280396,
-0.056851789355278015,
-0.024378420785069466,
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_m2m_collection(self):
b = Book.objects.create(title="Pro Django",
published=datetime.date(2008, 12, 16))
p = Person.objects.create(name="Marty Alchin")
# test add
b.authors.add(p)
# test remove
b.authors.remove(p)
# test c... | |
16,639 | [
0.000049704238335834816,
0.0027751929592341185,
-0.03747609630227089,
-0.02781619317829609,
0.028898535296320915,
0.01485514547675848,
-0.03163144737482071,
0.01988803595304489,
0.013766039162874222,
0.010924890637397766,
0.01735806278884411,
-0.043834857642650604,
0.007096105720847845,
0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_exceptionUsedInExcept(self):
as_exc = ', ' if version_info < (2, 6) else ' as '
self.flakes('''
try: pass
except Exception%se: e
''' % as_exc)
self.flakes('''
def download_review():
try: pass
except Exception%se: e
''' % a... | |
16,640 | [
-0.0073424517177045345,
-0.015169722028076649,
0.058994781225919724,
-0.06292436271905899,
0.0016538059571757913,
0.02597607672214508,
-0.01109341811388731,
0.02322026528418064,
0.02970152534544468,
0.015616266056895256,
0.010047229938209057,
-0.025172298774123192,
-0.017734158784151077,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs"... | class TestServicePPPoEServer(BasicAccelPPPTest.TestCase):
@classmethod
def setUpClass(cls):
cls._base_path = ['service', 'pppoe-server']
cls._config_file = '/run/accel-pppd/pppoe.conf'
cls._chap_secrets = '/run/accel-pppd/pppoe.chap-secrets'
# call base-classes classmethod
... | |
16,641 | [
0.0090855797752738,
-0.015576890669763088,
0.04710289090871811,
-0.04809548333287239,
-0.01564456708729267,
0.0014479965902864933,
0.014076726511120796,
0.006795855704694986,
0.03277801722288132,
0.02379959262907505,
0.03444737195968628,
-0.017178568989038467,
-0.020799266174435616,
0.0280... | 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_pppoe_server_ppp_options(self):
# Test configuration of local authentication for PPPoE server
self.basic_config()
# other settings
mppe = 'require'
self.set(['ppp-options', 'ccp'])
self.set(['ppp-options', 'mppe', mppe])
self.set(['limits', 'connection-l... | |
16,642 | [
0.007944686338305473,
-0.0517970509827137,
0.03666188195347786,
-0.013102659955620766,
-0.016937585547566414,
0.04806439206004143,
0.008871459402143955,
-0.003441845066845417,
0.03903953358530998,
0.05522291734814644,
0.013217708095908165,
-0.020606329664587975,
-0.041775114834308624,
0.03... | 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": "conf", "annotation": null, "type_comment": null}}], "kwarg": null... | def verify(self, conf):
mtu = '1492'
# validate some common values in the configuration
for tmp in ['log_syslog', 'pppoe', 'ippool',
'auth_mschap_v2', 'auth_mschap_v1', 'auth_chap_md5',
'auth_pap', 'shaper']:
# Settings without values provide ... | |
16,643 | [
0.014144881628453732,
-0.03152889013290405,
0.07832793891429901,
-0.027869097888469696,
0.012777718715369701,
-0.02799529768526554,
0.01228343602269888,
0.03834367170929909,
0.022358378395438194,
0.007687664125114679,
0.005032212473452091,
-0.03520971164107323,
-0.028689395636320114,
-0.01... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_pppoe_server_client_ip_pool(self):
# Test configuration of IPv6 client pools
self.basic_config()
subnet = '172.18.0.0/24'
self.set(['client-ip-pool', 'subnet', subnet])
start = '192.0.2.10'
stop = '192.0.2.20'
stop_octet = stop.split('.')[3]
sta... | |
16,644 | [
0.018225662410259247,
-0.025351570919156075,
0.03980601951479912,
-0.03510044142603874,
0.004289053380489349,
0.023100098595023155,
-0.004032948520034552,
0.016998611390590668,
0.038500163704156876,
0.021760473027825356,
0.03352441266179085,
-0.00679944409057498,
-0.006979561876505613,
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_pppoe_server_authentication_protocols(self):
# Test configuration of local authentication for PPPoE server
self.basic_config()
# explicitly test mschap-v2 - no special reason
self.set( ['authentication', 'protocols', 'mschap-v2'])
# commit changes
self.cli_comm... | |
16,645 | [
-0.012858368456363678,
-0.0324147492647171,
0.05824808403849602,
-0.03225928172469139,
-0.03847793862223625,
0.0002566815528552979,
-0.005059136543422937,
0.027491645887494087,
0.03876296058297157,
0.027491645887494087,
0.0054639969021081924,
0.0017425194382667542,
-0.011264837346971035,
-... | 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_accel_radius_authentication(self):
radius_called_sid = 'ifname:mac'
radius_acct_interim_jitter = '9'
self.set(['authentication', 'radius', 'called-sid-format', radius_called_sid])
self.set(['authentication', 'radius', 'acct-interim-jitter', radius_acct_interim_jitter])
... | |
16,646 | [
0.021081676706671715,
-0.04406145215034485,
0.08112766593694687,
-0.02493118867278099,
0.014651605859398842,
-0.025059150531888008,
0.009010630659759045,
0.028386153280735016,
0.019695427268743515,
0.012294978834688663,
0.007656370289623737,
-0.03117998130619526,
-0.02390749566257,
-0.0158... | 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_pppoe_server_client_ipv6_pool(self):
# Test configuration of IPv6 client pools
self.basic_config()
# Enable IPv6
allow_ipv6 = 'allow'
random = 'random'
self.set(['ppp-options', 'ipv6', allow_ipv6])
self.set(['ppp-options', 'ipv6-intf-id', random])
... | |
16,647 | [
0.03860418498516083,
0.01678592711687088,
0.034927595406770706,
-0.02870037406682968,
0.04457864165306091,
0.01035764068365097,
0.04349864274263382,
0.0029211649671196938,
-0.030377816408872604,
0.015901247039437294,
0.02493187040090561,
0.02449527382850647,
-0.01912975311279297,
0.0100474... | 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": "num_remote_workers", "annotation": null, "type_comment": null}}],... | def testReadFromLocalWorker(self, num_remote_workers):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=1,
num_remote_workers=num_remote_workers,
worker_tags=[_COLOCATED_WORKER_TAG])
num_elements = 100
dataset = self.make_distributed_range_dataset(num_elements, ... | |
16,648 | [
-0.0015700426883995533,
-0.03378549963235855,
0.04179498925805092,
-0.05582373961806297,
0.00946576427668333,
0.004808729514479637,
-0.016953427344560623,
0.028373021632432938,
0.024598851799964905,
0.02259647846221924,
0.018179122358560562,
-0.008828645572066307,
-0.011207222938537598,
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_pppoe_server_vlan(self):
vlans = ['100', '200', '300-310']
# Test configuration of local authentication for PPPoE server
self.basic_config()
for vlan in vlans:
self.set(['interface', interface, 'vlan', vlan])
# commit changes
self.cli_commit()
... | |
16,649 | [
0.0278311837464571,
0.0086826765909791,
0.012738477438688278,
-0.009434398263692856,
0.007849372923374176,
0.021584318950772285,
0.055382657796144485,
-0.020418858155608177,
-0.002523220842704177,
0.0045336391776800156,
0.01826275885105133,
0.036991700530052185,
-0.004827918019145727,
0.00... | 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": "num_remote_workers", "annotation": null, "type_comment": null}}],... | def testLocalWorkerHasNoTag(self, num_remote_workers):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=0,
num_remote_workers=num_remote_workers,
worker_tags=[_COLOCATED_WORKER_TAG])
cluster.start_local_worker(worker_tags=None)
num_elements = 100
dataset = ... | |
16,650 | [
0.023687245324254036,
0.02385125122964382,
0.05168551951646805,
-0.024296412244439125,
0.0485459640622139,
-0.004185097757726908,
0.03591745346784592,
0.010871296748518944,
-0.022023748606443405,
0.0004125791892874986,
0.014690308831632137,
0.03849470242857933,
-0.009184371680021286,
-0.00... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "num_local_workers", "annotation": null, "type_comment": null}}, {... | def testReadFromLocalAndNonTpuWorkers(self, num_local_workers,
num_remote_workers):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=num_local_workers,
num_remote_workers=num_remote_workers,
worker_tags=[_COLOCATED_WORKER_TAG])
... | |
16,651 | [
0.04042605310678482,
-0.0002690793771762401,
0.05524661764502525,
-0.0014169701607897878,
0.07162114232778549,
0.029014911502599716,
0.03801393881440163,
-0.01748780347406864,
-0.02346009761095047,
0.006331791169941425,
0.020108655095100403,
0.022265639156103134,
-0.011231391690671444,
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 testReadFromLocalWorker_StaticSharding(self):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=1,
num_remote_workers=3,
worker_addresses=["localhost:%port%"] * 5,
worker_tags=[_COLOCATED_WORKER_TAG])
cluster.start_remote_worker(worker_tags=None)
num... | |
16,652 | [
0.017736688256263733,
0.01146035734564066,
0.05767375975847244,
-0.010875825770199299,
0.04662080109119415,
-0.0005609139334410429,
0.03478847071528435,
0.0178902018815279,
-0.024444038048386574,
-0.0040267715230584145,
0.02647513709962368,
0.033347807824611664,
-0.007285976316779852,
-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": "num_local_workers", "annotation": null, "type_comment": null}}, {... | def testReadFromLocalAndNonTpuWorkers_DynamicSharding(self, num_local_workers,
num_remote_workers):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=num_local_workers,
num_remote_workers=3,
worker_tags=[_COLOCATED_... | |
16,653 | [
0.03258208557963371,
0.014363386668264866,
0.03681352362036705,
-0.025059524923563004,
0.04158564656972885,
0.041374076157808304,
0.04880260303616524,
0.023649046197533607,
-0.03354591131210327,
-0.014574958011507988,
0.030513381585478783,
0.016655415296554565,
-0.025012509897351265,
0.002... | 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": "num_local_workers", "annotation": null, "type_comment": null}}, {... | def testCoordinatedRead(self, num_local_workers, num_remote_workers):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=num_local_workers,
num_remote_workers=num_remote_workers,
worker_tags=[_COLOCATED_WORKER_TAG])
num_consumers = 4
dataset = self.make_coordinate... | |
16,654 | [
0.014882436953485012,
0.005233578383922577,
0.04893307387828827,
-0.0172254778444767,
0.0014070025645196438,
0.017331445589661598,
0.03861898183822632,
0.042339589446783066,
-0.004524189978837967,
0.017437411472201347,
0.0032378719188272953,
0.012362783774733543,
-0.019992386922240257,
-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": "num_local_workers", "annotation": null, "type_comment": null}}, {... | def testAddRemoteWorkersMidJob(self, num_local_workers, num_remote_workers):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=num_local_workers,
num_remote_workers=num_remote_workers,
worker_tags=[_COLOCATED_WORKER_TAG])
# num_elements needs to be bigger than (100 ... | |
16,655 | [
0.022144468501210213,
-0.021661492064595222,
0.030982935801148415,
-0.02873709611594677,
-0.009273147210478783,
0.00692467438057065,
0.025597749277949333,
0.008101928979158401,
-0.0056840283796191216,
0.0029718142468482256,
0.022120319306850433,
0.009514635428786278,
-0.004126429557800293,
... | 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 testUnusedTags(self):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=1,
num_remote_workers=3,
worker_tags=["Unused tag 1", "Unused tag 2", "Unused tag 3"])
num_elements = 100
dataset = self.make_distributed_range_dataset(num_elements, cluster)
# The ta... | |
16,656 | [
0.025257494300603867,
-0.011504109017550945,
0.03744107112288475,
-0.02070036716759205,
-0.009243118576705456,
0.0258198119699955,
0.04971836879849434,
-0.015709785744547844,
-0.02052464336156845,
0.005134089384227991,
0.0185213815420866,
0.015873795375227928,
-0.01042633131146431,
-0.0080... | 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 testMultipleTags(self):
cluster = multi_process_cluster.MultiProcessCluster(
num_local_workers=1,
num_remote_workers=3,
worker_tags=[_COLOCATED_WORKER_TAG, "COLOCATED_2", "COLOCATED_3"])
num_elements = 100
dataset = self.make_distributed_range_dataset(num_elements, cluster)
#... | |
16,657 | [
0.021212052553892136,
-0.009489602409303188,
0.04592299833893776,
-0.0016487392131239176,
0.0319734551012516,
-0.00784949492663145,
-0.03510404750704765,
-0.00018433220975566655,
0.020486950874328613,
-0.03632405772805214,
0.004497346468269825,
-0.03247987478971481,
-0.00014485814608633518,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": {"_type": "Name", "_fields": {"id": "Callable", "ctx": {"_type": "Load", "_fields": {}}}}, "type_comment": null}}], "kwarg": null, "var... | def dfapi(f: Callable) -> Callable:
def _api(self: "GroupedData") -> DataFrame:
name = f.__name__
jdf = getattr(self._jgd, name)()
return DataFrame(jdf, self.session)
_api.__name__ = f.__name__
_api.__doc__ = f.__doc__
return _api | |
16,658 | [
-0.004133885260671377,
0.009707569144666195,
0.05648443102836609,
-0.02005751058459282,
0.001486869528889656,
-0.015328324399888515,
-0.05440225824713707,
-0.057902079075574875,
0.010709891095757484,
-0.041156105697155,
-0.0173661932349205,
-0.05843369662761688,
0.021563762798905373,
-0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": {"_type": "Name", "_fields": {"id": "Callable", "ctx": {"_type": "Load", "_fields": {}}}}, "type_comment": null}}], "kwarg": null, "var... | def df_varargs_api(f: Callable) -> Callable:
def _api(self: "GroupedData", *cols: str) -> DataFrame:
name = f.__name__
jdf = getattr(self._jgd, name)(_to_seq(self.session._sc, cols))
return DataFrame(jdf, self.session)
_api.__name__ = f.__name__
_api.__doc__ = f.__doc__
return _... | |
16,659 | [
-0.014136606827378273,
0.021664593368768692,
-0.0017170514911413193,
-0.0038288896903395653,
0.04508139193058014,
0.01173543930053711,
-0.01555351261049509,
0.02267048880457878,
0.0058785355649888515,
-0.008355416357517242,
0.03463306650519371,
-0.031950678676366806,
0.021697042509913445,
... | 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": "pid", "annotation": null, "type_comment": null}}], "kwarg": null,... | def get_proc_inodes(self, pid):
inodes = defaultdict(list)
for fd in os.listdir("/proc/%s/fd" % pid):
try:
inode = os.readlink("/proc/%s/fd/%s" % (pid, fd))
except OSError:
# TODO: need comment here
continue
else:
... | |
16,660 | [
0.036689624190330505,
0.05529966205358505,
0.03671172633767128,
-0.04628197103738785,
0.021207045763731003,
0.01442167442291975,
-0.017615441232919693,
-0.00788495410233736,
-0.06104623153805733,
-0.019858811050653458,
0.04159630835056305,
-0.013559689745306969,
-0.00023310896358452737,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "migrate_engine", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonl... | def upgrade(migrate_engine):
meta = sqlalchemy.MetaData()
meta.bind = migrate_engine
raw_template = sqlalchemy.Table(
'raw_template', meta,
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True,
nullable=False),
sqlalchemy.Column('created_at', sqlalc... | |
16,661 | [
0.0041396538726985455,
0.020261745899915695,
0.04860943928360939,
-0.021457059308886528,
0.027820350602269173,
-0.03468754515051842,
-0.01876174472272396,
0.026812536641955376,
-0.013980487361550331,
0.008730480447411537,
0.003805669257417321,
0.0025883824564516544,
0.0776251032948494,
0.0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "kind", "annotation": null, "type_comment": null}}, {"_type": "arg... | def retrieve(self, kind, pid=None):
if kind not in self.tmap:
raise ValueError("invalid %r kind argument; choose between %s"
% (kind, ', '.join([repr(x) for x in self.tmap])))
if pid is not None:
inodes = self.get_proc_inodes(pid)
if not i... | |
16,662 | [
0.011061200872063637,
0.015481283888220787,
0.025508932769298553,
-0.013810008764266968,
0.045476268976926804,
0.008713719435036182,
-0.026322580873966217,
0.02036316506564617,
0.007559220306575298,
0.004989085718989372,
0.038373351097106934,
-0.011413048952817917,
0.021121837198734283,
-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 get_all_inodes(self):
inodes = {}
for pid in pids():
try:
inodes.update(self.get_proc_inodes(pid))
except OSError as err:
# os.listdir() is gonna raise a lot of access denied
# exceptions in case of unprivileged user; that's fin... | |
16,663 | [
0.023318855091929436,
0.0015582403866574168,
0.02287389151751995,
-0.0399632602930069,
0.00010016017768066376,
-0.013077747076749802,
-0.01088074129074812,
0.040491655468940735,
-0.003663994139060378,
0.005753235425800085,
0.011221416294574738,
0.0018406877061352134,
-0.04288333281874657,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_invalid_parameters(self):
# p < .1
assert_raises(ValueError, qsturng, -.1,5,6)
# p > .999
assert_raises(ValueError, qsturng, .9991,5,6)
# p < .9, v = 1
assert_raises(ValueError, qsturng, .89,5,1)
# p >= .9, v = 0
assert_raises(ValueError, qsturng,... | |
16,664 | [
0.02280842512845993,
-0.015538168139755726,
-0.020732847973704338,
-0.02453998476266861,
-0.026649964973330498,
-0.007470934651792049,
-0.028668206185102463,
-0.012648412957787514,
0.012453469447791576,
0.041970252990722656,
0.00749386940151453,
0.023829013109207153,
-0.004601247143000364,
... | 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_vector(self):
# vector input -> vector output
assert_array_almost_equal(np.array([3.98832389,
4.56835318,
6.26400894]),
qsturng([.8932, .9345,.9827],
... | |
16,665 | [
0.002960813930258155,
-0.03160075843334198,
0.044477224349975586,
-0.03632400557398796,
-0.01502722967416048,
0.00954489130526781,
-0.012159544974565506,
0.00271832593716681,
0.007654187269508839,
-0.0025180098600685596,
0.01354418694972992,
-0.014886656776070595,
-0.010803017765283585,
-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_handful_to_tbl(self):
cases = [(0.75, 30.0, 12.0, 5.01973488482),
(0.975, 15.0, 18.0, 6.00428263999),
(0.1, 8.0, 11.0, 1.76248712658),
(0.995, 6.0, 17.0, 6.13684839819),
(0.85, 15.0, 18.0, 4.65007986215),
(0.75, 17.0, ... | |
16,666 | [
0.008989273570477962,
-0.03656889498233795,
0.03412169963121414,
-0.044828180223703384,
-0.010470105335116386,
0.009336886927485466,
-0.013702906668186188,
0.006149275228381157,
0.031312983483076096,
0.007571012247353792,
0.016727140173316002,
-0.020064225420355797,
-0.03236972913146019,
-... | 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_handful_to_ch(self):
cases = [(0.8699908, 10.0, 465.4956, 3.997799075635331),
(0.8559087, 43.0, 211.7474, 5.1348419692951675),
(0.6019187, 11.0, 386.5556, 3.3383101487698821),
(0.658888, 51.0, 74.652, 4.8108880483153733),
(0.6183604, 7... | |
16,667 | [
0.005570344626903534,
-0.03183054178953171,
0.03583048656582832,
-0.03287278115749359,
0.013049113564193249,
0.005183026194572449,
-0.020394081249833107,
0.014035015366971493,
0.04605569317936897,
0.03822481632232666,
0.005915410351008177,
0.009908312000334263,
-0.016887087374925613,
-0.03... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_handful_to_known_values(self):
cases = [(0.71499578726111435, 67, 956.70742488392386, 5.0517658443070692),
(0.42974234855067672, 16, 723.50261736502318, 3.3303582093701354),
(0.94936429359548424, 2, 916.1867328010926, 2.7677975546417244),
(0.8535738177... | |
16,668 | [
0.022700808942317963,
-0.0417376272380352,
0.0738639160990715,
-0.017855314537882805,
-0.009133424609899521,
-0.05153482034802437,
-0.013992195017635822,
0.011416781693696976,
0.013308515772223473,
0.02790473774075508,
0.032551102340221405,
-0.015731262043118477,
-0.02558155544102192,
0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_100_random_values(self):
n = 100
ps = np.random.random(n)*(.999 - .1) + .1
rs = np.random.random_integers(2, 100, n)
vs = np.random.random(n)*998. + 2.
qs = qsturng(ps, rs, vs)
estimates = psturng(qs, rs, vs)
actuals = 1. - ps
errors = estimates -... | |
16,669 | [
0.023040929809212685,
0.021257609128952026,
0.010038011707365513,
-0.020108845084905624,
-0.012789575383067131,
-0.03851095587015152,
-0.03124638833105564,
0.0677880346775055,
-0.06678149849176407,
0.029933515936136246,
-0.006072039715945721,
-0.0020623053424060345,
-0.025885488837957382,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "zh"}}, "targets": [{"_type": "Name", "_fields": {"id": "lang", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_ty... | class SearchChinese(SearchLanguage):
lang = 'zh'
def init(self, options):
print ("Start to execute zh.py")
def split(self, input):
return jieba.cut(input.encode("utf8"),cut_all=True)
def word_filter(self, stemmed_word):
return len(stemmed_word) > 1 | |
16,670 | [
0.016698049381375313,
0.05883379653096199,
0.03772946447134018,
-0.010916752740740776,
-0.04062531888484955,
0.027271049097180367,
-0.004143261816352606,
0.03087524324655533,
-0.027041880413889885,
0.032146088778972626,
0.06787553429603577,
0.01223967969417572,
-0.030541907995939255,
0.010... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "image", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "check_exit_code", "annotation": null, "type_comment": null}}, {"... | def resize2fs(image, check_exit_code=False, run_as_root=False):
try:
utils.execute('e2fsck',
'-fp',
image,
check_exit_code=[0, 1, 2],
run_as_root=run_as_root)
except processutils.ProcessExecutionError as exc:
... | |
16,671 | [
0.05984535068273544,
0.009647408500313759,
-0.005796028766781092,
-0.007041904143989086,
-0.014408819377422333,
-0.039933014661073685,
0.04974834620952606,
-0.003087604185566306,
0.0384162962436676,
0.006121039856225252,
0.02938099205493927,
0.010877033695578575,
-0.0033367793075740337,
-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": "image", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, image, partition=None, use_cow=False, mount_dir=None):
# These passed to each mounter
self.image = image
self.partition = partition
self.mount_dir = mount_dir
self.use_cow = use_cow
# Internal
self._mkdir = False
self._mounter = None
... | |
16,672 | [
0.027482565492391586,
0.05232580006122589,
0.0465863011777401,
-0.012840558774769306,
0.0028069084510207176,
0.03512825071811676,
-0.020486243069171906,
0.023062732070684433,
-0.005823287647217512,
0.01030072569847107,
0.04017649590969086,
0.01296624168753624,
-0.019061841070652008,
0.0152... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "dev", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "run_as_root", "annotation": null, "type_comment": null}}, {"_type"... | def safe_resize2fs(dev, run_as_root=False, finally_call=lambda: None):
try:
resize2fs(dev, run_as_root=run_as_root, check_exit_code=[0])
except processutils.ProcessExecutionError as exc:
LOG.debug("Resizing the file system with resize2fs "
"has failed with e... | |
16,673 | [
0.032261695712804794,
0.03453093394637108,
-0.03324645757675171,
-0.024640485644340515,
0.03183353692293167,
-0.001933400402776897,
0.00021324268891476095,
-0.025239907205104828,
0.041188787668943405,
0.008841459639370441,
0.012020532041788101,
0.04249466955661774,
0.033203642815351486,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _device_for_path(path):
device = None
path = os.path.realpath(path)
with open("/proc/mounts", 'r') as ifp:
for line in ifp:
fields = line.split()
if fields[1] == path:
device = fields[0]
break
return ... | |
16,674 | [
0.026313824579119682,
0.03994135931134224,
0.04096444696187973,
-0.015315628610551357,
0.0024196032900363207,
-0.08888588845729828,
0.011530202813446522,
0.018927128985524178,
-0.015581631101667881,
0.028523694723844528,
0.019254516810178757,
0.0055297911167144775,
0.027889380231499672,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "files", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "fs", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _inject_files_into_fs(files, fs):
for (path, contents) in files:
# NOTE(wangpan): Ensure the parent dir of injecting file exists
parent_dir = os.path.dirname(path)
if (len(parent_dir) > 0 and parent_dir != "/"
and not fs.has_file(parent_dir)):
fs.make_path(par... | |
16,675 | [
0.007227825000882149,
0.019448785111308098,
0.01587560959160328,
-0.01649247668683529,
-0.017027871683239937,
0.000453921384178102,
0.03147188201546669,
-0.03677926957607269,
0.017435237765312195,
0.015759220346808434,
-0.0016483748331665993,
-0.001974266953766346,
-0.006733167450875044,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_runner", "annotation": null, "type_comment": null}}, {"_type"... | def __init__(self, msg_runner, ctxt, method_name, method_kwargs,
direction, need_response=False, fanout=False, uuid=None,
routing_path=None, hop_count=0, max_hop_count=None,
**kwargs):
self.ctxt = ctxt
self.resp_queue = None
self.msg_runner = msg_runner
... | |
16,676 | [
0.020613348111510277,
0.023000555112957954,
0.07285404205322266,
-0.04870408773422241,
-0.04446016252040863,
0.058758147060871124,
-0.01218233723193407,
0.03731117025017738,
-0.02388470619916916,
0.01937553659081459,
0.035795483738183975,
0.011462385766208172,
-0.026120346039533615,
0.0278... | 7 | {"_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 upgrade():
op.drop_table('cisco_n1kv_port_bindings')
op.drop_table('cisco_n1kv_network_bindings')
op.drop_table('cisco_n1kv_multi_segments')
op.drop_table('cisco_provider_networks')
op.drop_table('cisco_n1kv_trunk_segments')
op.drop_table('cisco_n1kv_vmnetworks')
op.drop_table('cisco_n1k... | |
16,677 | [
0.015834836289286613,
0.04652277007699013,
0.06855987012386322,
0.01935753785073757,
-0.031045980751514435,
-0.01883779466152191,
0.02721143141388893,
-0.007876993156969547,
-0.03885367512702942,
-0.004478451795876026,
-0.02755792811512947,
0.014876198954880238,
0.013536416925489902,
-0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_runner", "annotation": null, "type_comment": null}}, {"_type"... | def __init__(self, msg_runner, ctxt, method_name, method_kwargs,
direction, target_cell, **kwargs):
super(_TargetedMessage, self).__init__(msg_runner, ctxt,
method_name, method_kwargs, direction, **kwargs)
if isinstance(target_cell, cells_state.CellState):
# Neigh... | |
16,678 | [
0.002994588343426585,
0.011933532543480396,
0.031060799956321716,
0.019799578934907913,
0.012112815864384174,
-0.054995097219944,
0.006695103831589222,
-0.0020477494690567255,
0.010252753272652626,
0.011675813235342503,
-0.038545869290828705,
0.01711033284664154,
-0.028618067502975464,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_runner", "annotation": null, "type_comment": null}}], "kwarg"... | def __init__(self, msg_runner):
super(_BaseMessageMethods, self).__init__()
self.msg_runner = msg_runner
self.state_manager = msg_runner.state_manager
self.compute_api = compute.API()
self.compute_rpcapi = compute_rpcapi.ComputeAPI()
self.consoleauth_rpcapi = consoleauth_... | |
16,679 | [
0.035439103841781616,
0.06417876482009888,
-0.0038412590511143208,
-0.04175017774105072,
0.019151680171489716,
0.0010710619390010834,
-0.007603629492223263,
0.030851438641548157,
0.03920147567987442,
-0.02507437951862812,
0.007415511179715395,
-0.037599433213472366,
-0.015959734097123146,
... | 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": "ctxt", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _call_compute_api_with_obj(self, ctxt, instance, method, *args,
**kwargs):
try:
# NOTE(comstud): We need to refresh the instance from this
# cell's view in the DB.
instance.refresh()
except exception.InstanceNotFound:
... | |
16,680 | [
-0.009320994839072227,
0.015310322865843773,
0.03180426359176636,
-0.06338933855295181,
-0.0006082483450882137,
0.030664483085274696,
0.013512976467609406,
-0.013085559010505676,
-0.018872138112783432,
-0.012789654545485973,
0.00021747617574874312,
0.03965121507644653,
-0.028428759425878525,... | 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": "message", "annotation": null, "type_comment": null}}, {"_type": "... | def sync_instances(self, message, project_id, updated_since, deleted,
**kwargs):
projid_str = project_id is None and "<all>" or project_id
since_str = updated_since is None and "<all>" or updated_since
LOG.info(_LI("Forcing a sync of instances, project_id="
... | |
16,681 | [
-0.005766368005424738,
0.031621262431144714,
-0.0028260478284209967,
-0.013138411566615105,
-0.009850879199802876,
-0.009341047145426273,
-0.05578843876719475,
0.025620488449931145,
-0.008245203644037247,
0.007653329987078905,
0.005364949349313974,
-0.07519719004631042,
0.058273136615753174,... | 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": "message", "annotation": null, "type_comment": null}}, {"_type": "... | def service_get_all(self, message, filters):
if filters is None:
filters = {}
disabled = filters.pop('disabled', None)
services = objects.ServiceList.get_all(message.ctxt, disabled=disabled)
ret_services = []
for service in services:
for key, val in six.it... | |
16,682 | [
-0.004471644293516874,
0.011340277269482613,
0.007478136103600264,
0.003721486311405897,
-0.016984043642878532,
-0.019082140177488327,
0.0037244167178869247,
-0.05809035152196884,
0.0011699239257723093,
0.014323326759040356,
0.005567578133195639,
-0.03610134869813919,
0.01429988443851471,
... | 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": "state_manager", "annotation": null, "type_comment": null}}], "kwa... | def __init__(self, state_manager):
self.state_manager = state_manager
cells_scheduler_cls = importutils.import_class(
CONF.cells.scheduler)
self.scheduler = cells_scheduler_cls(self)
self.response_queues = {}
self.methods_by_type = {}
self.our_name = CONF.... | |
16,683 | [
-0.004074695985764265,
0.06792557239532471,
0.08675120025873184,
-0.026418160647153854,
-0.05748285353183746,
-0.022885359823703766,
0.01207139901816845,
0.0312562994658947,
-0.034202296286821365,
-0.04229779914021492,
-0.02015492506325245,
-0.046249743551015854,
0.0055566756054759026,
-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": "ctxt", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _get_migrations_for_cell(self, ctxt, cell_name, filters):
method_kwargs = dict(filters=filters)
message = _TargetedMessage(self, ctxt, 'get_migrations',
method_kwargs, 'down', cell_name,
need_response=True)
response = mes... | |
16,684 | [
0.0015938677825033665,
0.02908460982143879,
0.030486546456813812,
-0.007866418920457363,
-0.019849633798003197,
-0.012739815749228,
0.025991449132561684,
0.03731820359826088,
0.011682800948619843,
-0.059014830738306046,
0.008712030947208405,
-0.025813424959778786,
0.016533944755792618,
-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": "ctxt", "annotation": null, "type_comment": null}}, {"_type": "arg... | def action_get_by_request_id(self, ctxt, cell_name, instance_uuid,
request_id):
method_kwargs = dict(instance_uuid=instance_uuid,
request_id=request_id)
message = _TargetedMessage(self, ctxt, 'action_get_by_request_id',
... | |
16,685 | [
0.014528859406709671,
0.03459252044558525,
-0.03514600172638893,
0.0251602940261364,
0.04340208321809769,
0.023534445092082024,
0.0098069803789258,
-0.006405381951481104,
0.02426088973879814,
-0.012522492557764053,
0.0006244670948944986,
-0.05631662532687187,
0.0316636897623539,
-0.0095302... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ctxt", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def from_json(cls, ctxt, json_message):
_dict = jsonutils.loads(json_message)
if _dict['failure']:
resp_value = deserialize_remote_exception(_dict['value'],
rpc.get_allowed_exmods())
_dict['value'] = resp_value
respons... | |
16,686 | [
0.057277388870716095,
-0.009051581844687462,
0.006379452534019947,
0.01202457956969738,
-0.020183751359581947,
-0.01246313564479351,
0.007843004539608955,
-0.016114365309476852,
0.041020236909389496,
0.008460041135549545,
0.0036435802467167377,
-0.02147901989519596,
0.018633509054780006,
-... | 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 to_json(self):
resp_value = self.serializer.serialize_entity(self.ctxt, self.value)
if self.failure:
resp_value = serialize_remote_exception(resp_value,
log_failure=False)
_dict = {'cell_name': self.cell_name,
'... | |
16,687 | [
0.028928088024258614,
0.019858742132782936,
0.004509542603045702,
0.009823263622820377,
0.015592128038406372,
0.027409084141254425,
-0.02593475766479969,
-0.03348509967327118,
0.014564566314220428,
0.009030254557728767,
0.007086823228746653,
-0.04472126066684723,
0.016038894653320312,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "allowed_remote_exmods", "annotation": null, "type_comment": null}... | def deserialize_remote_exception(data, allowed_remote_exmods):
failure = jsonutils.loads(str(data))
trace = failure.get('tb', [])
message = failure.get('message', "") + "\n" + "\n".join(trace)
name = failure.get('class')
module = failure.get('module')
# NOTE(ameade): We DO NOT want to allow ju... | |
16,688 | [
0.016369618475437164,
0.06716888397932053,
0.04852467030286789,
-0.007793280761688948,
-0.015810292214155197,
0.004859924782067537,
-0.011242460459470749,
-0.0198498722165823,
-0.03569745272397995,
0.05931345373392105,
0.034379929304122925,
-0.041066985577344894,
0.046386800706386566,
0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "alg", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parameters", "annotation": null, "type_comment": null}}, {"_type":... | def processCommand(alg, parameters, context, feedback):
# Handle inline rules
txtRules = alg.parameterAsString(parameters, 'input_txt', context)
if txtRules:
# Creates a temporary txt file
tempRulesName = getTempFilename()
# Inject rules into temporary txt file
with open(tem... | |
16,689 | [
0.008332262746989727,
0.011710742488503456,
-0.00305648404173553,
-0.03544927015900612,
-0.017348147928714752,
-0.04910189285874367,
0.008416476659476757,
-0.04220622777938843,
-0.0213012658059597,
0.011799910105764866,
-0.011215364560484886,
-0.020270878449082375,
0.05722609907388687,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dirs", "annotation": null, "type_comment": null}}], "kwarg": null... | def load_template_source(name, dirs=[]):
app = apputil.get_current_app()
if not app:
logging.info("No app found while loading template %s" % name)
raise TemplateDoesNotExist("No app: " + name)
if app in APP_REMAP:
app = APP_REMAP[app]
# We can import the app, and then find it in sys.modules,
# the... | |
16,690 | [
-0.01649574190378189,
0.01626567542552948,
0.06027732789516449,
-0.050200432538986206,
-0.008702252060174942,
-0.0354762002825737,
-0.004834264982491732,
-0.011532065458595753,
0.013803968206048012,
0.033658675849437714,
0.018267251551151276,
0.030713830143213272,
0.03354364261031151,
0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "form", "annotation": null, "type_comment": null}}], "kwarg": {"_t... | def debugformat(text, form, **kwargs):
if form == 'html':
print("html format:")
out = minirst.format(text, style=form, **kwargs)
else:
print("%d column format:" % form)
out = minirst.format(text, width=form, **kwargs)
print("-" * 70)
if type(out) == tuple:
print(... | |
16,691 | [
0.03927023708820343,
-0.00005492714626598172,
0.00429897615686059,
-0.042691756039857864,
0.01833273284137249,
-0.014138609170913696,
0.01940333843231201,
-0.004447977989912033,
-0.006638855207711458,
0.04386169835925102,
0.03587079048156738,
-0.03417106717824936,
-0.03476707264780998,
-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": "myFile", "annotation": null, "type_comment": null}}], "kwarg": nu... | def upload(self, myFile):
out = """<html>
<body>
myFile length: %s<br />
myFile filename: %s<br />
myFile mime-type: %s
</body>
</html>"""
# Although this just counts the file length, it demonstrates
# how to read large files i... | |
16,692 | [
0.01426011510193348,
-0.009309984743595123,
-0.013126319274306297,
-0.041938766837120056,
0.047315530478954315,
-0.00968986563384533,
-0.02424219623208046,
0.015066630207002163,
0.02508377656340599,
0.02947869710624218,
0.03212032467126846,
-0.04310762882232666,
0.02047846093773842,
-0.028... | 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 FileDemo(object):
def index(self):
return """
<html><body>
<h2>Upload a file</h2>
<form action="upload" method="post" enctype="multipart/form-data">
filename: <input type="file" name="myFile" /><br />
<input type="submit" />
</fo... | |
16,693 | [
0.0032541481778025627,
0.042285364121198654,
-0.009987874887883663,
-0.021673105657100677,
-0.0013883835636079311,
0.026860646903514862,
-0.010825944133102894,
-0.0009759792592376471,
-0.016825033351778984,
0.03882700204849243,
0.010645600035786629,
-0.03538985550403595,
-0.00116361654363572... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "required"}}, "targets": [{"_type": "Name", "_fields": {"id": "required_css_class", "ctx": {"_type": "Store", "_fields": {}}}}], "type_com... | class RegistrationForm(forms.ModelForm):
required_css_class = 'required'
error_css_class = 'error'
type = forms.ModelChoiceField(queryset=TicketType.objects.all(),
widget=forms.HiddenInput(attrs={'readonly': 'readonly'}))
discount_code = forms.CharField(label='Promo Co... | |
16,694 | [
0.062449995428323746,
0.03735549747943878,
-0.03399207442998886,
0.01665015146136284,
0.05195419862866402,
0.05658189207315445,
-0.02881573513150215,
0.015063855797052383,
0.01916675828397274,
-0.008754449896514416,
0.02621564082801342,
-0.017842857167124748,
0.006136463489383459,
-0.06244... | 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 clean_discount_code(self):
data = self.cleaned_data['discount_code']
if not data:
return None
try:
discount = DiscountCode.objects.get(hash=data)
except (DiscountCode.DoesNotExist, ValueError):
raise forms.ValidationError(_('Invalid Promo Code.')... | |
16,695 | [
-0.0028732505161315203,
-0.04704882949590683,
-0.00971728190779686,
-0.0205838643014431,
-0.016110911965370178,
-0.03878629580140114,
-0.01711525395512581,
0.00178995740134269,
-0.001494866912253201,
0.0025626288261264563,
-0.003999254200607538,
0.0011137081310153008,
-0.028018075972795486,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "num", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "size", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def num_to_ip(num, size, nomask):
a = (num >> 24) & 0xFF
b = (num >> 16) & 0xFF
c = (num >> 8) & 0xFF
d = (num >> 0) & 0xFF
if nomask:
return '%s.%s.%s.%s' % (a, b, c, d)
return '%s.%s.%s.%s/%s' % (a, b, c, d, size) | |
16,696 | [
-0.000727275328245014,
0.0028771809302270412,
0.0682978630065918,
-0.0015060583828017116,
0.033498916774988174,
-0.00784078985452652,
-0.007579623255878687,
0.00961671955883503,
-0.021253123879432678,
0.015263712964951992,
0.026395196095108986,
-0.019697735086083412,
-0.027300572022795677,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "program", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "sudo", "annotation": null, "type_comment": null}}], "kwarg": n... | def which(program, sudo = False):
FNULL = open(os.devnull, 'w')
cmd = ['which', program]
if sudo:
cmd = ['sudo'] + cmd
retcode = subprocess.call(cmd, stdout = FNULL,
stderr = subprocess.STDOUT)
if retcode != 0:
print('Fatal error: Cannot find "%s" progra... | |
16,697 | [
0.001982515910640359,
0.02287832647562027,
0.006609434261918068,
-0.051190100610256195,
-0.014375991187989712,
0.028827445581555367,
0.003270129207521677,
0.002394426381215453,
0.028223730623722076,
-0.0038612678181380033,
0.04897647351026535,
-0.0022623634431511164,
-0.01533187460154295,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "netem_args", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def netem_validate(netem_args):
ret = True
try:
fdevnull = open(os.devnull, 'w')
subprocess.check_call('sudo ip tuntap add mode tap name tapbrobe'.split())
subprocess.check_call(('sudo tc qdisc add dev '\
'tapbrobe root netem %s'\
... | |
16,698 | [
0.03455962985754013,
-0.04123871028423309,
-0.00894628744572401,
-0.000003203922005923232,
0.012704545632004738,
0.0060561057180166245,
0.026205677539110184,
0.04432293027639389,
0.012296038679778576,
0.05265646055340767,
0.006888437084853649,
0.012908798642456532,
0.0033293261658400297,
-... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "i", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def ip_in_prefix(prefix, i, nomask = False):
num, mask, size = prefix_parse(prefix)
if num == None or mask == None:
return None
if i & mask != 0:
return None
ip_num = num + i
return num_to_ip(ip_num, size, nomask) | |
16,699 | [
0.01821737550199032,
-0.08696827292442322,
0.01201365515589714,
-0.015583537518978119,
0.04309680685400963,
0.031864266842603683,
0.016280729323625565,
0.03795824199914932,
-0.0007956383633427322,
0.05598195269703865,
0.01839812844991684,
-0.05556880310177803,
0.00029896959313191473,
-0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "li", "annotation": nul... | class FrontierSet:
def __init__(self, li = []):
self.belong = set()
self.queue = []
for x in li:
self.add(x)
def empty(self):
return len(self.belong) == 0
def add(self, x):
if x in self.belong:
return
self.belong.add(x)
self.... | |
16,700 | [
0.04897671937942505,
-0.0028402272146195173,
0.008339866995811462,
0.012532202526926994,
0.051204096525907516,
-0.005469237454235554,
-0.028776701539754868,
0.04267861321568489,
0.004009920638054609,
0.0028498279862105846,
0.012340187095105648,
-0.018292663618922234,
-0.001768141402862966,
... | 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 pop(self):
if self.empty():
return None # We may throw an exception
x = self.queue.pop(0)
self.belong.remove(x)
return x |