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 |
|---|---|---|---|---|---|
1,101 | [
-0.007603754755109549,
-0.05950665473937988,
0.05425875261425972,
-0.03938208892941475,
-0.011705105192959309,
0.021676119416952133,
-0.02906881831586361,
-0.0011601002188399434,
0.007849037647247314,
-0.020786259323358536,
0.033449675887823105,
-0.0660323053598404,
-0.01601751148700714,
-... | 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 CreateAsyncHTTPClientTestCase(AsyncTestCase):
def setUp(self):
super(CreateAsyncHTTPClientTestCase, self).setUp()
self.saved = AsyncHTTPClient._save_configuration()
def tearDown(self):
AsyncHTTPClient._restore_configuration(self.saved)
super(CreateAsyncHTTPClientTestCase, ... | |
1,102 | [
-0.012273991480469704,
-0.053753290325403214,
-0.0012352826306596398,
-0.023713544011116028,
0.0016264250734820962,
-0.02470322698354721,
0.006316496524959803,
0.022704457864165306,
-0.00022680200345348567,
-0.01815386302769184,
0.024509171023964882,
-0.04878547415137291,
-0.0142533537000417... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class SimpleHTTPSClientTestCase(SimpleHTTPClientTestMixin, AsyncHTTPSTestCase):
def setUp(self):
super(SimpleHTTPSClientTestCase, self).setUp()
self.http_client = self.create_client()
def create_client(self, **kwargs):
return SimpleAsyncHTTPClient(self.io_loop, force_instance=True,
... | |
1,103 | [
0.004557269159704447,
-0.03569656237959862,
0.056996576488018036,
-0.02840001881122589,
0.008690749295055866,
0.03690037131309509,
-0.02466575987637043,
0.0016997632337734103,
0.013598105870187283,
-0.014101739041507244,
0.04581836983561516,
-0.052672699093818665,
-0.022798631340265274,
-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_max_clients(self):
AsyncHTTPClient.configure(SimpleAsyncHTTPClient)
with closing(AsyncHTTPClient(
self.io_loop, force_instance=True)) as client:
self.assertEqual(client.max_clients, 10)
with closing(AsyncHTTPClient(
self.io_loop, max_clients=1... | |
1,104 | [
-0.061196211725473404,
-0.04302995651960373,
0.026439566165208817,
-0.008289722725749016,
-0.002807015087455511,
0.00777537701651454,
0.012059768661856651,
-0.010943529196083546,
0.008563311770558357,
0.02587050199508667,
-0.00920350756496191,
-0.04727604612708092,
-0.03070754185318947,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class ResolveTimeoutTestCase(AsyncHTTPTestCase):
def setUp(self):
# Dummy Resolver subclass that never invokes its callback.
class BadResolver(Resolver):
def resolve(self, *args, **kwargs):
pass
super(ResolveTimeoutTestCase, self).setUp()
self.http_client... | |
1,105 | [
0.014727634377777576,
0.0081629054620862,
0.0776447057723999,
0.011314863339066505,
0.03396123647689819,
-0.024394378066062927,
0.017135996371507645,
0.048300426453351974,
-0.017912887036800385,
-0.0010654506040737033,
0.0025401562452316284,
-0.0003065945056732744,
0.008662334643304348,
0.... | 8 | {"_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():
cnx = mysql.connector.connect(user = 'b5a075cbf96ce0', password = 'bd3dcb49',
host = 'us-cdbr-azure-southcentral-f.cloudapp.net',
database = 'gdisqldb')
cursor = cnx.cursor()
cursor.execute("select * from user;")
result=cursor.fetchall()
c = csv.writer(open(r"S:\Time Track\t... | |
1,106 | [
-0.03136907517910004,
-0.022929739207029343,
0.018738774582743645,
0.013996670953929424,
-0.029003765434026718,
0.002711209002882242,
0.021115567535161972,
-0.000778629386331886,
0.023033076897263527,
0.006481640972197056,
0.010345364920794964,
-0.04877592995762825,
-0.025030961260199547,
... | 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):
# Dummy Resolver subclass that never invokes its callback.
class BadResolver(Resolver):
def resolve(self, *args, **kwargs):
pass
super(ResolveTimeoutTestCase, self).setUp()
self.http_client = SimpleAsyncHTTPClient(
self.io_loop,
... | |
1,107 | [
0.035841211676597595,
-0.008538013324141502,
-0.005266483873128891,
0.010843616910278797,
0.020289311185479164,
-0.000836084655020386,
0.023201651871204376,
0.015590733848512173,
-0.034229718148708344,
0.04547135531902313,
-0.01735755428671837,
-0.014969433657824993,
-0.02570626512169838,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class BackgroundLayer(cocos.layer.Layer):
def __init__(self):
super(BackgroundLayer, self).__init__()
self.img = pyglet.resource.image('background_image.png')
def draw( self ):
glColor4ub(255, 255, 255, 255)
glPushMatrix()
self.transform()
self.img.blit(0,0)
... | |
1,108 | [
0.024442916736006737,
0.000510245852638036,
0.05582762137055397,
-0.010815990157425404,
-0.03297349438071251,
0.011659271083772182,
0.021363109350204468,
-0.007210660260170698,
-0.028598211705684662,
-0.006654583849012852,
-0.00908054318279028,
-0.051818981766700745,
-0.008610017597675323,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def main():
director.init( resizable=True )
director.set_depth_test()
main_scene = cocos.scene.Scene()
main_scene.add( BackgroundLayer(), z=0 )
# In real code after a sequence of grid actions the StopGrid() action
# should be called. Omited here to stay in the last grid action render
actio... | |
1,109 | [
-0.024857226759195328,
-0.023384641855955124,
0.048677753657102585,
-0.019732631742954254,
0.0501856803894043,
-0.00829948578029871,
-0.03824007511138916,
0.012416832149028778,
-0.03901759907603264,
-0.002001242246478796,
0.006991831120103598,
-0.021876715123653412,
0.01307655032724142,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "__table", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"... | class hashtable():
__table=None
__size=None
def __init__(self, n):
self.__table=[]
for i in range(n):
self.__table.append(None)
self.__size=n
def get_table(self):
return self.__table
def get_size(self):
return self.__size
def hashf(self, va... | |
1,110 | [
0.014455967582762241,
-0.0278327576816082,
0.04221343249082565,
-0.00918556284159422,
0.010973735712468624,
-0.014819876290857792,
-0.04221343249082565,
0.015309271402657032,
0.00898478552699089,
0.02487129159271717,
0.04173658788204193,
-0.030342472717165947,
-0.03619011119008064,
0.00105... | 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": "s", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def hashf2(self,s):
if type(s)==str:
H=0
for i in s:
H=(H<<4)+ord(i)
G=H&0xF0000000
if G!= 0:
H=(H^(G>>24))^G
return H%self.__size
else:
H=0
H=(H<<4)+s
G=H&0xF00000... | |
1,111 | [
0.039742354303598404,
-0.013676948845386505,
0.05678829923272133,
-0.006211959291249514,
0.02959989570081234,
-0.004356055054813623,
-0.04860813543200493,
0.02588808909058571,
-0.0008459435193799436,
0.004524504765868187,
0.018322618678212166,
-0.04061711207032204,
-0.03014366514980793,
-0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def find(self, a):
b=self.hashf2(a)
if(self.__table[b]==a):
return b
elif(self.__table[b]==None):
return self.__size
else:
k=b
b=(b+1)%self.__size
while((self.__table[b]!=None) & (b!=k)& (self.__table[b]!=a)):
b=... | |
1,112 | [
0.027078645303845406,
-0.004406490828841925,
0.059026479721069336,
0.0032388793770223856,
0.028991540893912315,
-0.011756852269172668,
-0.016992470249533653,
0.037885259836912155,
-0.011781695298850536,
-0.000442512275185436,
0.0025324122980237007,
-0.031177707016468048,
-0.04027016833424568... | 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": "a", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def addlin(self, a):
b=self.hashf2(a)
if self.__table[b]==None:
self.__table[b]=a
else:
k=b
b=(b+1)%self.__size
while((self.__table[b]!=None) & (b!=k)):
b=(b+1)%self.__size
if b==k:
print("overflow")
... | |
1,113 | [
0.008958549238741398,
-0.009676222689449787,
0.06206641346216202,
-0.029820585623383522,
-0.008500723168253899,
-0.02375747822225094,
0.005608373787254095,
0.01972365751862526,
-0.015429987572133541,
0.09616829454898834,
0.006681791041046381,
-0.02784079499542713,
0.025588784366846085,
0.0... | 9 | {"_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": "candidate", "annotation": null, "type_comment": null}}, {"_type... | def reconcile_candidate(module, candidate, prefix, w):
netcfg = CustomNetworkConfig(indent=2, contents=get_config(module))
state = w['state']
set_command = set_route_command(prefix, w)
remove_command = remove_route_command(prefix, w)
parents = []
commands = []
if w['vrf'] == 'default':
... | |
1,114 | [
0.02539343386888504,
-0.0011081643169745803,
0.07527202367782593,
-0.01725730113685131,
0.01646415702998638,
0.0059421914629638195,
-0.019534394145011902,
-0.001965272706001997,
-0.027018101885914803,
0.0040552737191319466,
-0.004602160304784775,
-0.007106323726475239,
0.023295437917113304,
... | 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": "a", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def del_lin(self,a):
b=self.find(a)
if b == self.__size:
pass
else:
self.__table[b]=None
k=b
b=(b+1)%self.__size
while((self.__table[b]!=None) & (b!=k)):
c=self.__table[b]
self.__table[b]=None
... | |
1,115 | [
-0.009965924546122551,
-0.044508203864097595,
-0.004046649672091007,
0.005894570145756006,
-0.01629529893398285,
-0.040950708091259,
0.014901947230100632,
0.050714053213596344,
0.01051437109708786,
0.0322941392660141,
-0.023360878229141235,
0.0038761862087994814,
0.02583136036992073,
-0.03... | 8 | {"_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": "w", "annotation": null, "type_comment": null}}], "kwarg": null,... | def set_route_command(prefix, w):
route_cmd = 'ip route {0} {1}'.format(prefix, w['next_hop'])
if w['route_name']:
route_cmd += ' name {0}'.format(w['route_name'])
if w['tag']:
route_cmd += ' tag {0}'.format(w['tag'])
if w['pref']:
route_cmd += ' {0}'.format(w['pref'])
retu... | |
1,116 | [
-0.01944192685186863,
0.01973138377070427,
0.018730342388153076,
-0.022372689098119736,
-0.04464888945221901,
-0.017162445932626724,
0.015594547614455223,
0.02979004941880703,
0.0014314601430669427,
0.07299164682626724,
-0.010746126994490623,
-0.004525796044617891,
0.03960749879479408,
0.0... | 10 | {"_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": "prefix", "annotation": null, "type_comment": null}}, {"_type": ... | def get_existing(module, prefix, warnings):
key_map = ['tag', 'pref', 'route_name', 'next_hop']
netcfg = CustomNetworkConfig(indent=2, contents=get_config(module))
parents = 'vrf context {0}'.format(module.params['vrf'])
prefix_to_regex = fix_prefix_to_regex(prefix)
route_regex = r'.*ip\sroute\s{0}... | |
1,117 | [
0.012974328361451626,
0.03694019466638565,
-0.016767486929893494,
-0.03187546506524086,
-0.05857844278216362,
-0.03198322653770447,
-0.008604652248322964,
-0.01504332385957241,
0.036509156227111816,
0.02633659355342388,
-0.012273886241018772,
-0.06301816552877426,
0.037155717611312866,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def map_params_to_obj(module):
obj = []
aggregate = module.params.get('aggregate')
if aggregate:
for item in aggregate:
for key in item:
if item.get(key) is None:
item[key] = module.params[key]
d = item.copy()
obj.append(d)
... | |
1,118 | [
0.008279330097138882,
0.007040742784738541,
0.019035836681723595,
-0.03155418485403061,
-0.03242848068475723,
0.012048081494867802,
-0.002462272997945547,
-0.01037896890193224,
-0.005964429583400488,
0.08896637707948685,
-0.010027925483882427,
-0.06490994989871979,
0.03658801689743996,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
element_spec = dict(
prefix=dict(type='str', aliases=['address']),
next_hop=dict(type='str'),
vrf=dict(type='str', default='default'),
tag=dict(type='str'),
route_name=dict(type='str'),
pref=dict(type='str', aliases=['admin_distance']),
state=dict(... | |
1,119 | [
0.028751615434885025,
0.008919586427509785,
-0.07458160072565079,
-0.01425089966505766,
0.006353289354592562,
-0.027457110583782196,
-0.0043150135315954685,
0.01384210865944624,
0.047147199511528015,
0.000018241666111862287,
-0.009050172753632069,
0.0024314532056450844,
-0.002129118423908949... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def _some_str(value):
try:
if PY2:
# If there is a working __unicode__, great.
# Otherwise see if we can get a bytestring...
# Otherwise we fallback to unprintable.
try:
return unicode(value)
except:
return "b%s" % r... | |
1,120 | [
0.03870711848139763,
0.0018873572116717696,
-0.021842382848262787,
-0.02642892673611641,
-0.026073381304740906,
0.015359591692686081,
-0.000990344095043838,
-0.010186395607888699,
-0.015679582953453064,
0.04178851842880249,
0.045699525624513626,
-0.0330657884478569,
0.04124334827065468,
-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": "exc_type", "annotation": null, "type_comment": null}}, {"_type": ... | def __init__(self, exc_type, exc_value, exc_traceback, limit=None,
lookup_lines=True, capture_locals=False, _seen=None):
# NB: we need to accept exc_traceback, exc_value, exc_traceback to
# permit backwards compat with the existing API, otherwise we
# need stub thunk objects just to ... | |
1,121 | [
0.03994402289390564,
0.024737263098359108,
-0.0055974191054701805,
-0.007171236909925938,
-0.03905637562274933,
0.006283591967076063,
-0.022634945809841156,
0.01839527301490307,
0.00541346613317728,
0.05213746055960655,
0.031044213101267815,
-0.0007956685731187463,
0.05760348588228226,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def scan_command_cd_command(state):
params = {
'path': None,
'-': None,
}
bang = state.consume() == '!'
if not bang:
state.backup()
state.skip(' ')
state.ignore()
c = state.consume()
if c == '-':
params['-'] = '-'
state.expect(EOF)
rai... | |
1,122 | [
0.032443318516016006,
-0.03676290065050125,
0.004429894499480724,
0.006781280506402254,
0.027264462783932686,
0.04540206491947174,
0.009823567233979702,
0.002757798181846738,
-0.02209722064435482,
-0.02366480976343155,
0.029842277988791466,
-0.034556660801172256,
0.015559786930680275,
-0.0... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__(self):
SequentialDataSet.__init__(self, 0, 1)
self.newSequence()
self.addSample([],[0])
self.addSample([],[1])
self.addSample([],[0])
self.addSample([],[1])
self.addSample([],[0])
self.addSample([],[1])
self.newSequence()
sel... | |
1,123 | [
0.08393751084804535,
-0.0022725537419319153,
0.037423647940158844,
-0.014958152547478676,
-0.055536240339279175,
-0.009491587057709694,
0.01682368293404579,
-0.0009172185673378408,
-0.032358452677726746,
0.02978063002228737,
0.0732191950082779,
-0.021391402930021286,
-0.043325502425432205,
... | 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 finalize_options (self):
self.egg_name = safe_name(self.distribution.get_name())
self.vtags = self.tags()
self.egg_version = self.tagged_version()
try:
list(
parse_requirements('%s==%s' % (self.egg_name,self.egg_version))
)
except Valu... | |
1,124 | [
-0.011293821968138218,
0.013838505372405052,
0.00488922419026494,
-0.014124425128102303,
-0.009841350838541985,
-0.04398586228489876,
-0.02568701095879078,
0.004640473984181881,
-0.02591574750840664,
0.06098091974854469,
-0.0009206609101966023,
-0.029415402561426163,
0.030947931110858917,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "template", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type... | def autohandler(template, context, name='autohandler'):
lookup = context.lookup
_template_uri = template.module._template_uri
if not lookup.filesystem_checks:
try:
return lookup._uri_cache[(autohandler, _template_uri, name)]
except KeyError:
pass
tokens = re.find... | |
1,125 | [
0.06336347758769989,
0.026016026735305786,
0.07178111374378204,
-0.04976576939225197,
-0.03908185288310051,
-0.03653806447982788,
0.03427178040146828,
0.013724899850785732,
-0.06969983130693436,
0.006954951211810112,
0.02407349832355976,
-0.009510303847491741,
-0.002905123168602586,
-0.046... | 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 run(self):
self.mkpath(self.egg_info)
installer = self.distribution.fetch_build_egg
for ep in iter_entry_points('egg_info.writers'):
writer = ep.load(installer=installer)
writer(self, ep.name, os.path.join(self.egg_info,ep.name))
# Get rid of native_libs.txt ... | |
1,126 | [
0.01750827766954899,
0.03912896662950516,
0.047190919518470764,
-0.06677576154470444,
-0.04193843528628349,
0.004415241535753012,
0.013080312870442867,
-0.01662268489599228,
-0.021702121943235397,
0.022373951971530914,
-0.001273676403798163,
-0.04772023856639862,
-0.02609954960644245,
0.00... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_svn_revision(self):
revision = 0
urlre = re.compile('url="([^"]+)"')
revre = re.compile('committed-rev="(\d+)"')
for base,dirs,files in os.walk(os.curdir):
if '.svn' not in dirs:
dirs[:] = []
continue # no sense walking uncontrolled... | |
1,127 | [
0.026295648887753487,
0.011415706016123295,
0.03645585849881172,
-0.006399537902325392,
-0.028434641659259796,
-0.011764454655349255,
0.051521800458431244,
-0.020622670650482178,
-0.035897862166166306,
-0.004382607992738485,
0.02462165616452694,
0.007503908593207598,
0.007910782471299171,
... | 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 check_broken_egg_info(self):
bei = self.egg_name+'.egg-info'
if self.egg_base != os.curdir:
bei = os.path.join(self.egg_base, bei)
if os.path.exists(bei):
log.warn(
"-"*78+'\n'
"Note: Your current .egg-info directory has a '-' in its na... | |
1,128 | [
0.0032052770256996155,
0.07012160122394562,
0.03508545458316803,
-0.06662044674158096,
-0.023953281342983246,
-0.0376250222325325,
0.01663045585155487,
0.028379028663039207,
-0.012574547901749611,
0.04948454722762108,
0.003538132645189762,
-0.0003326630685478449,
0.042679496109485626,
-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 run(self):
self.filelist = FileList()
if not os.path.exists(self.manifest):
self.write_manifest() # it must exist so it'll get in the list
self.filelist.findall()
self.add_defaults()
if os.path.exists(self.template):
self.read_template()
self... | |
1,129 | [
0.029456956312060356,
0.03311092033982277,
0.07793454825878143,
-0.03799121454358101,
-0.0494786761701107,
-0.016367757692933083,
0.0372404009103775,
0.03158426284790039,
-0.013739906251430511,
0.026503752917051315,
-0.008734475821256638,
-0.022048920392990112,
0.047851912677288055,
-0.009... | 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 add_defaults(self):
sdist.add_defaults(self)
self.filelist.append(self.template)
self.filelist.append(self.manifest)
rcfiles = list(walk_revctrl())
if rcfiles:
self.filelist.extend(rcfiles)
elif os.path.exists(self.manifest):
self.read_manifest... | |
1,130 | [
0.024082237854599953,
0.01832611672580242,
-0.025828754529356956,
-0.015767838805913925,
-0.01771114580333233,
-0.010657436214387417,
0.010694334283471107,
0.0011499945539981127,
0.020121829584240913,
0.00866493210196495,
0.01929776929318905,
-0.032888613641262054,
0.08486590534448624,
0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "viz_obj", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def getHighlight(viz_obj):
ids = viz_obj["id"]
if not isinstance(ids, list):
ids = [ids]
if profile.attr_type in ids:
return self.attr["id"]
else:
return False | |
1,131 | [
0.01033727265894413,
0.014291573315858841,
0.05783936753869057,
-0.01899186335504055,
0.03208312392234802,
-0.01844218745827675,
0.003544848645105958,
0.0003319790121167898,
-0.022334789857268333,
-0.028650455176830292,
0.030512621626257896,
-0.07210850715637207,
-0.017051171511411667,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Course", "value": {"_type": "Name", "_fields": {"id": "models", "ct... | class CourseFactory(factory.alchemy.SQLAlchemyModelFactory):
class Meta:
model = models.Course
sqlalchemy_session = models.db.session
sqlalchemy_session_persistence = 'flush'
id = factory.Sequence(lambda n: n)
number = factory.Sequence(lambda n: str(n + 1))
title = 'What is Life... | |
1,132 | [
-0.002462782897055149,
-0.029804490506649017,
0.0019372334936633706,
-0.07600612193346024,
0.005588341969996691,
0.012893479317426682,
0.032467275857925415,
0.03087894804775715,
0.03543370962142944,
-0.0027985505294054747,
0.032840996980667114,
-0.0161051694303751,
0.000671535381115973,
-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 Cache(unittest.TestCase):
def test_simple(self):
# simple set/get
cache.set("key", "value")
self.assertEqual(cache.get("key"), "value")
def test_add(self):
# test add (only add if key isn't already in cache)
cache.add("addkey1", "value")
cache.add("addkey1"... | |
1,133 | [
0.06126737967133522,
-0.03244901821017265,
0.02670803852379322,
-0.07007172703742981,
0.010744483210146427,
0.01670103333890438,
0.01665564998984337,
0.06462574005126953,
0.05128306522965431,
-0.019208457320928574,
0.05101076513528824,
-0.032517094165086746,
-0.015055891126394272,
-0.00574... | 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_delete(self):
# delete
cache.set("key1", "spam")
cache.set("key2", "eggs")
self.assertEqual(cache.get("key1"), "spam")
cache.delete("key1")
self.assertEqual(cache.get("key1"), None)
self.assertEqual(cache.get("key2"), "eggs") | |
1,134 | [
0.00024207581009250134,
-0.07455207407474518,
0.030869217589497566,
-0.01592385582625866,
-0.01826525665819645,
-0.0005700612673535943,
0.007950279861688614,
0.023845013231039047,
0.021258989349007607,
-0.03289610147476196,
0.02275003120303154,
-0.049577128142118454,
-0.014607546851038933,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_get_many(self):
# get_many
cache.set('a', 'a')
cache.set('b', 'b')
cache.set('c', 'c')
cache.set('d', 'd')
self.assertEqual(cache.get_many(['a', 'c', 'd']), {'a' : 'a', 'c' : 'c', 'd' : 'd'})
self.assertEqual(cache.get_many(['a', 'b', 'e']), {'a' : 'a', '... | |
1,135 | [
0.02318393439054489,
-0.016824984923005104,
0.036541566252708435,
-0.06484336405992508,
0.003921565134078264,
0.044499848037958145,
0.01408692728728056,
0.020228367298841476,
0.06381979584693909,
0.004954734351485968,
0.039868179708719254,
0.0017656638519838452,
-0.03892137482762337,
-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_expiration(self):
cache.set('expire1', 'very quickly', 1)
cache.set('expire2', 'very quickly', 1)
cache.set('expire3', 'very quickly', 1)
time.sleep(2)
self.assertEqual(cache.get("expire1"), None)
cache.add("expire2", "newvalue")
self.as... | |
1,136 | [
0.015444720163941383,
-0.025061244145035744,
0.008905483409762383,
-0.05879484489560127,
0.03065631166100502,
0.0006436514086090028,
-0.0103858457878232,
0.005769914481788874,
0.0012720038648694754,
0.008031254634261131,
0.019314642995595932,
-0.01615576073527336,
0.023161251097917557,
-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_data_types(self):
stuff = {
'string' : 'this is a string',
'int' : 42,
'list' : [1, 2, 3, 4],
'tuple' : (1, 2, 3, 4),
'dict' : {'A': 1, 'B' : 2},
'function' : f,
'class' : C,
}
... | |
1,137 | [
0.02694450318813324,
-0.03611263260245323,
-0.0024378360249102116,
-0.03375644609332085,
0.004528659395873547,
-0.0064620147459208965,
0.04159484803676605,
0.029650617390871048,
0.04021846130490303,
-0.008713222108781338,
0.0159800723195076,
-0.005902129225432873,
-0.01629500836133957,
-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_unicode(self):
stuff = {
u'ascii': u'ascii_value',
u'unicode_ascii': u'Iñtërnâtiônàlizætiøn1',
u'Iñtërnâtiônàlizætiøn': u'Iñtërnâtiônàlizætiøn2',
u'ascii': {u'x' : 1 }
}
for (key, value) in stuff.items():
cache.set(key, val... | |
1,138 | [
0.016631338745355606,
-0.012519599869847298,
0.03867124393582344,
-0.034639403223991394,
-0.01831536926329136,
-0.00031153031159192324,
0.007049573585391045,
-0.02660030871629715,
0.04348978400230408,
0.036778245121240616,
0.04393230378627777,
0.005927911028265953,
-0.04395688697695732,
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_patch_vary_headers(self):
headers = (
# Initial vary, new headers, resulting vary.
(None, ('Accept-Encoding',), 'Accept-Encoding'),
('Accept-Encoding', ('accept-encoding',), 'Accept-Encoding'),
('Accept-Encoding', ('ACCEPT-ENCODING',), 'Accept-Encoding')... | |
1,139 | [
0.0010148817673325539,
-0.01906629651784897,
0.06768474727869034,
-0.01140262745320797,
-0.007579781115055084,
0.010533798485994339,
0.01246319804340601,
0.0008306301897391677,
0.015339320525527,
-0.03774910792708397,
0.025501620024442673,
-0.042470742017030716,
0.013266115449368954,
-0.03... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "instance", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "names", "annotation": null, "type_comment": null}}], "kwarg":... | def fake_db_secgroups(instance, names):
secgroups = []
for i, name in enumerate(names):
group_name = 'secgroup-%i' % i
if isinstance(name, dict) and name.get('name'):
group_name = name.get('name')
secgroups.append(
{'id': i,
'instance_uuid': instance[... | |
1,140 | [
0.00797981582581997,
0.004188964609056711,
0.03309018537402153,
-0.015350754372775555,
0.015292208641767502,
-0.00070877221878618,
0.044541776180267334,
-0.0032493015751242638,
-0.0034542125649750233,
-0.015327336266636848,
-0.005866306833922863,
-0.03262181580066681,
0.0008803851087577641,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "updates", "annotation": null, "type_comment": null}}, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def fake_db_instance(**updates):
db_instance = {
'id': 1,
'deleted': False,
'uuid': str(uuid.uuid4()),
'user_id': 'fake-user',
'project_id': 'fake-project',
'host': 'fake-host',
'created_at': datetime.datetime(1955, 11, 5),
'pci_devices': [],
'... | |
1,141 | [
-0.018077539280056953,
-0.006039150524884462,
-0.0006850459612905979,
0.012784454971551895,
0.020275825634598732,
-0.02581452764570713,
0.012244093231856823,
-0.021196896210312843,
0.00687118386849761,
-0.019244227558374405,
0.04661843553185463,
-0.041018325835466385,
-0.007221190724521875,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "instance_uuid", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "code", "annotation": null, "type_comment": null}}, {"_ty... | def fake_fault_obj(instance_uuid, code=404,
message='HTTPNotFound',
details='Stock details for test',
**updates):
fault = {
'id': 1,
'instance_uuid': instance_uuid,
'code': code,
'message': message,
'details': details,
... | |
1,142 | [
0.00011364605597918853,
0.04373626038432121,
0.042437877506017685,
-0.013765260577201843,
-0.027001550421118736,
-0.02175993286073208,
-0.015532503835856915,
0.011018219403922558,
0.005836711265146732,
0.040778834372758865,
0.02036537230014801,
-0.0006041086162440479,
-0.02825184538960457,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "canvas", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def draw(canvas):
canvas.clear()
fill(0.8, 0.0, 0.8, 1)
for pt in myPoints:
ellipse(pt.x, pt.y, 3, 3)
# Each frame, adjust the position of the point a little bit.
# Since we are not clearing the background,
# it will appear as if something is growing from the text.
... | |
1,143 | [
0.010336794890463352,
-0.029846474528312683,
0.01460866630077362,
-0.03890611231327057,
0.002165819751098752,
0.020006699487566948,
-0.044115401804447174,
-0.0128659438341856,
0.0028704581782221794,
0.01045004092156887,
0.03963591530919075,
0.032740525901317596,
-0.027480902150273323,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "test_method", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyar... | def decorator(test_method):
@functools.wraps(test_method)
def wrapper(instance, *args, **kwargs):
if fips.is_fips_enabled(getattr(instance, host)):
pytest.skip(reason)
else:
test_method(instance, *args, **kwargs)
return wrapper | |
1,144 | [
0.01236961130052805,
-0.014343609102070332,
0.00939109269529581,
-0.030345844104886055,
-0.012848510406911373,
0.03095322847366333,
-0.05078665539622307,
-0.022473212331533432,
0.0004496978654060513,
0.008228886872529984,
0.002772649982944131,
0.02188918925821781,
0.0012629501288756728,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "reason", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "host", "annotation": null, "type_comment": null}}], "kwarg": nu... | def skip_if_fips(reason='Not supported in FIPS mode', host='master'):
if callable(reason):
raise TypeError('Invalid decorator usage, add "()"')
def decorator(test_method):
@functools.wraps(test_method)
def wrapper(instance, *args, **kwargs):
if fips.is_fips_enabled(getattr(i... | |
1,145 | [
-0.0036372309550642967,
0.03456142172217369,
0.013943233527243137,
-0.006270128767937422,
-0.015068086795508862,
-0.004174935631453991,
-0.03090255707502365,
0.019802358001470566,
-0.035451412200927734,
0.027268417179584503,
-0.016254745423793793,
-0.03995082527399063,
0.036415573209524155,
... | 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 SearchDialog(SearchDialogBase):
def create_widgets(self):
f = SearchDialogBase.create_widgets(self)
self.make_button("Find", self.default_command, 1)
def default_command(self, event=None):
if not self.engine.getprog():
return
if self.find_again(self.t... | |
1,146 | [
0.008868939243257046,
0.06562881916761398,
0.016513658687472343,
-0.03337329253554344,
-0.010352639481425285,
0.029407884925603867,
0.005219566635787487,
-0.008316709659993649,
-0.011789767071604729,
0.01767134480178356,
0.02070527896285057,
-0.020878266543149948,
0.028023984283208847,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": null... | def find_again(self, text):
if not self.engine.getpat():
self.open(text)
return False
if not self.engine.getprog():
return False
res = self.engine.search_text(text)
if res:
line, m = res
i, j = m.span()
fir... | |
1,147 | [
0.03478604555130005,
0.040288615971803665,
0.06025586277246475,
0.007320869248360395,
0.011039189994335175,
0.001997065031901002,
0.002720639342442155,
0.012237769551575184,
-0.004116712138056755,
0.01729768142104149,
0.013919866643846035,
-0.0012053896207362413,
0.025987382978200912,
0.04... | 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": "rowid", "annotation": null, "type_comment": null}}], "kwarg": nul... | def unincorporate(self, rowid):
# Unincorporate from dims.
for dim in self.dims.itervalues():
dim.unincorporate(rowid)
# Account.
k = self.Zr(rowid)
self.crp.unincorporate(rowid)
if k not in self.Nk():
for dim in self.dims.itervalues():
... | |
1,148 | [
0.05357133969664574,
0.016012370586395264,
-0.00289163482375443,
-0.017438972368836403,
-0.03170498460531235,
0.006345916539430618,
0.011037712916731834,
0.029909435659646988,
0.0036956353578716516,
-0.015508140437304974,
-0.006333617959171534,
-0.012691833078861237,
-0.029294520616531372,
... | 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 _clear_dead_receivers(self):
# Note: caller is assumed to hold self.lock.
if self._dead_receivers:
self._dead_receivers = False
new_receivers = []
for r in self.receivers:
if isinstance(r[1], weakref.ReferenceType) and r[1]() is None:
... | |
1,149 | [
0.01912733167409897,
0.002517577027902007,
0.013285301625728607,
-0.019440073519945145,
-0.029973240569233894,
-0.017876360565423965,
0.013735650107264519,
0.025845039635896683,
-0.011846685782074928,
0.002526959404349327,
0.013497966341674328,
0.04010609909892082,
0.015424460172653198,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "rowid", "annotation": null, "type_comment": null}}, {"_type": "ar... | def simulate(self, rowid, targets, constraints=None, inputs=None, N=None):
# Refer to comment in logpdf.
constraints = self._populate_constraints(rowid, targets, constraints)
if not self.hypothetical(rowid):
rowid = None
network = self.build_network()
# Condition on t... | |
1,150 | [
0.01951819285750389,
0.024722186848521233,
0.042582809925079346,
-0.0380084365606308,
-0.03166084736585617,
-0.013376194052398205,
0.048210836946964264,
0.040090035647153854,
-0.0049341581761837006,
0.016344398260116577,
-0.007741745561361313,
0.02865409478545189,
0.011288171634078026,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "rowid", "annotation": null, "type_comment": null}}, {"_type": "ar... | def logpdf(self, rowid, targets, constraints=None, inputs=None):
# As discussed in https://github.com/probcomp/cgpm/issues/116 for an
# observed rowid, we synthetize a new hypothetical row which is
# identical (in terms of observed and latent values) to the observed
# rowid. In this vers... | |
1,151 | [
0.0014593740925192833,
0.015566657297313213,
0.05620039626955986,
0.007770795375108719,
-0.0028122132644057274,
-0.02867674082517624,
0.03750035539269447,
-0.016807477921247482,
-0.010528174228966236,
0.004612342920154333,
0.005417623091489077,
0.05284140631556511,
0.010929247364401817,
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": "rowid", "annotation": null, "type_comment": null}}], "kwarg": nul... | def _gibbs_transition_row(self, rowid):
# Probability of row crp assignment to each cluster.
K = self.crp.clusters[0].gibbs_tables(rowid)
logp_crp = self.crp.clusters[0].gibbs_logps(rowid)
# Probability of row data in each cluster.
logp_data = self._logpdf_row_gibbs(rowid, K)
... | |
1,152 | [
0.019031016156077385,
0.023598460480570793,
0.027134545147418976,
-0.03609754145145416,
-0.014365348033607006,
-0.008435037918388844,
0.05318862199783325,
0.0037417432758957148,
0.0002710768603719771,
0.004444662947207689,
-0.02498588338494301,
0.02924637496471405,
0.002609090879559517,
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": "rowid", "annotation": null, "type_comment": null}}, {"_type": "ar... | def _logpdf_cell_gibbs(self, rowid, dim, k):
targets = {dim.index: self.X[dim.index][rowid]}
inputs = self._get_input_values(rowid, dim, k)
# If rowid in cluster k then unincorporate then compute predictive.
if self.Zr(rowid) == k:
dim.unincorporate(rowid)
logp = ... | |
1,153 | [
0.027747448533773422,
0.02663320302963257,
0.00868296716362238,
0.007079539820551872,
0.011006578803062439,
0.005177168641239405,
0.05777774378657341,
-0.0014063961571082473,
-0.009043059311807156,
0.009280855767428875,
0.013248659670352936,
-0.028372513130307198,
0.04215111956000328,
0.02... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dim", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _bulk_incorporate(self, dim):
# XXX Major hack! We should really be creating new Dim objects.
dim.clusters = {} # Mapping of cluster k to the object.
dim.Zr = {} # Mapping of non-nan rowids to cluster k.
dim.Zi = {} # Mapping of nan rowids to cluster k.
dim.... | |
1,154 | [
0.03913914039731026,
0.05099630728363991,
0.07213983684778214,
-0.006833610124886036,
-0.04380855709314346,
-0.009830692782998085,
0.024868570268154144,
-0.011063627898693085,
0.006715563125908375,
-0.013037636876106262,
0.01463782973587513,
-0.005095696076750755,
0.016028160229325294,
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": "rowid", "annotation": null, "type_comment": null}}, {"_type": "ar... | def _validate_cgpm_query(self, rowid, targets, constraints):
# Is the query simulate or logpdf?
simulate = isinstance(targets, (list, tuple))
# Disallow duplicated target cols.
if simulate and len(set(targets)) != len(targets):
raise ValueError('Columns in targets must be uni... | |
1,155 | [
0.005925423000007868,
0.014153970405459404,
0.03404402360320091,
0.0013098630588501692,
0.005863344296813011,
0.010559606365859509,
0.022832589223980904,
-0.03786807879805565,
-0.025824787095189095,
0.0557716079056263,
0.04099684953689575,
0.019256848841905594,
0.015060320496559143,
0.0420... | 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 _check_partitions(self):
if not cu.check_env_debug():
return
# For debugging only.
assert self.alpha() > 0.
# Check that the number of dims actually assigned to the view
# matches the count in Nv.
Zr = self.Zr()
Nk = self.Nk()
rowids = rang... | |
1,156 | [
0.06050475686788559,
0.028349246829748154,
0.03351489081978798,
-0.03536858782172203,
-0.013284847140312195,
0.0017084932187572122,
0.01887066289782524,
0.003932932857424021,
-0.04856692999601364,
-0.025729350745677948,
-0.009002801030874252,
-0.013321921229362488,
0.012042868882417679,
-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 to_metadata(self):
metadata = dict()
# Dataset.
metadata['X'] = self.X
metadata['outputs'] = self.outputs
# View partition data.
rowids = sorted(self.Zr().keys())
metadata['Zr'] = [self.Zr(i) for i in rowids]
metadata['alpha'] = self.alpha()
... | |
1,157 | [
0.014959711581468582,
0.07161436229944229,
0.06897088140249252,
-0.03405286744236946,
0.007876378484070301,
0.006218193098902702,
0.03018377162516117,
0.0025909137912094593,
-0.03109697438776493,
-0.008308948017656803,
-0.0003623524389695376,
0.001415615202859044,
-0.0026840365026146173,
-... | 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": "metadata", "annotation": null, "type_comment": null}}, {"_type": "... | def from_metadata(cls, metadata, rng=None):
if rng is None:
rng = gu.gen_rng(0)
return cls(
metadata.get('X'),
outputs=metadata.get('outputs', None),
inputs=metadata.get('inputs', None),
alpha=metadata.get('alpha', None),
cctypes=me... | |
1,158 | [
0.04927938058972359,
0.041028786450624466,
0.019752109423279762,
-0.003856257302686572,
0.006154317874461412,
0.01028522104024887,
-0.05667801573872566,
-0.04721673205494881,
-0.022924553602933884,
0.006625139620155096,
0.0066699800081551075,
-0.05439116433262825,
0.004167336504906416,
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}}, {"_type": "arg", "_fields": {"arg": "req", "annotation": nu... | class DAVPropFindRequest(DAVRequest):
def __init__(self, req):
super(DAVPropFindRequest, self).__init__(req)
if req.body:
try:
self.xml = etree.XML(req.body)
except etree.XMLSyntaxError:
raise DAVBadRequestError('Invalid or not well-formed XML supplied in a request.')
if self.xml.tag != dprops.PRO... | |
1,159 | [
0.06175912916660309,
0.03500843048095703,
0.011734669096767902,
0.009599611163139343,
0.0128646744415164,
0.005617429502308369,
-0.04415712505578995,
-0.04252731055021286,
-0.017167385667562485,
0.016580652445554733,
0.012766885571181774,
-0.048285990953445435,
-0.0016189496964216232,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "req", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __init__(self, req):
super(DAVPropFindRequest, self).__init__(req)
if req.body:
try:
self.xml = etree.XML(req.body)
except etree.XMLSyntaxError:
raise DAVBadRequestError('Invalid or not well-formed XML supplied in a request.')
if self.xml.tag != dprops.PROPFIND:
self.xml = self.xml.find('./... | |
1,160 | [
0.05229552835226059,
0.028045406565070152,
-0.009129651822149754,
-0.004404849838465452,
-0.001770766219124198,
0.015710724517703056,
-0.00157355482224375,
-0.026699405163526535,
-0.0010515648173168302,
-0.010133637115359306,
0.029082491993904114,
-0.02749376744031906,
-0.015192181803286076,... | 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}}, {"_type": "arg", "_fields": {"arg": "req", "annotation": nu... | class DAVPropPatchRequest(DAVRequest):
def __init__(self, req):
super(DAVPropPatchRequest, self).__init__(req)
if not req.body:
raise DAVUnsupportedMediaTypeError('PROPPATCH method must be supplied with an XML request body.')
try:
self.xml = etree.XML(req.body)
except etree.XMLSyntaxError:
raise DAVBa... | |
1,161 | [
0.059600479900836945,
0.01451142132282257,
-0.004645490553230047,
0.01889508031308651,
0.020309511572122574,
0.011131901293992996,
0.00691559910774231,
-0.02694978192448616,
0.009258588775992393,
0.0048425388522446156,
0.015774691477417946,
-0.02943313494324684,
-0.01889508031308651,
-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": "req", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __init__(self, req):
super(DAVPropPatchRequest, self).__init__(req)
if not req.body:
raise DAVUnsupportedMediaTypeError('PROPPATCH method must be supplied with an XML request body.')
try:
self.xml = etree.XML(req.body)
except etree.XMLSyntaxError:
raise DAVBadRequestError('Invalid or not well-forme... | |
1,162 | [
0.03650525584816933,
0.03543785214424133,
-0.005322200711816549,
-0.013425584882497787,
0.0016930231358855963,
0.010436850599944592,
-0.024384276941418648,
-0.018513549119234085,
0.014979252591729164,
-0.0034838917199522257,
0.03973119333386421,
-0.0593477264046669,
0.005458591505885124,
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 get_props(self):
req = self.req
ret = {}
for el in self.xml:
props = None
if el.tag == dprops.SET:
props = req.dav.parse_props(req, el)
elif el.tag == dprops.REMOVE:
props = dict.fromkeys(req.dav.parse_propnames(req, el), None)
if props:
ret.update(props)
return ret | |
1,163 | [
0.054435208439826965,
0.06371495127677917,
0.03516532480716705,
-0.02208932861685753,
-0.009029984474182129,
-0.004828571807593107,
0.00021385161380749196,
-0.04568827897310257,
-0.022633235901594162,
-0.00896893348544836,
0.03998279571533203,
-0.032567884773015976,
-0.0119326775893569,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "req", "annotation": nu... | class DAVMkColRequest(DAVRequest):
def __init__(self, req):
super(DAVMkColRequest, self).__init__(req)
self.new_name = req.view_name
if len(req.subpath) > 0:
raise DAVConflictError('Parent node does not exist.')
# TODO: check if parent is a collection, if needed
if req.body:
if req.content_type not in ... | |
1,164 | [
0.06823371350765228,
0.04719926044344902,
0.0251387357711792,
-0.000154311434016563,
0.002773597836494446,
-0.00027872921782545745,
0.0027201566845178604,
-0.048353590071201324,
-0.009704920463263988,
0.010554634965956211,
0.02188951149582863,
-0.039952635765075684,
-0.0052773174829781055,
... | 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": "req", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __init__(self, req):
super(DAVMkColRequest, self).__init__(req)
self.new_name = req.view_name
if len(req.subpath) > 0:
raise DAVConflictError('Parent node does not exist.')
# TODO: check if parent is a collection, if needed
if req.body:
if req.content_type not in {'application/xml', 'text/xml'}:
... | |
1,165 | [
0.04034995660185814,
0.049058251082897186,
0.04365546256303787,
-0.005448383744806051,
0.01416807807981968,
-0.006394442170858383,
0.008144079707562923,
-0.011751639656722546,
-0.017131634056568146,
-0.03435445576906204,
0.0400536023080349,
-0.03973444923758507,
0.02151997573673725,
0.0175... | 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 process(self):
props = self.get_props()
try:
rtype = props.pop(dprops.RESOURCE_TYPE)
except KeyError:
raise DAVBadRequestError('MKCOL method body must contain resource type property.')
req = self.req
ret = req.dav.make_collection(req, self.ctx, self.new_name, rtype, props)
if ret is None:
retur... | |
1,166 | [
0.03919726610183716,
0.046188972890377045,
0.01045478880405426,
-0.0034658117219805717,
0.007860209792852402,
0.00010258829570375383,
-0.012486753985285759,
-0.0436326302587986,
0.011437998153269291,
-0.02070201188325882,
0.02495165914297104,
-0.05256890505552292,
0.01758851669728756,
0.02... | 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_props(self):
if self.xml is None:
return {
dprops.RESOURCE_TYPE: DAVResourceTypeValue(dprops.COLLECTION)
}
ret = {}
for el in self.xml:
if el.tag != dprops.SET:
continue
ret.update(self.req.dav.parse_props(self.req, el))
return ret | |
1,167 | [
0.03697192296385765,
0.036405663937330246,
-0.011101013980805874,
-0.0013205311261117458,
0.04140760749578476,
-0.00008428431465290487,
0.009797440841794014,
0.013236277736723423,
-0.033833909779787064,
-0.0667712390422821,
0.056437037885189056,
0.01075300108641386,
0.019264565780758858,
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": "cls", "annotation": null, "type_comment": null}}], "kwarg": null,... | def get_lock(self, cls):
lock = cls(user_id = self.req.user.id)
el = self.xml.find(dprops.OWNER)
if el:
lock.owner = self._content(el)
lock.token = str(uuid.uuid4())
if len(self.xml.xpath('d:lockscope/d:exclusive', namespaces=dprops.NS_MAP)) > 0:
lock.scope = cls.SCOPE_EXCLUSIVE
else:
lock.scope = ... | |
1,168 | [
0.04366964101791382,
0.04440906643867493,
-0.016756702214479446,
-0.009938757866621017,
0.012483254075050354,
-0.016158636659383774,
-0.008209805004298687,
0.014538423158228397,
-0.011085955426096916,
-0.012983453460037708,
0.01793108507990837,
-0.028098193928599358,
-0.014310071244835854,
... | 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": "req", "annotation": nu... | class DAVLockRequest(DAVRequest):
def __init__(self, req):
super(DAVLockRequest, self).__init__(req)
try:
self.xml = etree.XML(req.body)
except etree.XMLSyntaxError:
raise DAVBadRequestError('Invalid or not well-formed XML supplied in a request.')
def _content(self, node):
return (node.text or '') + ''... | |
1,169 | [
0.07323992997407913,
0.024067634716629982,
0.011482897214591503,
-0.011472094804048538,
0.006810881197452545,
-0.007032329682260752,
-0.012573935091495514,
-0.0010174462804570794,
0.008247594349086285,
-0.01605229079723358,
-0.01101299561560154,
-0.048956248909235,
-0.0248021949082613,
-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}}, {"_type": "arg", "_fields": {"arg": "req", "annotation": nu... | class DAVReportRequest(DAVRequest):
def __init__(self, req):
super(DAVReportRequest, self).__init__(req)
try:
self.xml = etree.XML(req.body)
except etree.XMLSyntaxError:
raise DAVBadRequestError('Invalid or not well-formed XML supplied in a request.')
def get_name(self):
try:
return self.xml[0].tag
... | |
1,170 | [
-0.02271527610719204,
0.0031974492594599724,
0.016388872638344765,
-0.03150748461484909,
-0.04764728620648384,
0.007397409062832594,
-0.02333795465528965,
0.007503264583647251,
0.014396305195987225,
0.0356171540915966,
0.014608015306293964,
-0.0217438992112875,
0.010218138806521893,
-0.013... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def parameterized_helper(f):
attached_instance_method = [False]
parent_classes = _terrible_magic_get_defining_classes()
if any(issubclass(cls, TestCase) for cls in parent_classes):
raise Exception("Warning: '@parameterized' tests won't work "
"inside subc... | |
1,171 | [
-0.02800985984504223,
0.01798888109624386,
0.007607389707118273,
-0.04404342547059059,
-0.06335214525461197,
-0.01399270910769701,
-0.005728456191718578,
0.016656823456287384,
0.005554310977458954,
0.016583498567342758,
0.019626455381512642,
-0.02181396074593067,
-0.013296129181981087,
-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": [{"_type": "Constant", "_fields": {"kind": null, "value": ... | def parameterized_helper_method(self=None):
if self is not None and not attached_instance_method[0]:
# confusingly, we need to create a named instance method and
# attach that to the class...
cls = self.__class__
im_f = new_instancemethod(f, No... | |
1,172 | [
-0.02132607437670231,
0.02193438820540905,
0.008066006004810333,
-0.04288611561059952,
-0.07168743014335632,
0.0004478271002881229,
-0.02592352218925953,
0.0022680156398564577,
0.04700393229722977,
0.03603088855743408,
0.01702108606696129,
0.015465205535292625,
-0.008668470196425915,
-0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def parameterized_expand_wrapper(f):
stack = inspect.stack()
frame = stack[1]
frame_locals = frame[0].f_locals
base_name = f.__name__
for num, args in enumerate(input):
name_suffix = "_%s" %(num, )
if len(args) > 0 and isinstance(args[0], six.string_types... | |
1,173 | [
0.014782696962356567,
-0.022829730063676834,
-0.01949170045554638,
-0.002417090116068721,
0.007486720569431782,
-0.019444014877080917,
0.012624899856746197,
-0.0015117990551516414,
0.031305938959121704,
-0.01758425682783127,
0.013697837479412556,
-0.0886961817741394,
-0.060942862182855606,
... | 18 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "mobilezone.ch"}}, "targets": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": nu... | class MobileZoneSpider(BaseSpider):
name = 'mobilezone.ch'
allowed_domains = ['mobilezone.ch', 'www.mobilezone.ch']
start_urls = (u'http://www.mobilezone.ch/mobiltelefone/10742-samsung-gt-i9300-galaxy-s-iii-16gb-pebble-blue?tab=top10', )
def parse(self, response):
if not isinstance(response, Ht... | |
1,174 | [
0.017565669491887093,
0.017439955845475197,
0.0057199858129024506,
-0.028525643050670624,
0.03874276205897331,
-0.010805686935782433,
0.010514259338378906,
0.003397134365513921,
0.047359880059957504,
0.04781702160835266,
0.0033714200835675,
-0.06582840532064438,
0.06157698854804039,
0.0359... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "exc_type", "annotation": null, "type_comment": null}}, {"_type": ... | def assert_raises(func, exc_type, str_contains=None, repr_contains=None):
try:
func()
except exc_type as e:
if str_contains is not None and str_contains not in str(e):
raise AssertionError("%s raised, but %r does not contain %r"
%(exc_type, str(e), st... | |
1,175 | [
-0.021576443687081337,
-0.015536331571638584,
-0.027045920491218567,
-0.008387249894440174,
0.03522860258817673,
-0.02962992712855339,
-0.012295558117330074,
0.0172374676913023,
0.05387650802731514,
-0.035594671964645386,
-0.001170877367258072,
-0.1144714280962944,
-0.04188241809606552,
-0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def parse(self, response):
if not isinstance(response, HtmlResponse):
return
hxs = HtmlXPathSelector(response)
product_name = hxs.select(u'//div[@id="data"]/h1/text()')[0].extract().strip()
url = u'http://www.mobilezone.ch/mobiltelefone/extras/?extras_tab=offers_new'
... | |
1,176 | [
-0.05662261322140694,
-0.002163826720789075,
0.007554047275334597,
-0.028120817616581917,
0.026263559237122536,
-0.03900245577096939,
-0.004038944840431213,
0.013000818900763988,
0.0740046575665474,
-0.016631999984383583,
0.016858205199241638,
-0.09681562334299088,
-0.03716900572180748,
-0... | 17 | {"_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": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def parse_product(self, response):
if not isinstance(response, HtmlResponse):
return
hxs = HtmlXPathSelector(response)
providers = hxs.select(u'//div[@class="provider"]')
for provider in providers[0:-1]:
provider_name = provider.select(u'./preceding-sibling::h3[1... | |
1,177 | [
-0.008272348903119564,
0.030261240899562836,
0.072760671377182,
0.004136174451559782,
-0.026893168687820435,
-0.004139387980103493,
0.0020070248283445835,
-0.04681879281997681,
0.00040413669194094837,
0.07116662710905075,
0.0372287817299366,
0.002554979408159852,
-0.0026754974387586117,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "level", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "box", "annotation": null, "type_comment": null}}, {"_type": "arg... | def perform(level, box, options):
biome = dict([(trn._(a), b) for a, b in biomes.items()])[options["Biome"]]
minx = int(box.minx / 16) * 16
minz = int(box.minz / 16) * 16
for x in xrange(minx, box.maxx, 16):
for z in xrange(minz, box.maxz, 16):
chunk = level.getChunk(x / 16, z / 16... | |
1,178 | [
0.018199367448687553,
-0.01599297858774662,
0.028642943128943443,
-0.037602219730615616,
-0.0014283026102930307,
-0.00897933542728424,
-0.008825556375086308,
0.01130607258528471,
0.021662728860974312,
0.019643548876047134,
0.016460999846458435,
0.003958128392696381,
0.0007362987962551415,
... | 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_parameter_writes(self):
for param in ptests:
msg = can.Message(is_extended_id = False, arbitration_id = param[1])
msg.data = string2data(param[2])
self.bus.send(msg)
time.sleep(0.03)
x = database.read(param[0])
if '.' in param[0]:
... | |
1,179 | [
0.07036209851503372,
-0.023158932104706764,
0.0199000034481287,
0.009173760190606117,
0.008262799121439457,
0.06769336760044098,
-0.014703677035868168,
-0.0017882416723296046,
-0.012670053169131279,
0.016987495124340057,
0.05619730055332184,
-0.04221212863922119,
0.0022982514929026365,
0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fie... | def test_deduce_alpha_implications():
def D(i):
I = deduce_alpha_implications(i)
P = rules_2prereq(I)
return I,P
# transitivity
I,P = D([('a','b'), ('b','c')])
assert I == {'a': ['b','c'], 'b': ['c']}
assert P == {'b': ['a'], 'c': ['a', 'b']} # XXX a,b order unstable
... | |
1,180 | [
0.011926786974072456,
0.002750310581177473,
-0.015130171552300453,
-0.03609072417020798,
0.03841844201087952,
0.030393356457352638,
0.019042955711483955,
0.0170145146548748,
0.05746139958500862,
0.03316444903612137,
0.00976533442735672,
-0.03950471058487892,
-0.0016391018871217966,
0.01411... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "With", "_fields": {"body": [{"_type": "Assign", "_fields": {"v... | def test_add():
with evaluate(False):
expr = x + x
assert isinstance(expr, Add)
assert expr.args == (x, x)
with evaluate(True):
assert (x + x).args == (2, x)
assert (x + x).args == (x, x)
assert isinstance(x + x, Mul) | |
1,181 | [
0.009659329429268837,
0.005857810378074646,
0.02610311098396778,
0.00024148324155248702,
-0.031328972429037094,
-0.0062474580481648445,
0.008081093430519104,
-0.009606939740478992,
-0.013058103621006012,
0.05658075213432312,
0.007314895745366812,
-0.0688399150967598,
0.020680788904428482,
... | 8 | {"_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": "Name", "_fields": {"i... | def test_apply_beta_to_alpha_route():
APPLY = apply_beta_to_alpha_route
# indicates empty alpha-chain with attached beta-rule #bidx
def Q(bidx):
return ([],[bidx])
# x -> a &(a,b) -> x -- x -> a
A = {'x': ['a']}; B = [ (And('a','b'), 'x') ]
assert APPLY(A, B) == {'x':... | |
1,182 | [
0.021777240559458733,
0.012174171395599842,
0.038875073194503784,
-0.0283078420907259,
-0.02910488285124302,
0.03913218528032303,
-0.03656108304858208,
-0.0268937349319458,
-0.03368144482374191,
0.0268937349319458,
0.00044552391045726836,
-0.07440771162509918,
-0.0024200505577027798,
0.044... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_FactRules_parse():
f = FactRules('a -> b')
# assert f.negs == {}
assert f.rel_tt == {'a': ['b']}
assert f.rel_tf == {}
assert f.rel_ff == {'b': ['a']}
assert f.rel_ft == {}
assert f.prereq == {'b': ['a'], 'a': ['b']}
f = FactRules('a -> !b')
assert f... | |
1,183 | [
0.02780347689986229,
0.0070541598834097385,
0.033514853566884995,
-0.0117994649335742,
0.0043716346845030785,
0.046493049710989,
-0.030331065878272057,
0.0038278386928141117,
-0.037014592438936234,
0.028095120564103127,
0.016793882474303246,
-0.09060433506965637,
-0.012880980968475342,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_FactRules_deduce2():
# pos/neg/zero, but the rules are not sufficient to derive all relations
f = FactRules(['pos -> !neg', 'pos -> !z'])
D = f.deduce_all_facts
assert D({'pos':T}) == {'pos': T, 'neg': F, 'z': F}
assert D({'pos':F}) == {'pos': F }
assert D({'neg':T}) =... | |
1,184 | [
0.030955173075199127,
-0.00681188004091382,
0.039365824311971664,
-0.012180511839687824,
-0.0017947282176464796,
0.06400056928396225,
-0.04971739277243614,
0.0149177061393857,
-0.018799543380737305,
0.027098217979073524,
0.025605203583836555,
-0.06897728145122528,
-0.0056081367656588554,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_FactRules_deduce():
f = FactRules(['a -> b', 'b -> c', 'b -> d', 'c -> e'])
D = f.deduce_all_facts
assert D({'a': T}) == {'a': T, 'b': T, 'c': T, 'd': T, 'e': T}
assert D({'b': T}) == { 'b': T, 'c': T, 'd': T, 'e': T}
assert D({'c': T}) == { 'c': T, 'e': T}... | |
1,185 | [
0.024741655215620995,
0.00808689184486866,
0.043583277612924576,
-0.022137945517897606,
-0.001805281499400735,
0.07459692656993866,
-0.032475829124450684,
0.011851368471980095,
-0.01902119070291519,
0.0339893139898777,
0.017559008672833443,
-0.0647464394569397,
0.0009371110354550183,
-0.00... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_FactRules_deduce_multiple():
# deduction that involves _several_ starting points
# TODO add the same check for 'npos == real & !pos' ?
f = FactRules(['real == pos | npos'])
D = f.deduce_all_facts
assert D({'real': T}) == {'real': T}
assert D({'real': F}) == {'real': F, 'pos': F, '... | |
1,186 | [
0.03534805402159691,
0.004615615122020245,
0.03873831406235695,
-0.019750233739614487,
-0.0024145743809640408,
0.06570270657539368,
-0.04365287721157074,
-0.0012943432666361332,
-0.013035416603088379,
0.0401574932038784,
0.018028821796178818,
-0.07269347459077835,
-0.006442150101065636,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_FactRules_deduce_multiple2():
f = FactRules(['real == neg | zero | pos'])
D = f.deduce_all_facts
assert D({'real': T}) == {'real': T}
assert D({'real': F}) == {'real': F, 'neg': F, 'zero': F, 'pos': F}
assert D({'neg' : T}) == {'real': T, 'neg': T}
assert D({'zero': T}) == {'r... | |
1,187 | [
0.019197624176740646,
0.021310340613126755,
0.034560609608888626,
-0.002599678235128522,
-0.008664576336741447,
0.05593200773000717,
-0.04034920409321785,
0.021603433415293694,
-0.01416618563234806,
0.02389933168888092,
0.0066800895147025585,
-0.062233518809080124,
-0.009537750855088234,
-... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_FactRules_deduce_base():
# deduction that starts from base
f = FactRules(['real == neg | zero | pos',
'neg -> real & !zero & !pos',
'pos -> real & !zero & !neg'])
D = f.deduce_all_facts
base = D({'real': T, 'neg': F})
assert base == {'real': T, '... | |
1,188 | [
0.04212959110736847,
0.018907945603132248,
0.020367370918393135,
0.00325141754001379,
-0.026153407990932465,
0.028284426778554916,
-0.027122054249048233,
0.014542587101459503,
-0.0075102257542312145,
0.050137054175138474,
0.013561027124524117,
-0.07005239278078079,
-0.01669943518936634,
0.... | 7 | {"_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 X_test_FactRules_deduce_cow():
f = FactRules(['real == neg | zero | pos',
'neg -> real & !zero & !pos',
'pos -> real & !zero & !neg'])
D = f.deduce_all_facts
base0 = D({'real': T, 'neg': F})
assert base0 == {'real': T, 'neg': F}
base = base0.copy()
... | |
1,189 | [
0.038625508546829224,
-0.04259422793984413,
-0.022106025367975235,
-0.0025847237557172775,
0.03786715120077133,
-0.00665455823764205,
0.005949920509010553,
0.012538122944533825,
0.0754309669137001,
0.0317244827747345,
0.03394898772239685,
-0.02345842309296131,
-0.02826133370399475,
-0.0064... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "input_bytes", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyar... | def TestOneInput(input_bytes):
fdp = atheris.FuzzedDataProvider(input_bytes)
original = fdp.ConsumeUnicode(sys.maxsize)
try:
ujson_data = ujson.loads(original)
except ValueError:
return
# We make sure there's no error in encoding, but we don't actually compare
# (encoded == original) because it's ... | |
1,190 | [
-0.011125277727842331,
-0.03883780539035797,
0.03844812884926796,
-0.003708425909280777,
-0.008696290664374828,
-0.022549306973814964,
-0.008871645666658878,
0.003310630563646555,
-0.0573604516685009,
0.03592821583151817,
0.055282171815633774,
0.0030329858418554068,
-0.036136046051979065,
... | 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):
deg = [3, 2, 2, 1, 0]
self.G = havel_hakimi_graph(deg)
# Graph used as an example in Sec. 4.1 of Langville and Meyer,
# "Google's PageRank and Beyond". (Used for test_directed_laplacian)
self.DG = nx.DiGraph()
self.DG.add_edges_from(((1, 2), (1, 3), (3, 1... | |
1,191 | [
-0.02345464378595352,
-0.04295196756720543,
0.016824396327137947,
0.02543330378830433,
-0.007226159330457449,
-0.041216302663087845,
0.02372078038752079,
0.03408849611878395,
-0.017935223877429962,
-0.028164086863398552,
0.016535118222236633,
-0.028164086863398552,
0.031797416508197784,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def get_buckets(username):
user = get_user_or_404(username)
resources = []
for resource in user.buckets:
resources.append({
'name': resource.name,
'url': url_for_bucket(resource),
'urn': urn_for_bucket(resource),
})
return {
'owner': { 'use... | |
1,192 | [
-0.04366187006235123,
-0.031084604561328888,
-0.002563376445323229,
0.03125009313225746,
-0.02995375357568264,
-0.010674127377569675,
-0.017928121611475945,
0.03251885250210762,
-0.006102456711232662,
-0.016700735315680504,
0.03494604676961899,
-0.055742666125297546,
0.016935179010033607,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def buckets(username):
if request.method == 'GET':
return get_buckets(username)
elif request.method == 'POST':
return post_buckets(username)
# should never be reached
abort(500) | |
1,193 | [
-0.04593998193740845,
-0.032995566725730896,
-0.027487846091389656,
0.06309767812490463,
-0.013185536488890648,
-0.029594486579298973,
0.018299849703907967,
0.05243757367134094,
-0.01847751811146736,
-0.028883812949061394,
0.01915012113749981,
-0.02804623357951641,
0.02431519515812397,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def post_buckets(username):
user = get_user_or_404(username)
# Create a new bucket
m = model.Bucket(user)
if request.json is not None:
update_bucket(m, request.json)
m.save()
# Return it
response = make_response(json.dumps({ 'url': url_for_bucket(m), 'urn': urn_for_bucket(m) }), 20... | |
1,194 | [
-0.045535460114479065,
-0.013600192032754421,
0.002592431614175439,
-0.010732398368418217,
-0.026555635035037994,
-0.03320461884140968,
0.001749555580317974,
0.012471879832446575,
-0.04376239702105522,
-0.01708587072789669,
0.008321302942931652,
-0.018603719770908356,
0.034547846764326096,
... | 17 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bucket_id", "annotation": null, "type_comment": null}}], "kwa... | def get_bucket(username, bucket_id):
user, bucket = get_user_and_bucket_or_404(username, bucket_id)
sources = {}
for s in bucket.bucket.layers:
if s.type == foldbeam.bucket.Layer.VECTOR_TYPE:
type_ = 'vector'
elif s.type == foldbeam.bucket.Layer.RASTER_TYPE:
type_ = ... | |
1,195 | [
-0.010298836044967175,
-0.043122220784425735,
-0.00271174986846745,
0.032823387533426285,
-0.009030860848724842,
-0.0807960256934166,
0.023897727951407433,
0.035237520933151245,
-0.056433189660310745,
-0.015636511147022247,
0.008897972293198109,
-0.012314306572079659,
0.040110088884830475,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bucket_id", "annotation": null, "type_comment": null}}, {"_ty... | def bucket_git(username, bucket_id, path):
user, bucket = get_user_and_bucket_or_404(username, bucket_id)
# This is a dirty hack to allow us to serve git repos from the bucket
working_dir = os.path.abspath(os.path.join(bucket.bucket.repo.git_dir))
url_prefix = url_for('bucket_git', username=user.userna... | |
1,196 | [
-0.02484673447906971,
-0.05478311702609062,
-0.044233664870262146,
0.043076928704977036,
-0.011868133209645748,
-0.00780798215419054,
0.04212840273976326,
0.042567960917949677,
-0.017721228301525116,
-0.016032390296459198,
0.024245230481028557,
-0.026304224506020546,
0.013406594283878803,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bucket_id", "annotation": null, "type_comment": null}}], "kwa... | def put_bucket(username, bucket_id):
user, bucket = get_user_and_bucket_or_404(username, bucket_id)
update_bucket(bucket, request.json)
bucket.save()
# Return it
response = make_response(json.dumps({ 'url': url_for_bucket(bucket) }), 201)
response.headers['Location'] = url_for_bucket(bucket)
... | |
1,197 | [
-0.010567685589194298,
-0.0015389970503747463,
-0.005207388661801815,
0.03384377807378769,
-0.003247892716899514,
-0.03488582372665405,
0.03866889327764511,
0.017703421413898468,
-0.03416092321276665,
-0.01565331406891346,
0.012006159871816635,
-0.018530260771512985,
0.0143847381696105,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bucket_id", "annotation": null, "type_comment": null}}, {"_ty... | def get_bucket_file(username, bucket_id, filename):
user, bucket = get_user_and_bucket_or_404(username, bucket_id)
repo = bucket.bucket.repo
if len(repo.heads) == 0:
abort(404)
tree = repo.heads[0].commit.tree
blob = tree/filename
response = make_response(blob.data_stream.read(), 200)
... | |
1,198 | [
-0.01736004278063774,
-0.03445231914520264,
0.005500321742147207,
0.01692492514848709,
-0.012127485126256943,
-0.06421876698732376,
0.0317300520837307,
0.023072345182299614,
-0.0214434452354908,
-0.002407088177278638,
-0.006102791056036949,
-0.03425149619579315,
0.04536370933055878,
-0.005... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bucket_id", "annotation": null, "type_comment": null}}], "kwa... | def bucket_files(username, bucket_id):
user, bucket = get_user_and_bucket_or_404(username, bucket_id)
files = []
for f in bucket.bucket.files:
files.append({
'url': url_for_bucket_file(bucket, f),
'name': f,
})
return { 'resources': files } | |
1,199 | [
0.0599125511944294,
0.0019439493771642447,
0.02302018366754055,
-0.029082437977194786,
-0.0023723349440842867,
-0.000190618826309219,
0.04030580073595047,
0.001290277112275362,
-0.014923523180186749,
-0.001920055248774588,
0.02971050888299942,
-0.0211359690874815,
0.003908379003405571,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "m1", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "m2", "annotation": null, "type_comment": null}}, {"_type": "arg", "... | def invariant(m1, m2, m3, P=5.0e9, T=2000.0):
composition = m1.formula
assemblage = burnman.Composite([m1, m2, m3])
assemblage.set_state(P, T)
equality_constraints = [
("phase_fraction", (m1, 0.0)),
("phase_fraction", (m2, 0.0)),
]
sol, prm = equilibrate(
composition, ass... | |
1,200 | [
0.05540752783417702,
0.013014113530516624,
0.04099331051111221,
-0.030985983088612556,
0.008194071240723133,
-0.008865434676408768,
0.00860721804201603,
0.038858719170093536,
0.06169653683900833,
-0.045836303383111954,
0.0024272354785352945,
-0.03268447518348694,
-0.0005160744185559452,
-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_cat_encrypted_object(self):
if self.test_api == ApiSelector.XML:
return unittest.skip(
'gsutil does not support encryption with the XML API')
object_contents = '0123456789'
object_uri = self.CreateObject(object_name='foo', contents=object_contents,
... |