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 |
|---|---|---|---|---|---|
13,201 | [
0.0336783230304718,
0.01240256242454052,
-0.016319161280989647,
-0.03150981292128563,
-0.009288092143833637,
-0.018841715529561043,
-0.010034901089966297,
-0.05735493823885918,
0.022448528558015823,
0.02619916945695877,
-0.007080856245011091,
-0.018974483013153076,
-0.03290385380387306,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}... | def _name_and_val_str(sc):
# Custom symbol/choice printer that shows symbol values after symbols
# Show the values of non-constant (non-quoted) symbols that don't look like
# numbers. Things like 123 are actually symbol references, and only work as
# expected due to undefined symbols getting their name... | |
13,202 | [
0.01752670481801033,
0.032641179859638214,
-0.040464628487825394,
-0.05246058851480484,
-0.0044441549107432365,
-0.008024470880627632,
0.0394432358443737,
-0.009208854287862778,
0.007334485650062561,
0.06775978207588196,
0.03759603202342987,
0.020232314243912697,
0.014397324062883854,
-0.0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _node_str(node):
# Returns the complete menu entry text for a menu node.
#
# Example return value: "[*] Support for X"
# Calculate the indent to print the item with by checking how many levels
# above it the closest 'menuconfig' item is (this includes menus and
# choices as well as menuconf... | |
13,203 | [
0.008222553879022598,
0.03427354246377945,
0.03280762583017349,
0.0050945766270160675,
-0.029338980093598366,
0.017136771231889725,
0.041499894112348557,
0.025478044524788857,
-0.017353562638163567,
0.049634698778390884,
0.02341337315738201,
-0.005775917787104845,
-0.0010439493926241994,
0... | 19 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "c", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s", "annotation": null, "type_comment": null}}, {"_type": "arg", "_f... | def _edit_text(c, s, i, hscroll, width):
# Implements text editing commands for edit boxes. Takes a character (which
# could also be e.g. curses.KEY_LEFT) and the edit box state, and returns
# the new state after the character has been processed.
#
# c:
# Character from user
#
# s:
... | |
13,204 | [
0.017137758433818817,
0.031452011317014694,
-0.0008526931633241475,
-0.01458040252327919,
0.018780946731567383,
0.023143496364355087,
0.002213096711784601,
-0.04631013423204422,
0.04637956619262695,
0.09039849787950516,
0.004686558153480291,
-0.05207286775112152,
0.002401137724518776,
0.02... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sym", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s", "annotation": null, "type_comment": null}}], "kwarg": null, "v... | def _check_valid(sym, s):
# Returns True if the string 's' is a well-formed value for 'sym'.
# Otherwise, displays an error and returns False.
if sym.orig_type not in (INT, HEX):
return True # Anything goes for non-int/hex symbols
base = 10 if sym.orig_type == INT else 16
try:
int... | |
13,205 | [
-0.019242126494646072,
0.044024787843227386,
-0.035082921385765076,
-0.06297812610864639,
-0.0026018051430583,
-0.012439463287591934,
0.0034013320691883564,
-0.003473530290648341,
0.019530920311808586,
0.04680575430393219,
0.021456202492117882,
0.005898850969970226,
0.0155947869643569,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _value_str(node):
# Returns the value part ("[*]", "<M>", "(foo)" etc.) of a menu node
item = node.item
if item in (MENU, COMMENT):
return ""
# Wouldn't normally happen, and generates a warning
if not item.orig_type:
return ""
if item.orig_type in (STRING, INT, HEX):
... | |
13,206 | [
0.03898446261882782,
-0.009722517803311348,
-0.04297258332371712,
0.009816911071538925,
0.03395801782608032,
0.013793231919407845,
0.02126210741698742,
-0.005760945845395327,
0.045568402856588364,
-0.006294858176261187,
0.008165027014911175,
-0.02141549624502659,
0.04332656040787697,
-0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def _is_num(name):
# Heuristic to see if a symbol name looks like a number, for nicer output
# when printing expressions. Things like 16 are actually symbol names, only
# they get their name as their value when the symbol is undefined.
try:
int(name)
except ValueError:
if not name.s... | |
13,207 | [
0.04134894162416458,
0.024821965023875237,
0.01496247947216034,
-0.03362095355987549,
-0.02715296298265457,
0.021346470341086388,
0.014825979247689247,
-0.04401594027876854,
0.03935394436120987,
0.07950589060783386,
-0.03725394979119301,
-0.03838794678449631,
-0.0014489979948848486,
-0.001... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sym", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def _range_info(sym):
# Returns a string with information about the valid range for the symbol
# 'sym', or None if 'sym' doesn't have a range
if sym.orig_type in (INT, HEX):
for low, high, cond in sym.ranges:
if expr_value(cond):
return "Range: {}-{}".format(low.str_valu... | |
13,208 | [
0.0006255779298953712,
0.023609202355146408,
0.05189894884824753,
0.05960807576775551,
0.007330554071813822,
0.02035117894411087,
0.028656845912337303,
0.024871112778782845,
-0.058414995670318604,
0.013789243064820766,
-0.013146815821528435,
0.04162010923027992,
-0.05070586875081062,
0.110... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "win", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def _getch_compat(win):
# Uses get_wch() if available (Python 3.3+) and getch() otherwise.
#
# Also falls back on getch() if get_wch() raises curses.error, to work
# around an issue when resizing the terminal on at least macOS Catalina.
# See https://github.com/ulfalizer/Kconfiglib/issues/84.
#
... | |
13,209 | [
0.01498324517160654,
0.018322031944990158,
0.02470465749502182,
0.038342949002981186,
-0.021814189851284027,
0.013626494444906712,
0.03225526958703995,
-0.039593521505594254,
-0.0453980527818203,
0.03697440028190613,
-0.014617512933909893,
-0.010081246495246887,
0.010924790985882282,
0.068... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "win", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment... | def _safe_addstr(win, *args):
# Clip the line to avoid wrapping to the next line, which looks glitchy.
# addchstr() would do it for us, but it's not available in the 'curses'
# module.
attr = None
if isinstance(args[0], str):
y, x = win.getyx()
s = args[0]
if len(args) == 2:... | |
13,210 | [
-0.018650030717253685,
0.03584526479244232,
0.0721198096871376,
-0.035654470324516296,
-0.03479589894413948,
-0.012145176529884338,
0.03834942355751991,
-0.004373336676508188,
0.012640045955777168,
0.036226850003004074,
0.03298336640000343,
-0.01372518204152584,
-0.024183031171560287,
-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 __init__(self):
inputs = [
resource,
LiteralInput('typename',
'TypeName',
abstract='Name of the layer in GeoServer.',
data_type='string',
min_occurs=0,
max_occ... | |
13,211 | [
-0.019494956359267235,
0.01086488552391529,
0.0023107544984668493,
0.010002420283854008,
-0.0022877012379467487,
0.015329089015722275,
0.042201101779937744,
0.0029345497023314238,
0.011152373626828194,
0.019505804404616356,
0.022434931248426437,
0.012237234972417355,
-0.011770744808018208,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"val... | def _change_c_lc_ctype_to_utf8():
# See _CHANGE_C_LC_CTYPE_TO_UTF8
if _IS_WINDOWS:
# Windows rarely has issues here, and the PEP 538 implementation avoids
# changing the locale on it. None of the UTF-8 locales below were
# supported from some quick testing either. Play it safe.
... | |
13,212 | [
0.05725271999835968,
-0.022600390017032623,
0.04087074473500252,
-0.03269178420305252,
-0.005144926719367504,
-0.04471966624259949,
0.01712770387530327,
-0.00786623451858759,
-0.03423135355114937,
-0.04014907032251358,
0.03389457240700722,
-0.03642042726278305,
-0.04443099722266197,
-0.019... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
self.book1 = Book.objects.create(title="Poems")
self.book2 = Book.objects.create(title="Jane Eyre")
self.book3 = Book.objects.create(title="Wuthering Heights")
self.book4 = Book.objects.create(title="Sense and Sensibility")
self.author1 = Author.objects.create(n... | |
13,213 | [
-0.017098385840654373,
0.06530933827161789,
0.09144389629364014,
-0.044666826725006104,
-0.03519778326153755,
-0.01956033706665039,
0.00858301017433405,
-0.01862695999443531,
0.00147108337841928,
0.014906978234648705,
0.0297598484903574,
-0.04707466810941696,
0.0003364891745150089,
-0.0428... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def _handler(self, request, response):
geoms, fids = self.parse_feature(request)
dr = self.parse_daterange(request)
ml = MetaLink4('subset', workdir=self.workdir)
for res in self.parse_resources(request):
variables = self.parse_variable(request, res)
prefix = Pa... | |
13,214 | [
0.044477470219135284,
-0.030908072367310524,
0.06010047346353531,
-0.01022253930568695,
-0.032805707305669785,
-0.012302140705287457,
0.02330453135073185,
0.009267223067581654,
0.007610040716826916,
-0.020419083535671234,
0.03122001327574253,
-0.04128008335828781,
0.007226614281535149,
-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 setUp(self):
self.person1 = Person.objects.create(name="Joe")
self.person2 = Person.objects.create(name="Mary")
self.house1 = House.objects.create(name='House 1', address="123 Main St", owner=self.person1)
self.house2 = House.objects.create(name='House 2', address="45 Side St", owner... | |
13,215 | [
0.037544723600149155,
-0.03171352669596672,
0.043657250702381134,
-0.046700723469257355,
0.016048578545451164,
-0.008618918247520924,
-0.00997441541403532,
0.010786435566842556,
-0.04539638012647629,
-0.03437336906790733,
0.007212269585579634,
-0.0667518600821495,
-0.018772361800074577,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_overriding_prefetch(self):
with self.assertNumQueries(3):
qs = Author.objects.prefetch_related('books', 'books__read_by')
lists = [[[six.text_type(r) for r in b.read_by.all()]
for b in a.books.all()]
for a in qs]
self.assert... | |
13,216 | [
0.013915715739130974,
-0.0047535221092402935,
0.0553382970392704,
-0.03437682241201401,
0.002779086120426655,
0.013023162260651588,
-0.007613749243319035,
0.018013346940279007,
-0.01705317571759224,
0.007417657878249884,
0.025640619918704033,
-0.0532015785574913,
0.007106616627424955,
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_m2m(self):
# Control lookups.
with self.assertNumQueries(2):
lst1 = self.traverse_qs(
Person.objects.prefetch_related('houses'),
[['houses']]
)
# Test lookups.
with self.assertNumQueries(2):
lst2 = self.travers... | |
13,217 | [
-0.015910301357507706,
-0.026116911321878433,
0.022906135767698288,
-0.014200499281287193,
0.007452651858329773,
0.03740683197975159,
-0.023623991757631302,
-0.019382115453481674,
-0.026691196486353874,
-0.014605109579861164,
0.025242431089282036,
-0.05429602786898613,
0.017111079767346382,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_ambiguous(self):
# Ambiguous: Lookup was already seen with a different queryset.
with self.assertRaises(ValueError):
self.traverse_qs(
Person.objects.prefetch_related('houses__rooms', Prefetch('houses', queryset=House.objects.all())),
[['houses', 'roo... | |
13,218 | [
0.018321771174669266,
-0.006473648827522993,
0.05262915417551994,
-0.035908572375774384,
0.009390563704073429,
0.025842096656560898,
-0.008727777749300003,
0.011982648633420467,
-0.018308646976947784,
0.010040225461125374,
0.03333617374300957,
-0.03367741033434868,
0.013216349296271801,
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_m2m_through_fk(self):
# Control lookups.
with self.assertNumQueries(3):
lst1 = self.traverse_qs(
Room.objects.prefetch_related('house__occupants'),
[['house', 'occupants']]
)
# Test lookups.
with self.assertNumQueries(3):
... | |
13,219 | [
0.03320356830954552,
0.004386150278151035,
0.058154068887233734,
-0.02432195469737053,
-0.0061658890917897224,
0.026890790089964867,
-0.0006661209627054632,
0.0048746392130851746,
-0.015563318505883217,
0.007727003190666437,
0.023215169087052345,
-0.053945548832416534,
0.01145044807344675,
... | 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_reverse_m2m(self):
# Control lookups.
with self.assertNumQueries(2):
lst1 = self.traverse_qs(
House.objects.prefetch_related('occupants'),
[['occupants']]
)
# Test lookups.
with self.assertNumQueries(2):
lst2 =... | |
13,220 | [
0.02659129910171032,
-0.0237265657633543,
0.043176595121622086,
-0.0339655876159668,
0.001502614002674818,
0.02297268994152546,
-0.00696650892496109,
0.011712507344782352,
-0.005253152456134558,
0.012596599757671356,
0.045506760478019714,
-0.04926243796944618,
0.0035226617474108934,
0.0137... | 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_o2m_through_m2m(self):
# Control lookups.
with self.assertNumQueries(3):
lst1 = self.traverse_qs(
Person.objects.prefetch_related('houses', 'houses__rooms'),
[['houses', 'rooms']]
)
# Test lookups.
with self.assertNumQueri... | |
13,221 | [
0.04748386889696121,
-0.012324258685112,
0.007594265975058079,
-0.02215213142335415,
-0.02018130198121071,
-0.0024208365939557552,
0.0160951130092144,
-0.00030322044040076435,
0.015451309271156788,
-0.019655747339129448,
0.026264598593115807,
-0.02265140973031521,
0.016673224046826363,
-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 test_m2m_through_gfk(self):
TaggedItem.objects.create(tag="houses", content_object=self.house1)
TaggedItem.objects.create(tag="houses", content_object=self.house2)
# Control lookups.
with self.assertNumQueries(3):
lst1 = self.traverse_qs(
TaggedItem.objec... | |
13,222 | [
0.0006787099991925061,
-0.04025973007082939,
0.053128138184547424,
-0.018028901889920235,
0.01202145591378212,
0.01825212873518467,
-0.019276348873972893,
-0.007031665649265051,
-0.004024660214781761,
-0.003558508586138487,
0.02035309374332428,
-0.058459337800741196,
0.0009864685125648975,
... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_custom_qs(self):
# Test basic.
with self.assertNumQueries(2):
lst1 = list(Person.objects.prefetch_related('houses'))
with self.assertNumQueries(2):
lst2 = list(Person.objects.prefetch_related(
Prefetch('houses', queryset=House.objects.all(), to_at... | |
13,223 | [
0.012277095578610897,
-0.025883154943585396,
-0.03298361971974373,
-0.011985989287495613,
0.005717709194868803,
-0.010062155313789845,
0.007840887643396854,
0.012239125557243824,
-0.03435055539011955,
-0.024263085797429085,
0.024263085797429085,
-0.047159235924482346,
0.008885073475539684,
... | 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_generic_rel(self):
bookmark = Bookmark.objects.create(url='http://www.djangoproject.com/')
TaggedItem.objects.create(content_object=bookmark, tag='django')
TaggedItem.objects.create(content_object=bookmark, favorite=bookmark, tag='python')
# Control lookups.
with self.a... | |
13,224 | [
0.04169789329171181,
0.01043698750436306,
0.025554349645972252,
-0.01344043668359518,
0.002139957854524255,
-0.01954745128750801,
0.019810251891613007,
0.03969559073448181,
-0.05073326826095581,
0.027706822380423546,
0.03609145060181618,
-0.05351145938038826,
-0.02393999509513378,
-0.04194... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
self.qual1 = Qualification.objects.create(name="BA")
self.qual2 = Qualification.objects.create(name="BSci")
self.qual3 = Qualification.objects.create(name="MA")
self.qual4 = Qualification.objects.create(name="PhD")
self.teacher1 = Teacher.objects.create(name="Mr... | |
13,225 | [
-0.0012025978649035096,
0.021596912294626236,
0.05632893368601799,
-0.04481390491127968,
-0.006212383508682251,
0.0186932310461998,
0.017434552311897278,
-0.004626574460417032,
-0.04134942591190338,
0.025310633704066277,
-0.0007668118923902512,
-0.07133336365222931,
-0.0283140130341053,
-0... | 17 | {"_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 DefaultManagerTests(TestCase):
def setUp(self):
self.qual1 = Qualification.objects.create(name="BA")
self.qual2 = Qualification.objects.create(name="BSci")
self.qual3 = Qualification.objects.create(name="MA")
self.qual4 = Qualification.objects.create(name="PhD")
self.... | |
13,226 | [
0.02167203463613987,
0.00868988037109375,
0.05503590777516365,
-0.03810380771756172,
0.006556909531354904,
0.046530358493328094,
0.02606964111328125,
0.01768258959054947,
-0.035286180675029755,
0.015154624357819557,
0.05408792197704315,
-0.05803786590695381,
-0.009117791429162025,
0.009769... | 16 | {"_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_then_m2m(self):
with self.assertNumQueries(3):
# When we prefetch the teachers, and force the query, we don't want
# the default manager on teachers to immediately get all the related
# qualifications, since this will do one query per teacher.
qs = De... | |
13,227 | [
0.04236311465501785,
-0.01882125623524189,
0.017671680077910423,
-0.031845711171627045,
-0.008701315149664879,
-0.06432735919952393,
0.032555025070905685,
0.012694258242845535,
-0.02573094330728054,
-0.04400186985731125,
0.015372526831924915,
-0.016717776656150818,
-0.034634046256542206,
-... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
book1 = Book.objects.create(title="Winnie the Pooh")
book2 = Book.objects.create(title="Do you like green eggs and spam?")
book3 = Book.objects.create(title="Three Men In A Boat")
reader1 = Reader.objects.create(name="me")
reader2 = Reader.objects.create(name="y... | |
13,228 | [
0.029136935248970985,
-0.009029616601765156,
-0.01848430745303631,
-0.03933872655034065,
0.005496988072991371,
-0.0239845160394907,
0.014439657330513,
0.006244088988751173,
-0.004385997541248798,
-0.0333876833319664,
0.02449975721538067,
-0.006527472287416458,
-0.004794971086084843,
-0.024... | 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_nullable_GFK(self):
TaggedItem.objects.create(tag="awesome", content_object=self.book1,
created_by=self.reader1)
TaggedItem.objects.create(tag="great", content_object=self.book2)
TaggedItem.objects.create(tag="rubbish", content_object=self.book3)
... | |
13,229 | [
0.03117028996348381,
-0.02168963849544525,
-0.01965896040201187,
-0.02020711824297905,
-0.0003982714843004942,
-0.029326483607292175,
0.01813906617462635,
0.00868333037942648,
-0.02213813178241253,
-0.062490079551935196,
0.02900257147848606,
-0.016544422134757042,
0.001446702633984387,
-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_prefetch_GFK(self):
TaggedItem.objects.create(tag="awesome", content_object=self.book1)
TaggedItem.objects.create(tag="great", content_object=self.reader1)
TaggedItem.objects.create(tag="stupid", content_object=self.book2)
TaggedItem.objects.create(tag="amazing", content_object=... | |
13,230 | [
0.021942291408777237,
-0.016695506870746613,
-0.0024336709175258875,
-0.016368400305509567,
0.014785205945372581,
-0.012233776040375233,
0.0038958361838012934,
0.039566781371831894,
-0.013365563936531544,
-0.016747843474149704,
0.011716948822140694,
-0.02390492893755436,
0.007987936027348042... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_charfield_GFK(self):
b = Bookmark.objects.create(url='http://www.djangoproject.com/')
TaggedItem.objects.create(content_object=b, tag='django')
TaggedItem.objects.create(content_object=b, favorite=b, tag='python')
with self.assertNumQueries(3):
bookmark = Bookmark.o... | |
13,231 | [
0.02176474779844284,
-0.035146564245224,
-0.01669461838901043,
-0.005073098000138998,
-0.005610389169305563,
-0.0018196658929809928,
0.00978404376655817,
0.0086619658395648,
-0.036286454647779465,
-0.038138773292303085,
0.00211057486012578,
-0.06426122039556503,
0.0012259739451110363,
-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_generic_relation(self):
bookmark = Bookmark.objects.create(url='http://www.djangoproject.com/')
TaggedItem.objects.create(content_object=bookmark, tag='django')
TaggedItem.objects.create(content_object=bookmark, tag='python')
with self.assertNumQueries(2):
tags = [t... | |
13,232 | [
0.028572596609592438,
-0.019168172031641006,
0.04753012955188751,
-0.01993638649582863,
-0.016082927584648132,
-0.030877236276865005,
0.013480912894010544,
0.017606964334845543,
-0.044754646718502045,
-0.029935555532574654,
0.024731526151299477,
-0.06239878386259079,
-0.0528828427195549,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
self.book1 = BookWithYear.objects.create(
title="Poems", published_year=2010)
self.book2 = BookWithYear.objects.create(
title="More poems", published_year=2011)
self.author1 = AuthorWithAge.objects.create(
name='Jane', first_book=self.book1, a... | |
13,233 | [
0.020008917897939682,
-0.0023302026093006134,
0.08169595897197723,
-0.01706678792834282,
0.0031527169048786163,
-0.00715389009565115,
0.0050022294744849205,
0.014258948154747486,
-0.048539020121097565,
-0.01493038795888424,
0.03174080699682236,
-0.04587767645716667,
-0.00970536284148693,
0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class MultiTableInheritanceTest(TestCase):
def setUp(self):
self.book1 = BookWithYear.objects.create(
title="Poems", published_year=2010)
self.book2 = BookWithYear.objects.create(
title="More poems", published_year=2011)
self.author1 = AuthorWithAge.objects.create(
... | |
13,234 | [
0.02297879382967949,
-0.031390778720378876,
0.042187899351119995,
-0.03785974532365799,
0.025038158521056175,
0.00212771981023252,
0.002770544495433569,
0.014915854670107365,
-0.04614374414086342,
0.0018848427571356297,
0.02973863109946251,
-0.049657464027404785,
-0.008377078920602798,
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_child_link_prefetch(self):
with self.assertNumQueries(2):
l = [a.authorwithage for a in Author.objects.prefetch_related('authorwithage')]
# Regression for #18090: the prefetching query must include an IN clause.
# Note that on Oracle the table name is upper case in the gene... | |
13,235 | [
0.05125202238559723,
0.008550549857318401,
0.05363643169403076,
-0.03279206529259682,
-0.018575333058834076,
-0.018434319645166397,
-0.019267581403255463,
-0.0036086654290556908,
-0.0689171776175499,
0.004506024532020092,
0.037996746599674225,
-0.057636089622974396,
-0.023305697366595268,
... | 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_m2m_to_inheriting_model(self):
qs = AuthorWithAge.objects.prefetch_related('books_with_year')
with self.assertNumQueries(2):
lst = [[six.text_type(book) for book in author.books_with_year.all()]
for author in qs]
qs = AuthorWithAge.objects.all()
ls... | |
13,236 | [
0.052312836050987244,
-0.04301073029637337,
0.02924177050590515,
-0.005974991712719202,
0.0025730454362928867,
-0.06838429719209671,
0.02300199121236801,
0.016209611669182777,
-0.025465667247772217,
-0.02758396975696087,
0.03976420313119888,
-0.028873369097709656,
-0.03716237470507622,
-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 setUp(self):
self.book = Book.objects.create(title="Poems")
self.author1 = Author.objects.create(name='Jane', first_book=self.book)
self.author2 = Author.objects.create(name='Tom', first_book=self.book)
self.author3 = Author.objects.create(name='Robert', first_book=self.book)
... | |
13,237 | [
0.02756619080901146,
-0.04887460544705391,
0.062258027493953705,
-0.02715509571135044,
0.014376899227499962,
-0.04649939015507698,
0.006988612003624439,
0.014673801138997078,
-0.04987950250506401,
-0.008278992958366871,
0.02418607845902443,
-0.0398305207490921,
-0.009449470788240433,
0.042... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class ForeignKeyToFieldTest(TestCase):
def setUp(self):
self.book = Book.objects.create(title="Poems")
self.author1 = Author.objects.create(name='Jane', first_book=self.book)
self.author2 = Author.objects.create(name='Tom', first_book=self.book)
self.author3 = Author.objects.create(... | |
13,238 | [
0.04686962068080902,
-0.03554406017065048,
0.06234114617109299,
-0.0009693403844721615,
-0.02621564082801342,
-0.025937557220458984,
0.018429316580295563,
0.009758184663951397,
0.003684599418193102,
-0.01849251799285412,
0.015977131202816963,
-0.04934708774089813,
0.014030549675226212,
-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 setUp(self):
self.person1 = Person.objects.create(name="Joe")
self.person2 = Person.objects.create(name="Mary")
self.house1 = House.objects.create(address="123 Main St")
self.house2 = House.objects.create(address="45 Side St")
self.house3 = House.objects.create(address="6 Do... | |
13,239 | [
0.037295542657375336,
-0.041128914803266525,
0.046240080147981644,
-0.053773727267980576,
0.004545477218925953,
-0.020364802330732346,
-0.0038500125519931316,
0.010242298245429993,
-0.046213459223508835,
0.004991373047232628,
0.031226031482219696,
-0.062132615596055984,
-0.026261277496814728... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_m2m(self):
with self.assertNumQueries(3):
qs = Author.objects.all().prefetch_related('favorite_authors', 'favors_me')
favorites = [(
[six.text_type(i_like) for i_like in author.favorite_authors.all()],
[six.text_type(likes_me) for likes_me in auth... | |
13,240 | [
0.03687015175819397,
-0.04187687486410141,
0.049495797604322433,
-0.027128813788294792,
0.014190247282385826,
0.02816281095147133,
-0.014870507642626762,
0.02576829120516777,
-0.02106088399887085,
-0.027033576741814613,
0.04057077318429947,
-0.05444810166954994,
0.019074521958827972,
-0.02... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_prefetch_nullable(self):
# One for main employee, one for boss, one for serfs
with self.assertNumQueries(3):
qs = Employee.objects.prefetch_related('boss__serfs')
co_serfs = [list(e.boss.serfs.all()) if e.boss is not None else []
for e in qs]
... | |
13,241 | [
0.04647226631641388,
-0.009649639949202538,
0.057227205485105515,
-0.021497460082173347,
0.05216021463274956,
0.026576871052384377,
0.008476034738123417,
0.020267968997359276,
-0.024043375626206398,
0.01446824986487627,
0.0050545730628073215,
-0.0369095616042614,
0.005765566602349281,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_traverse_nullable(self):
# Because we use select_related() for 'boss', it doesn't need to be
# prefetched, but we can still traverse it although it contains some nulls
with self.assertNumQueries(2):
qs = Employee.objects.select_related('boss').prefetch_related('boss__serfs')... | |
13,242 | [
0.04253562167286873,
-0.023900602012872696,
0.06118348613381386,
-0.04089173302054405,
-0.009978918358683586,
-0.024260202422738075,
-0.019174421206116676,
-0.009901861660182476,
-0.01112835668027401,
-0.01569399982690811,
0.044282253831624985,
-0.04579771310091019,
-0.017260832712054253,
... | 16 | {"_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_using_is_honored_m2m(self):
B = Book.objects.using('other')
A = Author.objects.using('other')
book1 = B.create(title="Poems")
book2 = B.create(title="Jane Eyre")
book3 = B.create(title="Wuthering Heights")
book4 = B.create(title="Sense and Sensibility")
... | |
13,243 | [
0.032570723444223404,
-0.027788514271378517,
0.09357620775699615,
-0.02375594899058342,
0.018379194661974907,
-0.004778978414833546,
-0.01574251614511013,
-0.0014015428023412824,
-0.027323218062520027,
-0.0034638706129044294,
0.03792162984609604,
-0.02822796069085598,
-0.004853296559303999,
... | 17 | {"_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 MultiDbTests(TestCase):
multi_db = True
def test_using_is_honored_m2m(self):
B = Book.objects.using('other')
A = Author.objects.using('other')
book1 = B.create(title="Poems")
book2 = B.create(title="Jane Eyre")
book3 = B.create(title="Wuthering Heights")
bo... | |
13,244 | [
0.04015061631798744,
-0.02489389106631279,
0.06331541389226913,
0.002552323043346405,
0.014354036189615726,
-0.02916577458381653,
-0.0357515923678875,
0.004643765743821859,
-0.0429222546517849,
-0.03542103245854378,
0.030004894360899925,
-0.04332910105586052,
-0.004824939649552107,
0.03086... | 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_using_is_honored_inheritance(self):
B = BookWithYear.objects.using('other')
A = AuthorWithAge.objects.using('other')
book1 = B.create(title="Poems", published_year=2010)
B.create(title="More poems", published_year=2011)
A.create(name='Jane', first_book=book1, age=50)
... | |
13,245 | [
0.026959601789712906,
-0.03848886862397194,
0.05804389715194702,
-0.031829722225666046,
0.012398932129144669,
-0.01848658360540867,
-0.03235151991248131,
0.0014900770038366318,
-0.0011476465733721852,
-0.024897253140807152,
0.0336187481880188,
-0.03856341168284416,
-0.013131935149431229,
0... | 16 | {"_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_using_is_honored_fkey(self):
B = Book.objects.using('other')
A = Author.objects.using('other')
book1 = B.create(title="Poems")
book2 = B.create(title="Sense and Sensibility")
A.create(name="Charlotte Bronte", first_book=book1)
A.create(name="Jane Austen", first_... | |
13,246 | [
-0.006564886309206486,
-0.05522625893354416,
0.04688325524330139,
-0.018298005685210228,
0.0006198803312145174,
0.016206102445721626,
-0.012545269913971424,
0.025201288983225822,
-0.05114089325070381,
0.04223184660077095,
-0.004808302503079176,
-0.023035552352666855,
0.016206102445721626,
... | 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 Ticket19607Tests(TestCase):
def setUp(self):
for id, name1, name2 in [
(1, 'einfach', 'simple'),
(2, 'schwierig', 'difficult'),
]:
LessonEntry.objects.create(id=id, name1=name1, name2=name2)
for id, lesson_entry_id, name in [
(1, 1, 'e... | |
13,247 | [
0.021369991824030876,
-0.04244040697813034,
0.08018740266561508,
-0.017175881192088127,
0.0243033729493618,
-0.01881108619272709,
-0.02873465046286583,
0.006337975151836872,
-0.014716834761202335,
-0.0259885061532259,
0.026063401252031326,
-0.02826031669974327,
0.0014479667879641056,
0.031... | 16 | {"_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_using_is_honored_custom_qs(self):
B = Book.objects.using('other')
A = Author.objects.using('other')
book1 = B.create(title="Poems")
book2 = B.create(title="Sense and Sensibility")
A.create(name="Charlotte Bronte", first_book=book1)
A.create(name="Jane Austen", f... | |
13,248 | [
0.009952460415661335,
-0.0396929606795311,
0.03310084342956543,
-0.02164645493030548,
0.027116509154438972,
0.034386537969112396,
0.017578978091478348,
0.01874779351055622,
-0.0312541164457798,
0.0404176265001297,
0.019039997830986977,
-0.05353172868490219,
0.0144933070987463,
-0.045373402... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
for id, name1, name2 in [
(1, 'einfach', 'simple'),
(2, 'schwierig', 'difficult'),
]:
LessonEntry.objects.create(id=id, name1=name1, name2=name2)
for id, lesson_entry_id, name in [
(1, 1, 'einfach'),
(2, 1, 'simple'),... | |
13,249 | [
0.024577582255005836,
-0.07136133313179016,
0.05258459597826004,
-0.03499964624643326,
-0.002322769956663251,
-0.029673082754015923,
-0.011656413786113262,
-0.004560412373393774,
-0.034805066883563995,
-0.019153732806444168,
0.029843337833881378,
-0.03641033172607422,
-0.036799486726522446,
... | 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 Ticket21410Tests(TestCase):
def setUp(self):
self.book1 = Book.objects.create(title="Poems")
self.book2 = Book.objects.create(title="Jane Eyre")
self.book3 = Book.objects.create(title="Wuthering Heights")
self.book4 = Book.objects.create(title="Sense and Sensibility")
... | |
13,250 | [
-0.010346795432269573,
-0.04033723846077919,
0.06538930535316467,
-0.016652541235089302,
-0.014699163846671581,
0.0006886417977511883,
-0.017910027876496315,
0.011549343355000019,
-0.014552660286426544,
-0.008466669358313084,
0.013368425890803337,
-0.027982128784060478,
0.007728048600256443,... | 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 Ticket21760Tests(TestCase):
def setUp(self):
self.rooms = []
for _ in range(3):
house = House.objects.create()
for _ in range(3):
self.rooms.append(Room.objects.create(house=house))
def test_bug(self):
prefetcher = get_prefetcher(self.rooms... | |
13,251 | [
0.05667120963335037,
-0.033309657126665115,
0.03983957692980766,
-0.029985764995217323,
0.0022070889826864004,
-0.047901786863803864,
0.020002296194434166,
-0.013908491469919682,
-0.03814227133989334,
-0.03599706292152405,
0.03349824622273445,
-0.03335680440068245,
-0.044719334691762924,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
self.book1 = Book.objects.create(title="Poems")
self.book2 = Book.objects.create(title="Jane Eyre")
self.book3 = Book.objects.create(title="Wuthering Heights")
self.book4 = Book.objects.create(title="Sense and Sensibility")
self.author1 = Author2.objects.create(... | |
13,252 | [
0.05182319134473801,
0.01914999447762966,
-0.021596936509013176,
-0.013014903292059898,
0.018133388832211494,
-0.0024085254408419132,
-0.00969911739230156,
-0.004497884307056665,
0.05215417966246605,
0.0021528967190533876,
0.04558171331882477,
-0.05617331340909004,
-0.012258360162377357,
-... | 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_good_check_call(self):
with mock.patch("calico.felix.futils._call_semaphore",
wraps=futils._call_semaphore) as m_sem:
# Test a command. Result must include "calico" given where it is
# run from.
args = ["ls"]
result = futils.check_... | |
13,253 | [
0.01771961711347103,
-0.008691173978149891,
0.032637301832437515,
-0.049085672944784164,
-0.0004244243900757283,
0.01568302884697914,
-0.05375555902719498,
-0.01319242361932993,
0.04701016843318939,
0.040264781564474106,
0.02830468863248825,
-0.0680246502161026,
-0.027733923867344856,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestFutils(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_good_check_call(self):
with mock.patch("calico.felix.futils._call_semaphore",
wraps=futils._call_semaphore) as m_sem:
# Test a command. Result must inclu... | |
13,254 | [
0.022863861173391342,
0.0012502719182521105,
0.006794391665607691,
-0.035462815314531326,
0.011334169656038284,
-0.002274471567943692,
-0.0348518081009388,
-0.0062292106449604034,
0.02695760503411293,
0.04616764932870865,
0.030208159238100052,
-0.059536468237638474,
0.019246703013777733,
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_bad_check_call(self):
# Test an invalid command - must parse but not return anything.
try:
args = ["ls", "wibble_wobble"]
futils.check_call(args)
self.assertTrue(False)
except futils.FailedSystemCall as e:
self.assertNotEqual(e.retcode, 0)... | |
13,255 | [
0.0320877768099308,
-0.015196418389678001,
0.056234873831272125,
-0.0502445362508297,
0.01029734406620264,
0.0006366910529322922,
-0.018992621451616287,
-0.007731714751571417,
0.009931654669344425,
0.014569522812962532,
0.04281466081738472,
-0.0458330474793911,
0.00917705800384283,
-0.0562... | 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_multi_call(self):
# Test multiple command calls; this just stores the command values.
ops = [ ["ls"], ["ls", "calico"] ]
expected = "set -e\n"
for op in ops:
cmd = " ".join(op) + "\n"
expected += "echo Executing : " + cmd + cmd
with mock.patch('c... | |
13,256 | [
0.06108071655035019,
0.03681612014770508,
0.06021684408187866,
-0.01727740652859211,
-0.010099660605192184,
0.0279233381152153,
-0.017417151480913162,
-0.006656883284449577,
0.06123316287994385,
0.039763443171978,
0.02186354249715805,
-0.03328441455960274,
-0.03745131939649582,
-0.00531978... | 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_safe_truncate(self):
self.assert_safe_truncate("foobarbazb", 10, "foobarbazb")
# Yes, this gets longer, which is silly. However, there's no point
# making the code complicated to handle this case that should never be
# hit.
self.assert_safe_truncate("foobarbazb", 9, "fo... | |
13,257 | [
0.023712901398539543,
-0.03072657622396946,
-0.00009050245716935024,
-0.03965757042169571,
-0.006283856928348541,
0.027881521731615067,
-0.03149350360035896,
0.0013003748608753085,
0.017206387594342232,
0.07100263237953186,
0.00009214532474288717,
0.0028620618395507336,
-0.0386432446539402,
... | 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_uniquely_shorten(self):
for inp, length, exp in UNIQUE_SHORTEN_TESTS:
output = futils.uniquely_shorten(inp, length)
self.assertTrue(len(output) <= length)
self.assertEqual(exp, output, "Input %r truncated to length %s "
"shou... | |
13,258 | [
0.010482695885002613,
-0.021832145750522614,
0.04032289236783981,
-0.039242591708898544,
0.007938962429761887,
0.030700670555233955,
-0.0306504238396883,
-0.028062723577022552,
0.03163023293018341,
0.01421978697180748,
0.03743371367454529,
-0.003185948124155402,
-0.007901277393102646,
0.01... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestStats(unittest.TestCase):
def setUp(self):
futils._registered_diags = []
self.sc = futils.StatCounter("foo")
def tearDown(self):
futils._registered_diags = []
def test_stats_counter(self):
self.assertTrue(("foo", self.sc._dump) in futils._registered_diags)
... | |
13,259 | [
0.04386594519019127,
-0.007857363671064377,
0.04459444433450699,
-0.05042242258787155,
-0.007772806566208601,
0.046701882034540176,
-0.012436490505933762,
-0.003548172302544117,
0.0361907072365284,
-0.003195306286215782,
0.032548218965530396,
-0.007837850600481033,
-0.032808396965265274,
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_stats_counter(self):
self.assertTrue(("foo", self.sc._dump) in futils._registered_diags)
self.sc.increment("bar")
self.sc.increment("baz")
self.assertEqual(self.sc.stats["bar"], 1)
self.sc.increment("bar")
self.assertEqual(self.sc.stats["bar"], 2)
self.sc... | |
13,260 | [
0.015502985566854477,
0.014897990971803665,
0.030527018010616302,
-0.02661976031959057,
-0.0020308280363678932,
0.021426891908049583,
-0.021300850436091423,
-0.012478013522922993,
0.015805482864379883,
0.007638056296855211,
0.036173634231090546,
-0.005025866441428661,
0.002131660468876362,
... | 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_dump_diags_process(self):
process_results = [
('Execution time in user mode (seconds)', 'ru_utime', 1),
('Execution time in kernel mode (seconds)', 'ru_stime', 2),
('Maximum Resident Set Size (KB)', 'ru_maxrss', 3),
('Soft page faults', 'ru_minflt', 4),
... | |
13,261 | [
0.053248338401317596,
0.0006865180330350995,
0.003524759551510215,
-0.03478468209505081,
-0.004143080674111843,
0.03534017875790596,
-0.03129298985004425,
-0.027907103300094604,
0.017088141292333603,
-0.008365517482161522,
0.04949212074279785,
-0.025843828916549683,
-0.022629883140325546,
... | 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_dump_diags(self):
with mock.patch("calico.felix.futils.stat_log") as m_log:
self.sc.increment("bar")
futils.dump_diags()
m_log.assert_has_calls([
mock.call.info("=== DIAGNOSTICS ==="),
mock.call.info("--- %s ---", "foo"),
... | |
13,262 | [
-0.006735802162438631,
0.0010053536389023066,
0.050372082740068436,
-0.03460098057985306,
-0.015825338661670685,
0.004425454419106245,
0.032149624079465866,
-0.02553313598036766,
0.01401393860578537,
0.028440052643418312,
0.0017680124146863818,
-0.04128254950046539,
0.015391469933092594,
-... | 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 CompilePycTests(TestCase):
def setUp(self):
self._settings = os.environ.get('DJANGO_SETTINGS_MODULE')
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_extensions.settings'
def tearDown(self):
if self._settings:
os.environ['DJANGO_SETTINGS_MODULE'] = self._settings
d... | |
13,263 | [
0.026780376210808754,
0.015883998945355415,
0.0717138946056366,
-0.025769371539354324,
-0.007661164738237858,
0.00677372794598341,
0.019647181034088135,
-0.03581201285123825,
0.044888585805892944,
0.010666093789041042,
0.024151766672730446,
-0.039159562438726425,
0.015558230690658092,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_compiles_pyc_files(self):
with self.settings(BASE_DIR=get_project_root()):
call_command('clean_pyc')
pyc_glob = self._find_pyc(get_project_root())
self.assertEqual(len(pyc_glob), 0)
with self.settings(BASE_DIR=get_project_root()):
call_command('compile_py... | |
13,264 | [
-0.01679311692714691,
-0.007752919569611549,
0.02293694019317627,
0.0012967855436727405,
0.008180061355233192,
-0.026611531153321266,
0.019437886774539948,
0.022679483518004417,
-0.04933782294392586,
0.06647031754255295,
0.015657972544431686,
0.048261191695928574,
0.009818414226174355,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "shape", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "level", "annotation": null, "type_comment": null}}, {"_type": "a... | def _create_W(shape, level, filter_low, filter_high):
d = 1 << (level-1)
sh = (shape[0]//d, shape[1]//d)
if np.min(sh) >= SPARSITY_THRESHOLD:
W = scipy.sparse.lil_matrix(sh)
else:
W = np.asmatrix(np.zeros(sh))
_populate(W, filter_low, 0)
_populate(W, filter_high, shape[0]//(2*d)... | |
13,265 | [
-0.0065099685452878475,
0.0017245241906493902,
0.06398234516382217,
-0.03147367015480995,
-0.004460534080862999,
-0.02458145283162594,
0.02500486560165882,
-0.02144114300608635,
0.009191581979393959,
0.01948874071240425,
0.007633187808096409,
-0.054620224982500076,
0.022523196414113045,
-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_takes_path(self):
out = six.StringIO()
project_root = os.path.join(get_project_root(), 'tests', 'testapp')
with self.settings(BASE_DIR=get_project_root()):
call_command('clean_pyc', path=project_root)
pyc_glob = self._find_pyc(project_root)
self.assertEqual(l... | |
13,266 | [
-0.03806396201252937,
0.0002551292709540576,
0.041223589330911636,
-0.027376364916563034,
0.025891976431012154,
-0.010772420093417168,
-0.011323763988912106,
0.017017453908920288,
-0.02268993854522705,
0.017229510471224785,
0.00981286820024252,
-0.03388646990060806,
0.023156460374593735,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "wavelet", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def _get_filters(wavelet):
global _db_kernels
try:
lowpass = _db_kernels[wavelet]
except KeyError:
raise ValueError("Wavelet type not supported: ('{0}')".format(wavelet))
highpass = lowpass[::-1].copy()
highpass[1::2] *= -1
return lowpass, highpass | |
13,267 | [
-0.009550123475492,
-0.0064235227182507515,
0.022628318518400192,
0.015827657654881477,
0.015255865640938282,
-0.014842229895293713,
0.026959329843521118,
0.045499950647354126,
-0.04885770007967949,
0.0734325423836708,
0.020852116867899895,
0.019294898957014084,
0.054745931178331375,
0.054... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "shape", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "level", "annotation": null, "type_comment": null}}, {"_type": "a... | def _create_single(shape, level, filtr):
d = 1 << (level-1)
sh = (shape[0]//(2*d), shape[1]//d)
if np.min(sh) >= SPARSITY_THRESHOLD:
GH = scipy.sparse.lil_matrix(sh)
else:
GH = np.asmatrix(np.zeros(sh))
_populate(GH, filtr, 0)
if scipy.sparse.issparse(GH):
return GH.tocsr... | |
13,268 | [
0.013477178290486336,
-0.01770118437707424,
0.06614717841148376,
0.0014276147121563554,
0.00021716156334150583,
-0.01756492629647255,
0.00491768354550004,
-0.021082865074276924,
-0.01850634627044201,
0.08656114339828491,
0.029109714552760124,
-0.0025672290939837694,
-0.01264104899019003,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "A", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "levels", "annotation": null, "type_comment": null}}], "kwarg": null,... | def wavedec(A, levels=np.inf):
A = A.reshape((len(A), 1))
levels = min(max_level, levels)
coefs = Wgs[levels] * A
for l in range(levels-1, 0, -1):
N = 1 << l
coefs[:N] = Ws[max_level-l] * coefs[:N]
return np.asarray(coefs).fla... | |
13,269 | [
-0.03813980147242546,
0.005401910282671452,
0.016458451747894287,
-0.021986722946166992,
-0.006007387302815914,
-0.017901066690683365,
-0.005554595962166786,
0.0023337199818342924,
-0.033274926245212555,
0.06351719796657562,
0.009108483791351318,
-0.0032643121667206287,
0.013046719133853912,... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "shape", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "wavelet", "annotation": null, "type_comment": null}}], "kwarg": ... | def _arrange_filter_matrices(shape, wavelet):
filter_low, filter_high = _get_filters(wavelet)
assert len(shape) == 2
assert shape[0] == shape[1], "Shape must be square (at least for now)"
levels_list = range(1, int(np.log2(shape[0]))+1)
max_level = int(np.log2(max(shape)))
# Setup matrices
... | |
13,270 | [
0.012464312836527824,
-0.017232710495591164,
0.06499339640140533,
-0.00892316922545433,
0.0002804470423143357,
-0.014036733657121658,
0.008910384960472584,
-0.010099289007484913,
-0.018076449632644653,
0.08815784752368927,
0.024391701444983482,
-0.003346188459545374,
-0.013998381793498993,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "A", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "levels", "annotation": null, "type_comment": null}}], "kwarg": null,... | def wavedec2(A, levels=np.inf):
levels = min(max_level, levels)
coefs = Wgs[levels] * A * WgsT[levels]
for l in range(levels-1, 0, -1):
N = 1 << l
L = max_level-l
coefs[:N,:N] = Ws[L] * coefs[:N,:N] * WsT[L]
return np.asarr... | |
13,271 | [
0.00572157371789217,
-0.030984878540039062,
0.06266292929649353,
0.006637141108512878,
-0.010432268492877483,
-0.023567916825413704,
-0.0003942427283618599,
-0.013332046568393707,
-0.01074419729411602,
0.07204388827085495,
0.029598530381917953,
0.01467218343168497,
0.0013870700495317578,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "coefs", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def waverec(coefs):
levels = int(np.log2(coefs.shape[0]))
A = coefs.reshape((len(coefs), 1)).copy()
for l in range(1, levels):
N = 1 << l
A[:N] = WsT[max_level-l] * A[:N]
A = WgsT[levels] * A
return np.asarray(A).flatten() | |
13,272 | [
-0.0022488939575850964,
-0.018528897315263748,
0.06813023239374161,
-0.014343822374939919,
-0.005950289778411388,
-0.018108053132891655,
0.0015620971098542213,
-0.009585928171873093,
-0.01572326011955738,
0.06770938634872437,
0.03086201287806034,
0.006423741113394499,
-0.01815481297671795,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "coefs", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "levels", "annotation": null, "type_comment": null}}], "kwarg": n... | def waverec2(coefs, levels=np.inf):
#print coefs.shape
levels = int(np.log2(coefs.shape[0]))
#levels = min(max_level, levels)
A = coefs.copy()
for l in range(1, levels):
N = 1 << l
L = max_level-l
A[:N,:N] = WsT... | |
13,273 | [
0.01873571053147316,
0.055106453597545624,
0.005207051523029804,
-0.07760381698608398,
-0.0004989335429854691,
-0.02022343873977661,
0.013691945932805538,
-0.017199600115418434,
0.0011195766273885965,
0.04107583686709404,
0.03331061825156212,
0.015143388882279396,
-0.005291719455271959,
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_not_required(self):
f = self.field_type('field', required=False)
obj = f.translate(None, validate=True)
self.assertIsNone(obj)
obj = f.translate(None)
self.assertIsNone(obj)
obj = f.translate(None, validate=True)
self.assertIsNone(obj) | |
13,274 | [
0.03773082420229912,
0.017086973413825035,
0.05007529258728027,
-0.05639863386750221,
-0.02780410833656788,
-0.02350330539047718,
0.011803959496319294,
-0.03880021348595619,
-0.010612521320581436,
0.04556525871157646,
0.004925581626594067,
-0.042450085282325745,
-0.056305643171072006,
-0.0... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "too_small", "annotation": null, "type_comment": null}}, {"_type":... | def size_test_helper(self, too_small, valid, too_large, minimum=5, maximum=10):
f = self.field_type('field', minimum=minimum, maximum=maximum)
self.assertRaises(self.validation_exception, f.translate, too_small, validate=True)
obj = f.translate(valid, validate=True)
self.assertEqual(val... | |
13,275 | [
0.01339519303292036,
-0.0016908881952986121,
0.033865734934806824,
0.008388484828174114,
0.008004737086594105,
-0.0052135721780359745,
-0.005303512793034315,
-0.037559304386377335,
-0.01780829019844532,
0.023156775161623955,
-0.0036695871967822313,
-0.026166794821619987,
-0.02515945769846439... | 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": "grade_sheet", "annotation": null, "type_comment": null}}, {"_type... | def grade(self, grade_sheet, generate_random_scores=False):
total_percent = 0.0
section_breakdown = []
grade_breakdown = OrderedDict()
for subgrader, assignment_type, weight in self.subgraders:
subgrade_result = subgrader.grade(grade_sheet, generate_random_scores)
... | |
13,276 | [
0.022862737998366356,
0.01951172947883606,
0.03611503541469574,
-0.031082196161150932,
-0.011330206878483295,
0.008794819936156273,
0.01738731563091278,
-0.03980746865272522,
0.05680277571082115,
0.03044993057847023,
0.02807261049747467,
-0.021699368953704834,
0.010071997530758381,
0.00451... | 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 testBetaIncFpropAndBpropAreNeverNAN(self):
with self.test_session() as sess:
space = np.logspace(-8, 5).tolist()
space_x = np.linspace(1e-16, 1 - 1e-16).tolist()
ga_s, gb_s, gx_s = zip(*list(itertools.product(space, space, space_x)))
# Test grads are never nan
ga_s_t = constant_op.... | |
13,277 | [
0.01520419679582119,
0.013113930821418762,
0.02801951766014099,
-0.023913638666272163,
0.008734325878322124,
-0.01755574531853199,
-0.021412784233689308,
-0.05822883918881416,
-0.03866992145776749,
0.03451427444815636,
-0.018488900735974312,
-0.020840449258685112,
-0.025506222620606422,
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": "grade_sheet", "annotation": null, "type_comment": null}}, {"_type... | def grade(self, grade_sheet, generate_random_scores=False):
scores = list(grade_sheet.get(self.type, {}).values())
breakdown = []
labeler = get_short_labeler(self.short_label)
for i in range(max(int(float(self.min_count)), len(scores))):
if i < len(scores) or generate_random_... | |
13,278 | [
0.003419312182813883,
-0.0008263580966740847,
0.020194673910737038,
0.00975277740508318,
-0.037889834493398666,
0.018606197088956833,
-0.020066194236278534,
0.06428657472133636,
-0.031489208340644836,
0.029106494039297104,
-0.004978588782250881,
-0.035016559064388275,
0.039805348962545395,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "pyqtSignal", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fi... | class AmountEdit(MyLineEdit):
shortcut = pyqtSignal()
def __init__(self, base_unit, is_int = False, parent=None):
QLineEdit.__init__(self, parent)
# This seems sufficient for hundred-BTC amounts with 8 decimals
self.setFixedWidth(140)
self.base_unit = base_unit
self.text... | |
13,279 | [
0.01722257025539875,
0.015485950745642185,
0.043324101716279984,
-0.01343595515936613,
-0.0008960568229667842,
-0.013050765730440617,
0.03454960137605667,
-0.010471949353814125,
0.049487143754959106,
0.0468495711684227,
0.029039422050118446,
0.006385016720741987,
-0.030919672921299934,
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 testBetaIncGrads(self):
err_tolerance = 1e-3
with self.test_session():
# Test gradient
ga_s = np.abs(np.random.randn(2, 2) * 30) # in (0, infty)
gb_s = np.abs(np.random.randn(2, 2) * 30) # in (0, infty)
gx_s = np.random.rand(2, 2) # in (0, 1)
tf_ga_s = constant_op.constant(g... | |
13,280 | [
0.018603429198265076,
-0.0009274507174268365,
-0.0017364693339914083,
0.030395416542887688,
-0.04547789320349693,
0.005284628365188837,
0.012937896884977818,
0.05164916068315506,
0.031855009496212006,
0.012918692082166672,
-0.008392668329179287,
0.014019789174199104,
-0.02486432157456875,
... | 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 numbify(self):
text = unicode(self.text()).strip()
if text == '!':
self.shortcut.emit()
return
pos = self.cursorPosition()
chars = '0123456789'
if not self.is_int: chars +='.'
s = ''.join([i for i in text if i in chars])
if not self.is_... | |
13,281 | [
-0.029738852754235268,
-0.003145001595839858,
0.03818846493959427,
0.017324062064290047,
-0.03943938389420509,
-0.00980084016919136,
-0.01686381734907627,
0.0024546354543417692,
-0.020510368049144745,
0.037976041436195374,
-0.026434535160660744,
0.012237774208188057,
-0.0014493265189230442,
... | 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": "base_unit", "annotation": null, "type_comment": null}}, {"_type":... | def __init__(self, base_unit, is_int = False, parent=None):
QLineEdit.__init__(self, parent)
# This seems sufficient for hundred-BTC amounts with 8 decimals
self.setFixedWidth(140)
self.base_unit = base_unit
self.textChanged.connect(self.numbify)
self.is_int = is_int
... | |
13,282 | [
0.002245359355583787,
-0.014156990684568882,
0.020870614796876907,
0.057481199502944946,
-0.051598358899354935,
0.0005746716633439064,
0.012495424598455429,
0.03801393508911133,
-0.010109730996191502,
0.01267505344003439,
0.009851514361798763,
-0.050834935158491135,
0.017390308901667595,
-... | 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": "decimal_point", "annot... | class BTCAmountEdit(AmountEdit):
def __init__(self, decimal_point, is_int = False, parent=None):
AmountEdit.__init__(self, self._base_unit, is_int, parent)
self.decimal_point = decimal_point
def _base_unit(self):
p = self.decimal_point()
assert p in [2, 5, 8]
if p == 8:... | |
13,283 | [
-0.021598754450678825,
0.02567875199019909,
0.010268346406519413,
0.002218761947005987,
-0.018233807757496834,
0.016435664147138596,
-0.038381427526474,
0.010883500799536705,
-0.07179956138134003,
0.059769872575998306,
0.002747163875028491,
0.019884733483195305,
0.01373319048434496,
0.0263... | 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": "event", "annotation": null, "type_comment": null}}], "kwarg": nul... | def paintEvent(self, event):
QLineEdit.paintEvent(self, event)
if self.base_unit:
panel = QStyleOptionFrameV2()
self.initStyleOption(panel)
textRect = self.style().subElementRect(QStyle.SE_LineEditContents, panel, self)
textRect.adjust(2, 0, -10, 0)
... | |
13,284 | [
0.025844743475317955,
-0.03749162703752518,
0.033471908420324326,
-0.02911720983684063,
0.016581349074840546,
-0.014249395579099655,
0.024182744324207306,
0.02486558072268963,
-0.010203907266259193,
0.012722674757242203,
0.028369953855872154,
-0.035559069365262985,
-0.02553553506731987,
-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 setUp(self):
super(WikiRedirectTestCase, self).setUp()
self.toy = CourseFactory.create(org='edX', course='toy', display_name='2012_Fall')
# Create two accounts
self.student = 'view@test.com'
self.instructor = 'view2@test.com'
self.password = 'foo'
self.create... | |
13,285 | [
-0.04472515732049942,
-0.03307519108057022,
0.03189234063029289,
0.02814292721450329,
-0.016191668808460236,
0.03180306777358055,
-0.04365389794111252,
0.03291896730661392,
0.012531525455415249,
-0.021481020376086235,
-0.01977369748055935,
-0.003886111779138446,
-0.03394559025764465,
-0.04... | 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 _base_unit(self):
p = self.decimal_point()
assert p in [2, 5, 8]
if p == 8:
return 'BTC'
if p == 5:
return 'mBTC'
if p == 2:
return 'bits'
raise Exception('Unknown base unit') | |
13,286 | [
-0.04192793741822243,
-0.008096356876194477,
-0.004019149579107761,
0.03496105968952179,
0.02057340182363987,
-0.018873905763030052,
-0.04429245367646217,
-0.00019759280257858336,
0.024405185133218765,
-0.01586548052728176,
0.013669858686625957,
-0.03240653872489929,
0.012181480415165424,
... | 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": "module", "annotation":... | class UserIPAClient(IPAClient):
def __init__(self, module, host, port, protocol):
super(UserIPAClient, self).__init__(module, host, port, protocol)
def user_find(self, name):
return self._post_json(method='user_find', name=None, item={'all': True, 'uid': name})
def user_add(self, name, ite... | |
13,287 | [
0.004322766326367855,
-0.006620872300118208,
-0.02569224312901497,
0.007144491653889418,
-0.000655614712741226,
-0.021456746384501457,
0.04586903005838394,
0.05627159774303436,
0.008790982887148857,
0.03814274072647095,
0.0021672011353075504,
-0.03039317950606346,
0.040237218141555786,
-0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "displayname", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "givenname", "annotation": null, "type_comment": null}}, {"... | def get_user_dict(displayname=None, givenname=None, krbpasswordexpiration=None, loginshell=None,
mail=None, nsaccountlock=False, sn=None, sshpubkey=None, telephonenumber=None,
title=None, userpassword=None, gidnumber=None, uidnumber=None):
user = {}
if displayname is not None... | |
13,288 | [
-0.019310636445879936,
0.021899906918406487,
0.012668068520724773,
0.005012175068259239,
-0.0022399008739739656,
0.025384534150362015,
-0.019504226744174957,
0.025311937555670738,
0.06098095700144768,
0.03068406879901886,
0.0224806796759367,
-0.06630469113588333,
-0.006896656006574631,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
argument_spec = ipa_argument_spec()
argument_spec.update(displayname=dict(type='str'),
givenname=dict(type='str'),
krbpasswordexpiration=dict(type='str'),
loginshell=dict(type='str'),
mail=dict(type='... | |
13,289 | [
-0.026613930240273476,
0.05653892457485199,
-0.002284195041283965,
0.026162421330809593,
-0.009042716585099697,
0.026764433830976486,
-0.003282844554632902,
0.009406431578099728,
0.05127132311463356,
0.0324835442006588,
0.05503389611840248,
-0.03993343934416771,
-0.010735874064266682,
0.05... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}], "kwarg": ... | def ensure(module, client):
state = module.params['state']
name = module.params['uid']
nsaccountlock = state == 'disabled'
module_user = get_user_dict(displayname=module.params.get('displayname'),
krbpasswordexpiration=module.params.get('krbpasswordexpiration'),
... | |
13,290 | [
0.0011919836979359388,
0.03178204223513603,
0.009259285405278206,
0.009139851666986942,
0.00017060611571650952,
0.02730640582740307,
-0.017952831462025642,
-0.031907763332128525,
0.01063592080026865,
0.03588051721453667,
0.046441007405519485,
-0.015878448262810707,
0.009724450297653675,
-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 process_state(self):
try:
dvs_host_states = {
'absent': {
'present': self.state_destroy_dvs_host,
'absent': self.state_exit_unchanged,
},
'present': {
'update': self.state_update_dvs_host,... | |
13,291 | [
0.013508043251931667,
0.020066037774086,
-0.006326326634734869,
-0.02193126454949379,
-0.024129144847393036,
0.02585180476307869,
-0.04443278908729553,
-0.00566102284938097,
0.004639306105673313,
-0.00817373301833868,
0.03547494858503342,
0.02139664627611637,
-0.00705103250220418,
-0.00033... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation":... | class VMwareDvsHost(object):
def __init__(self, module):
self.module = module
self.dv_switch = None
self.uplink_portgroup = None
self.host = None
self.dv_switch = None
self.nic = None
self.content = connect_to_api(self.module)
self.state = self.module.... | |
13,292 | [
0.023224052041769028,
-0.0158552173525095,
0.0067576756700873375,
-0.013096270151436329,
-0.02182711660861969,
0.013166116550564766,
-0.026565056294202805,
-0.006524852942675352,
-0.02077941596508026,
-0.020988956093788147,
0.037484437227249146,
0.04484162852168083,
-0.010709838941693306,
... | 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": "operation", "annotation": null, "type_comment": null}}], "kwarg":... | def modify_dvs_host(self, operation):
spec = vim.DistributedVirtualSwitch.ConfigSpec()
spec.configVersion = self.dv_switch.config.configVersion
spec.host = [vim.dvs.HostMember.ConfigSpec()]
spec.host[0].operation = operation
spec.host[0].host = self.host
if operation in ... | |
13,293 | [
0.024407753720879555,
0.023630591109395027,
0.028463568538427353,
0.00409831665456295,
-0.014559649862349033,
0.03931955248117447,
-0.0335879810154438,
-0.01659969985485077,
-0.006982317194342613,
0.007923412136733532,
0.06324157863855362,
0.012185662053525448,
0.0008576107211410999,
-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 state_destroy_dvs_host(self):
operation = "remove"
changed = True
result = None
if not self.module.check_mode:
changed, result = self.modify_dvs_host(operation)
self.module.exit_json(changed=changed, result=str(result)) | |
13,294 | [
0.011547408066689968,
0.018720243126153946,
0.021555161103606224,
0.01165127381682396,
0.003891904139891267,
0.04313476383686066,
-0.009518974460661411,
-0.009977204725146294,
-0.029082361608743668,
0.015592055395245552,
0.056405115872621536,
-0.010881446301937103,
0.02441452071070671,
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 state_update_dvs_host(self):
operation = "edit"
changed = True
result = None
if not self.module.check_mode:
changed, result = self.modify_dvs_host(operation)
self.module.exit_json(changed=changed, result=str(result)) | |
13,295 | [
0.009543251246213913,
0.007436062209308147,
0.028989071026444435,
0.012777116149663925,
-0.0008465296123176813,
0.018635831773281097,
-0.009001228027045727,
-0.03278931975364685,
-0.016406839713454247,
0.003788067726418376,
0.0326431542634964,
0.021510377526283264,
0.03227774798870087,
-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 state_create_dvs_host(self):
operation = "add"
changed = True
result = None
if not self.module.check_mode:
changed, result = self.modify_dvs_host(operation)
self.module.exit_json(changed=changed, result=str(result)) | |
13,296 | [
0.008360840380191803,
-0.023533759638667107,
-0.014475668780505657,
-0.03966308757662773,
-0.011014096438884735,
0.02380525693297386,
-0.0021226045209914446,
-0.008169558830559254,
0.005871099419891834,
0.004476597532629967,
0.013833951205015182,
0.014586735516786575,
0.013142870739102364,
... | 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 check_uplinks(self):
pnic_device = []
for dvs_host_member in self.dv_switch.config.host:
if dvs_host_member.config.host == self.host:
for pnicSpec in dvs_host_member.config.backing.pnicSpec:
pnic_device.append(pnicSpec.pnicDevice)
return coll... | |
13,297 | [
-0.005738742183893919,
0.01738731563091278,
-0.0018573341658338904,
0.007336542475968599,
-0.027188703417778015,
0.033173929899930954,
-0.0567900575697422,
-0.04867056384682655,
-0.001573151908814907,
0.001955928048118949,
0.0252632237970829,
0.015485034324228764,
0.004541116766631603,
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 check_dvs_host_state(self):
self.dv_switch = find_dvs_by_name(self.content, self.switch_name)
if self.dv_switch is None:
raise Exception("A distributed virtual switch %s does not exist" % self.switch_name)
self.uplink_portgroup = self.find_dvs_uplink_pg()
if self.uplin... | |
13,298 | [
0.036673642694950104,
0.04051899164915085,
-0.015326462686061859,
-0.017293084412813187,
-0.03194935619831085,
0.03302605450153351,
0.003996416460722685,
0.0020998353138566017,
0.03597049415111542,
0.04886889085173607,
0.03225698322057724,
-0.04306790977716446,
0.005108820740133524,
0.0052... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
argument_spec = vmware_argument_spec()
argument_spec.update(dict(esxi_hostname=dict(required=True, type='str'),
switch_name=dict(required=True, type='str'),
vmnics=dict(required=True, type='list'),
state=dict(default='presen... | |
13,299 | [
-0.009275362826883793,
0.031857725232839584,
0.017655963078141212,
-0.012068896554410458,
0.04765133187174797,
-0.04656929522752762,
-0.0012914239196106791,
-0.014378633350133896,
0.010903623886406422,
-0.021453503519296646,
0.004068050533533096,
-0.0534776970744133,
0.01010770071297884,
-... | 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": "request", "annotation"... | class XLSXResponse(web.StreamResponse):
def __init__(self, request, *args, fields=None, head=None, filename=None, **kwargs):
if filename:
headers = kwargs.setdefault('headers', {})
v = 'attachment; filename="{}"'.format(filename)
headers['Content-Disposition'] = v
... | |
13,300 | [
0.03511083498597145,
0.038359832018613815,
0.01619083806872368,
0.0014674639096483588,
0.015367758460342884,
-0.04152218997478485,
0.02451910264790058,
0.005466438364237547,
-0.005341893527656794,
-0.015248628333210945,
0.026230240240693092,
-0.015714317560195923,
-0.0020279160235077143,
-... | 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 prepare_workbook(self):
wb = openpyxl.Workbook()
self.file = io.BytesIO()
self.archive = ZipFile(self.file, 'w', ZIP_DEFLATED)
self.ws = wb.active
self.writer = ExcelWriter(wb, self.archive)
if self.head:
self.ws.append(self.head) |