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
11,701
[ -0.017823487520217896, -0.014931844547390938, 0.05013011768460274, 0.007123162969946861, 0.009428998455405235, 0.016066066920757294, 0.010282780975103378, -0.022061239928007126, 0.013959654606878757, 0.05344553664326668, 0.04210331663489342, -0.007110699079930782, 0.01844668574631214, 0.00...
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 TestPolygonPlotting: def setup_method(self): t1 = Polygon([(0, 0), (1, 0), (1, 1)]) t2 = Polygon([(1, 0), (2, 0), (2, 1)]) self.polys = GeoSeries([t1, t2], index=list('AB')) self.df = GeoDataFrame({'geometry': self.polys, 'values': [0, 1]}) multipoly1 = MultiPolygon(...
11,702
[ -0.0305643230676651, -0.026161186397075653, 0.06520389020442963, 0.00009395820961799473, -0.006229969207197428, 0.007916276343166828, 0.045553721487522125, -0.0072195036336779594, 0.01269414834678173, 0.0597233884036541, 0.013150855898857117, -0.0122608607634902, 0.02976801060140133, -0.06...
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_method(self): t1 = Polygon([(0, 0), (1, 0), (1, 1)]) t2 = Polygon([(1, 0), (2, 0), (2, 1)]) self.polys = GeoSeries([t1, t2], index=list('AB')) self.df = GeoDataFrame({'geometry': self.polys, 'values': [0, 1]}) multipoly1 = MultiPolygon([t1, t2]) multipoly2 = r...
11,703
[ 0.028228571638464928, -0.0467362143099308, 0.07009169459342957, 0.017043190076947212, 0.001088081393390894, -0.004933056887239218, 0.00261960132047534, -0.027142858132719994, 0.027294352650642395, 0.05716412141919136, 0.04804917052388191, -0.020881064236164093, 0.014732890762388706, 0.0273...
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_single_color(self): ax = self.polys.plot(color='green') _check_colors(2, ax.collections[0].get_facecolors(), ['green']*2) # color only sets facecolor _check_colors(2, ax.collections[0].get_edgecolors(), ['k'] * 2) ax = self.df.plot(color='green') _check_colors(...
11,704
[ 0.016611287370324135, -0.020670996978878975, 0.04089505225419998, 0.018423879519104958, 0.04149097204208374, -0.0024054087698459625, 0.0014230709057301283, -0.006939992308616638, 0.015133900567889214, 0.07066625356674194, 0.04116818308830261, -0.003705881303176284, -0.004466300830245018, 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_vmin_vmax(self): # when vmin == vmax, all polygons should be the same color # non-categorical ax = self.df.plot(column='values', categorical=False, vmin=0, vmax=0) actual_colors = ax.collections[0].get_facecolors() np.testing.assert_array_equal(actual_colors[0], actual_...
11,705
[ 0.025443540886044502, -0.03527570515871048, 0.06349626928567886, 0.010182419791817665, 0.002966223983094096, 0.0007814288255758584, 0.03379962965846062, -0.008174707181751728, 0.016624614596366882, 0.042355865240097046, 0.028770966455340385, -0.014885847456753254, 0.008612525649368763, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_style_kwargs(self): # facecolor overrides default cmap when color is not set ax = self.polys.plot(facecolor='k') _check_colors(2, ax.collections[0].get_facecolors(), ['k']*2) # facecolor overrides more general-purpose color when both are set ax = self.polys.plot(color=...
11,706
[ 0.00030431896448135376, -0.025280483067035675, 0.0684831514954567, 0.03319732844829559, 0.012810234911739826, 0.013915193267166615, 0.011765988543629646, -0.009094659239053726, 0.005855673924088478, 0.07615715265274048, 0.03475155681371689, -0.045898281037807465, 0.028316082432866096, -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_multipolygons(self): # MultiPolygons ax = self.df2.plot() assert len(ax.collections[0].get_paths()) == 4 _check_colors(4, ax.collections[0].get_facecolors(), [MPL_DFT_COLOR]*4) ax = self.df2.plot('values') cmap = plt.get_cmap(lut=2) # colors are repeate...
11,707
[ -0.031085986644029617, -0.02750909887254238, 0.06372509896755219, -0.0021679005585610867, -0.004844684153795242, 0.008606888353824615, 0.04687606915831566, -0.0100364675745368, 0.013401567004621029, 0.0580773763358593, 0.012966222129762173, -0.013048584572970867, 0.027862081304192543, -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 setup_method(self): t1 = Polygon([(0, 0, 0), (1, 0, 0), (1, 1, 1)]) t2 = Polygon([(1, 0, 0), (2, 0, 0), (2, 1, 1)]) self.polys = GeoSeries([t1, t2], index=list('AB')) self.df = GeoDataFrame({'geometry': self.polys, 'values': [0, 1]}) multipoly1 = MultiPolygon([t1, t2]) ...
11,708
[ -0.014896482229232788, 0.0002738002222031355, 0.03418252617120743, 0.008405539207160473, -0.004970358684659004, 0.006578501313924789, 0.021924447268247604, -0.004567593336105347, -0.019858084619045258, 0.009041791781783104, 0.028321996331214905, 0.005160066764801741, 0.0011885956628248096, ...
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 TestPolygonZPlotting: def setup_method(self): t1 = Polygon([(0, 0, 0), (1, 0, 0), (1, 1, 1)]) t2 = Polygon([(1, 0, 0), (2, 0, 0), (2, 1, 1)]) self.polys = GeoSeries([t1, t2], index=list('AB')) self.df = GeoDataFrame({'geometry': self.polys, 'values': [0, 1]}) multipo...
11,709
[ -0.023148102685809135, 0.0007622612174600363, 0.06470134854316711, -0.00665862113237381, -0.0013143231626600027, 0.01617533713579178, 0.012578080408275127, -0.010298996232450008, 0.0023683994077146053, 0.004733718931674957, 0.0006975845317356288, -0.0022436657454818487, 0.02327129617333412, ...
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_method(self): pytest.importorskip('matplotlib', '1.5.0') poly = Polygon([(1, 0), (2, 0), (2, 1)]) line = LineString([(0.5, 0.5), (1, 1), (1, 0.5), (1.5, 1)]) point = Point(0.75, 0.25) self.series = GeoSeries([poly, line, point]) self.df = GeoDataFrame({'geometr...
11,710
[ -0.013908816501498222, -0.012920623645186424, 0.0505707785487175, -0.01955386996269226, 0.022987840697169304, 0.011827435344457626, 0.0004026114474982023, -0.026607098057866096, 0.0013209361350163817, 0.021802008152008057, 0.009289014153182507, -0.0129082715138793, 0.0126859275624156, 0.02...
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 TestNonuniformGeometryPlotting: def setup_method(self): pytest.importorskip('matplotlib', '1.5.0') poly = Polygon([(1, 0), (2, 0), (2, 1)]) line = LineString([(0.5, 0.5), (1, 1), (1, 0.5), (1.5, 1)]) point = Point(0.75, 0.25) self.series = GeoSeries([poly, line, point...
11,711
[ -0.0028394346591085196, -0.014571723528206348, 0.09096137434244156, -0.03645417466759682, -0.014919853769242764, -0.02556268312036991, 0.028049325570464134, -0.003119181841611862, 0.016324806958436966, 0.015989109873771667, 0.007764540612697601, 0.01324137020856142, -0.03523572161793709, -...
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 setup_method(self): self.N = 3 self.values = np.arange(self.N) self.points = GeoSeries(Point(i, i) for i in range(self.N)) self.lines = GeoSeries([LineString([(0, i), (4, i + 0.5), (9, i)]) for i in range(self.N)]) self.polygons = GeoSeries([Po...
11,712
[ 0.01801709458231926, -0.048943087458610535, 0.05515848100185394, -0.01128584798425436, -0.010480614379048347, 0.0009530691313557327, 0.0009601463680155575, -0.014745835214853287, 0.026522371917963028, 0.030070431530475616, 0.026421718299388885, -0.007479862309992313, 0.0023292002733796835, ...
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_colors(self): # default uniform color ax = self.series.plot() _check_colors(1, ax.collections[0].get_facecolors(), [MPL_DFT_COLOR]) _check_colors(1, ax.collections[1].get_edgecolors(), [MPL_DFT_COLOR]) _check_colors(1, ax.collections[2].get_facecolors(), [MPL_DFT_COLOR])...
11,713
[ 0.05325007438659668, -0.02280038222670555, -0.00842104759067297, -0.013562198728322983, 0.04605473205447197, 0.01760248653590679, 0.01641082763671875, 0.03195912390947342, -0.0153326615691185, -0.009198462590575218, 0.03767907992005348, 0.021551979705691338, -0.029280731454491615, 0.015321...
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": "n", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def recv(self, n): self.__lock.acquire() try: if self.__mate is None: # EOF return bytes() if len(self.__in_buffer) == 0: self.__cv.wait(self.__timeout) if len(self.__in_buffer) == 0: raise socket.timeout...
11,714
[ 0.04984194040298462, 0.03894197195768356, 0.007229209411889315, -0.010775837115943432, -0.01804051175713539, 0.030855659395456314, 0.04322156682610512, 0.020180311053991318, 0.02002662420272827, -0.00968229304999113, 0.04636624455451965, 0.008115866221487522, -0.0036352933384478092, -0.024...
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 __unlink(self): m = None self.__lock.acquire() try: if self.__mate is not None: m = self.__mate self.__mate = None finally: self.__lock.release() if m is not None: m.__unlink()
11,715
[ -0.012055722996592522, 0.033015135675668716, 0.049522701650857925, -0.0138862868770957, -0.0028379149734973907, 0.006656102370470762, -0.01718996651470661, 0.014276228845119476, 0.004495170898735523, 0.03513815626502037, -0.01318222377449274, -0.048482853919267654, 0.00480929110199213, -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 AzureRMMariaDbDatabaseFacts(AzureRMModuleBase): def __init__(self): # define user inputs into argument self.module_arg_spec = dict( resource_group=dict( type='str', required=True ), server_name=dict( type='str'...
11,716
[ 0.01219094730913639, -0.02899410016834736, 0.018178153783082962, 0.041683077812194824, 0.0006756583461537957, 0.003494341392070055, 0.04464961588382721, -0.0027269937563687563, -0.0016808566870167851, 0.009343505837023258, 0.03295670077204704, 0.00393011886626482, -0.013078742660582066, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "total_allocate_bytes", "annotation": {"_type": "Name", "_fields": {"id": "int", "ctx": {"_type": "Load", "_fields": {}}}}, "type_comment": null}}, {"_typ...
def allocate_memory( total_allocate_bytes: int, num_chunks: int = 10, allocate_interval_s: float = 0, ) -> int: chunks = [] # divide by 8 as each element in the array occupies 8 bytes bytes_per_chunk = total_allocate_bytes / 8 / num_chunks for _ in range(num_chunks): chunks.append([0...
11,717
[ 0.029123831540346146, 0.02043312042951584, 0.04909256100654602, 0.015125816687941551, 0.02377229928970337, 0.005843563005328178, 0.032639920711517334, 0.025010669603943825, 0.0261605866253376, 0.058911073952913284, -0.014959963038563728, -0.032463010400533676, 0.023484820500016212, -0.0159...
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): # define user inputs into argument self.module_arg_spec = dict( resource_group=dict( type='str', required=True ), server_name=dict( type='str', required=True ), ...
11,718
[ 0.0192561112344265, 0.04103827103972435, 0.05084174498915672, -0.04141918197274208, -0.010234507732093334, 0.032958924770355225, -0.011287027969956398, 0.04522830247879028, 0.008540450595319271, 0.00041568290907889605, -0.011657916009426117, -0.07505974173545837, 0.01532670110464096, -0.02...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def exec_module(self, **kwargs): for key in self.module_arg_spec: setattr(self, key, kwargs[key]) if (self.resource_group is not None and self.server_name is not None and self.name is not None): self.results['databases'] = self.get() elif ...
11,719
[ -0.013992849737405777, 0.016798099502921104, 0.06469883769750595, -0.003281139535829425, 0.00651218555867672, 0.014939065091311932, -0.022197090089321136, 0.0321267805993557, -0.003617880865931511, -0.02831965871155262, -0.016798099502921104, -0.035911642014980316, 0.01426001638174057, -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 get(self): response = None results = [] try: response = self.mariadb_client.databases.get(resource_group_name=self.resource_group, server_name=self.server_name, datab...
11,720
[ -0.02486826851963997, 0.03393787145614624, 0.07355992496013641, -0.010218977928161621, -0.010762318037450314, 0.00205450551584363, -0.0005084019503556192, 0.01300882175564766, 0.009962980635464191, 0.007894108071923256, -0.030782319605350494, -0.03650829195976257, 0.02361440658569336, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def list_by_server(self): response = None results = [] try: response = self.mariadb_client.databases.list_by_server(resource_group_name=self.resource_group, server_name=self.server_name) self.log("Respons...
11,721
[ 0.014662936329841614, 0.033592239022254944, 0.02540426515042782, -0.04363327845931053, -0.008398059755563736, -0.02219371683895588, 0.012109581381082535, 0.0517566092312336, 0.025792116299271584, -0.018961621448397636, 0.01098373532295227, -0.0017251305980607867, -0.024003690108656883, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "y", "annotation": null, "type_comment": null}}, {"_type": "arg", "_f...
def target_func(x=func1, y=func2(), z=lambda: func3, w=lambda: func4()): p1 = lambda: func5() p2 = lambda: func6 p1(), p2() def inner(ix=func7, iy=func8(), iz=lambda: func9, iw=lambda: func10()): func11() ip = lambda: func12() ip() func13() inner(func14, func15(), lambda:...
11,722
[ -0.001754231983795762, -0.02903040125966072, 0.006043543107807636, -0.017306996509432793, 0.031084135174751282, -0.0007561114616692066, -0.04612346738576889, -0.028516966849565506, 0.006011453457176685, 0.04389858618378639, 0.016440577805042267, -0.01364878099411726, 0.009049270302057266, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "package", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def use_package(package): if not package: return False if package.startswith(('#', 'git+')): return False if sys.version_info.major > 2 and 'python_version <' in package: return False if sys.version_info.major == 2 and 'python_version >' in package: return False retu...
11,723
[ 0.028266791254281998, 0.03563857078552246, 0.020919915288686752, -0.004324072040617466, 0.030259164050221443, 0.017682310193777084, -0.009488675743341446, 0.0508304163813591, 0.022538719698786736, 0.01032298244535923, 0.0069546266458928585, -0.03601213917136192, 0.028615456074476242, -0.01...
13
{"_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": "cdb_id", "annotation": null, "type_comment": null}}, {"_type": ...
def save_user(module, cdb_id, name, password, databases, host): for arg, value in dict(cdb_id=cdb_id, name=name).items(): if not value: module.fail_json(msg='%s is required for the "rax_cdb_user" ' 'module' % arg) cdb = pyrax.cloud_databases try: ...
11,724
[ -0.021629879251122475, 0.01295615267008543, 0.02927533909678459, -0.04021125286817551, -0.014190072193741798, 0.010742356069386005, -0.06755103170871735, -0.0629056915640831, 0.04727604612708092, 0.010554849170148373, 0.023771092295646667, -0.03447715565562248, -0.011099224910140038, -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}}, {"_type": "arg", "_fields": {"arg": "f", "annotation": null...
class TestModels(unittest.TestCase): def _readf(self, f): with open(f) as fp: data = json.loads(fp.read()) return data @property def json_data(self): json_data = osp.join(osp.dirname(osp.abspath(__file__)), 'data/calendar-events.json') ...
11,725
[ 0.008795003406703472, 0.027316514402627945, 0.016595639288425446, -0.004751816391944885, -0.00028895214200019836, 0.03968323767185211, -0.01699567213654518, 0.01619560830295086, 0.056050289422273636, 0.04080332815647125, 0.008434973657131195, -0.07456608861684799, 0.05088415369391441, -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(): argument_spec = rax_argument_spec() argument_spec.update( dict( cdb_id=dict(type='str', required=True), db_username=dict(type='str', required=True), db_password=dict(type='str', required=True, no_log=True), databases=dict(type='list', default=[...
11,726
[ 0.043918427079916, 0.05239391326904297, -0.00900803692638874, -0.011897407472133636, 0.00686650350689888, 0.03784508630633354, 0.0009645398240536451, 0.06816647946834564, 0.05175938829779625, 0.012135355733335018, 0.030819950625300407, -0.049901124089956284, 0.015466629527509212, -0.003977...
12
{"_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": "cdb_id", "annotation": null, "type_comment": null}}, {"_type": ...
def delete_user(module, cdb_id, name): for arg, value in dict(cdb_id=cdb_id, name=name).items(): if not value: module.fail_json(msg='%s is required for the "rax_cdb_user"' ' module' % arg) cdb = pyrax.cloud_databases try: instance = cdb.get(cdb...
11,727
[ 0.012161987833678722, -0.007025029044598341, 0.003304123878479004, -0.029927929863333702, 0.030189046636223793, -0.027417197823524475, -0.05350872874259949, 0.004484168253839016, 0.003178587183356285, -0.00682919193059206, 0.03601394593715668, 0.005086743738502264, 0.024946637451648712, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},...
def asindices(x): try: x = np.asarray(x) # Check index contents to avoid creating 64bit arrays needlessly idx_dtype = get_index_dtype((x,), check_contents=True) if idx_dtype != x.dtype: x = x.astype(idx_dtype) e...
11,728
[ 0.04250189661979675, -0.0033577156718820333, 0.053242214024066925, -0.003745985683053732, 0.032133448868989944, -0.024149302393198013, 0.0033577156718820333, 0.031170975416898727, -0.01611047238111496, 0.06129198148846626, 0.01578235626220703, -0.005312737077474594, 0.03880513086915016, -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 __iter__(self): indptr = np.zeros(2, dtype=self.indptr.dtype) shape = (1, self.shape[1]) i0 = 0 for i1 in self.indptr[1:]: indptr[1] = i1 - i0 indices = self.indices[i0:i1] data = self.data[i0:i1] yield csr_matrix((data, indices, indptr...
11,729
[ -0.006502213887870312, 0.018491312861442566, 0.07564720511436462, -0.0272600706666708, 0.0025703744031488895, 0.029434312134981155, -0.02258339896798134, -0.013404406607151031, -0.0191374309360981, 0.007953417487442493, 0.04075678065419197, 0.013722337782382965, -0.008214942179620266, -0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "indices", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "N", "annotation": null, "type_comment": null}}], "kwarg": null...
def check_bounds(indices, N): if indices.size == 0: return (0, 0) max_indx = indices.max() if max_indx >= N: raise IndexError('index (%d) out of range' % max_indx) min_indx = indices.min() if min_indx < -N: rai...
11,730
[ -0.004375241231173277, -0.02250705473124981, -0.03850212320685387, -0.05229939520359039, -0.008918369188904762, -0.013074848800897598, -0.0034798430278897285, -0.01054127886891365, 0.0033399369567632675, 0.07765544205904007, 0.044362910091876984, -0.04249071329832077, 0.0009132043924182653, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sl", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "num", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def process_slice(sl, num): if isinstance(sl, slice): i0, i1, stride = sl.indices(num) if stride != 1: raise ValueError('slicing with step != 1 not supported') elif isintlike(sl): if sl < 0: sl += num ...
11,731
[ 0.0017228054348379374, -0.005092262290418148, 0.011736342683434486, 0.009236191399395466, 0.00857523176819086, 0.024162381887435913, -0.02288644202053547, -0.000607795431278646, 0.01978280581533909, 0.020610442385077477, -0.0010747776832431555, -0.02430032193660736, 0.009822433814406395, 0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "alternative", "annotation": null, "type_comment": null}}, {"_type...
def deprecate(name, alternative, alt_name=None): alt_name = alt_name or alternative.__name__ def wrapper(*args, **kwargs): warnings.warn("%s is deprecated. Use %s instead" % (name, alt_name), FutureWarning, stacklevel=2) return alternative(*args, **kwargs) return wrapp...
11,732
[ 0.019809536635875702, 0.028758332133293152, -0.007234835997223854, -0.0063297743909060955, 0.012376717291772366, 0.009373044595122337, -0.016573941335082054, 0.02841893397271633, 0.026767196133732796, 0.03208443522453308, 0.01821436546742916, -0.02590738795697689, 0.001960024004802108, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _deprecate_kwarg(func): @wraps(func) def wrapper(*args, **kwargs): old_arg_value = kwargs.pop(old_arg_name, None) if old_arg_value is not None: if mapping is not None: if hasattr(mapping, 'get'): new_arg_value = mapp...
11,733
[ 0.03317518159747124, 0.010439193807542324, 0.004989359062165022, -0.02398659847676754, 0.004879472777247429, 0.012307259254157543, 0.0021781024988740683, 0.025326162576675415, 0.024509865790605545, 0.016168976202607155, 0.009350796230137348, -0.021726081147789955, 0.009811271913349628, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment"...
def wrapper(*args, **kwargs): old_arg_value = kwargs.pop(old_arg_name, None) if old_arg_value is not None: if mapping is not None: if hasattr(mapping, 'get'): new_arg_value = mapping.get(old_arg_value, ...
11,734
[ -0.05227955803275108, 0.027173059061169624, 0.03493364900350571, -0.04124325141310692, 0.0010147301945835352, 0.03823135048151016, 0.005229604430496693, 0.04344171658158302, -0.038165394216775894, 0.031591977924108505, -0.027766644954681396, -0.03183380886912346, 0.04119928181171417, -0.03...
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": "basedir", "annotation"...
class LookupModule(object): def __init__(self, basedir=None, **kwargs): self.basedir = basedir if HAVE_REDIS == False: raise errors.AnsibleError("Can't LOOKUP(redis_kv): module redis is not installed") def run(self, terms, inject=None, **kwargs): terms = utils.listify_loo...
11,735
[ -0.035702381283044815, 0.010863923467695713, 0.06021584942936897, -0.06625135987997055, 0.021263577044010162, -0.004990905057638884, 0.006824772339314222, 0.05691953003406525, -0.010457687079906464, 0.03233642131090164, -0.02105465531349182, -0.009813511744141579, 0.055155303329229355, -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": "terms", "annotation": null, "type_comment": null}}, {"_type": "ar...
def run(self, terms, inject=None, **kwargs): terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject) ret = [] for term in terms: (url,key) = term.split(',') if url == "": url = 'redis://localhost:6379' # urlsplit on Python 2....
11,736
[ 0.03335738927125931, 0.005536564160138369, 0.03401454538106918, -0.02608921006321907, 0.03898266702890396, 0.02699608914554119, -0.029651012271642685, -0.0006781058618798852, 0.051968131214380264, -0.0026450648438185453, 0.01930733025074005, -0.025957778096199036, 0.01918904110789299, -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 testFoldl_Simple(self): with self.test_session(): elems = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") r = functional_ops.foldl( lambda a, x: math_ops.multiply(math_ops.add(a, x), 2), elems) self.assertAllEqual(208, r.eval()) r = functional_ops.foldl( ...
11,737
[ 0.03650232404470444, 0.011698488146066666, 0.03363790735602379, -0.0287709292024374, 0.01453755795955658, 0.015247324481606483, -0.009404418058693409, -0.007452557794749737, 0.009265000000596046, -0.022826626896858215, 0.03082418441772461, -0.021926743909716606, 0.0033270346466451883, -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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def testFoldl_Scoped(self): with self.test_session() as sess: with variable_scope.variable_scope("root") as varscope: elems = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") r = functional_ops.foldl(simple_scoped_fn, elems) # Check that we have the one variable we asked for here...
11,738
[ 0.02986576408147812, 0.015208203345537186, 0.02708633430302143, -0.029655996710062027, 0.03804672881960869, 0.026417698711156845, -0.029105354100465775, 0.007531993556767702, 0.04858758673071861, 0.0031022767070680857, 0.016283266246318817, -0.031832341104745865, 0.013857820071280003, -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 testFoldr_Simple(self): with self.test_session(): elems = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") r = functional_ops.foldr( lambda a, x: math_ops.multiply(math_ops.add(a, x), 2), elems) self.assertAllEqual(450, r.eval()) r = functional_ops.foldr( ...
11,739
[ 0.03199855238199234, 0.015873396769165993, 0.027542419731616974, -0.03006000816822052, 0.0106053426861763, 0.01696854829788208, -0.01053610909730196, -0.0004134352784603834, 0.00977453775703907, -0.013343220576643944, 0.02839840017259121, -0.02415626309812069, 0.0026403211522847414, -0.017...
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 testFoldr_Scoped(self): with self.test_session() as sess: with variable_scope.variable_scope("root") as varscope: elems = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") r = functional_ops.foldr(simple_scoped_fn, elems) # Check that we have the one variable we asked for here...
11,740
[ 0.01664035953581333, 0.034814752638339996, 0.05304114520549774, -0.035802774131298065, 0.03309871628880501, 0.020696448162198067, -0.013032781891524792, -0.011388245970010757, 0.05171511694788933, 0.01643235608935356, 0.017810385674238205, -0.01056272815912962, -0.010263721458613873, -0.00...
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 testFold_Grad(self): with self.test_session(): elems = constant_op.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name="data") v = constant_op.constant(2.0, name="v") r = functional_ops.foldl( lambda a, x: math_ops.multiply(a, x), elems, initializer=v) r = gradients_impl.gradients(r,...
11,741
[ 0.01245515514165163, 0.041974253952503204, 0.048627156764268875, -0.036311663687229156, 0.020365003496408463, 0.022701138630509377, 0.0036692556459456682, -0.03313756734132767, 0.05398503318428993, 0.004399297758936882, 0.01753370836377144, -0.0016298985574394464, -0.008138383738696575, 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 testMap_Grad(self): with self.test_session(): param = constant_op.constant(2.0) elems = constant_op.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name="elems") y = functional_ops.map_fn( lambda x: math_ops.multiply(math_ops.square(x), param), elems) r = gradients_impl.gradients(y, p...
11,742
[ 0.00507598789408803, -0.011660680174827576, 0.009068803861737251, -0.045449018478393555, 0.053583864122629166, 0.014788615517318249, -0.03609836846590042, -0.013727549463510513, 0.02146449312567711, 0.004432163666933775, -0.0018748273141682148, 0.0005871788016520441, 0.04889748618006706, 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 testMapSparseTensor(self): with self.test_session(): with self.assertRaises(TypeError): functional_ops.map_fn( lambda x: x, sparse_tensor.SparseTensor( indices=[[0, 0], [0, 1], [1, 0]], values=constant_op.constant([0, 1, 2]), ...
11,743
[ -0.013460952788591385, 0.01689240150153637, 0.04389490932226181, -0.04951419681310654, 0.031435757875442505, -0.0012335367500782013, -0.009056491777300835, 0.0006750627071596682, 0.015165162272751331, 0.001728678704239428, 0.0044706715270876884, -0.025494053959846497, 0.03763078898191452, ...
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 testMap_MultiOutputMismatchedDtype(self): with self.test_session(): nums = np.array([1, 2, 3, 4, 5, 6]) with self.assertRaisesRegexp( TypeError, r"two structures don't have the same sequence type."): # lambda emits tuple, but dtype is a list functional_ops.map_fn( ...
11,744
[ 0.027074476704001427, -0.004517573397606611, 0.05182049795985222, -0.05632878094911575, 0.03869197890162468, -0.010874377563595772, 0.007164951879531145, 0.01743863895535469, 0.062372855842113495, 0.007028712425380945, 0.011134471744298935, -0.017451023682951927, 0.007313576526939869, 0.01...
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 testMap_SingleInputMultiOutput(self): with self.test_session() as sess: nums = np.array([1, 2, 3, 4, 5, 6]) r = functional_ops.map_fn( lambda x: ((x + 3) * 2, -(x + 3) * 2), nums, dtype=(dtypes.int64, dtypes.int64)) self.assertEqual(2, len(r)) self.assertEqu...
11,745
[ 0.007750635035336018, 0.004293864127248526, 0.061282411217689514, -0.035314470529556274, 0.029099509119987488, -0.001108093885704875, 0.01298397034406662, -0.0049171666614711285, 0.05068325251340866, 0.00586868217214942, 0.0005762539803981781, -0.024570778012275696, 0.019427776336669922, 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 testMap_MultiInputSameStructureOutput(self): with self.test_session() as sess: nums = np.array([1, 2, 3, 4, 5, 6]) r = functional_ops.map_fn(lambda x: (x[1][0], (x[1][1], x[0])), (nums, (2 * nums, -nums))) r = [r[0], r[1][0], r[1][1]] self.assertEqual((6,)...
11,746
[ 0.02156299166381359, 0.002711566863581538, 0.035353414714336395, -0.04112395644187927, 0.024012528359889984, -0.0157100111246109, 0.008920789696276188, 0.01291895192116499, 0.052617937326431274, 0.0185835063457489, 0.015003413893282413, -0.003135525155812502, 0.022505121305584908, 0.007460...
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 testMap_MultiInputSingleOutput(self): with self.test_session(): nums = np.array([1, 2, 3, 4, 5, 6]) r = functional_ops.map_fn( lambda x: x[0] * x[1][0] + x[1][1], (nums, (nums, -nums)), dtype=dtypes.int64) self.assertEqual((6,), r.get_shape()) received = r.eval() ...
11,747
[ 0.034701742231845856, 0.03313358500599861, 0.031843651086091995, -0.05271022394299507, 0.02372465841472149, 0.025469863787293434, -0.02612747624516487, -0.020423946902155876, 0.057161759585142136, 0.010648274794220924, 0.019197246059775352, -0.007056694943457842, 0.01284242607653141, -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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def testScan_Simple(self): with self.test_session(): elems = constant_op.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name="data") v = constant_op.constant(2.0, name="v") # pylint: disable=unnecessary-lambda r = functional_ops.scan(lambda a, x: math_ops.multiply(a, x), elems) self.assertA...
11,748
[ 0.045354507863521576, 0.03187943994998932, 0.04914437234401703, -0.056823182851076126, 0.007282482925802469, -0.007561149075627327, -0.011022805236279964, 0.007678808178752661, 0.06370934098958969, 0.013574151322245598, -0.0011905248975381255, -0.015035602264106274, -0.019655272364616394, ...
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 testScan_SingleInputMultiOutput(self): with self.test_session() as sess: elems = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]) initializer = (np.array(1.0), np.array(-1.0)) r = functional_ops.scan(lambda a, x: (a[0] * x, -a[1] * x), elems, initializer) r_value = ...
11,749
[ 0.020562544465065002, 0.04077117145061493, 0.029398657381534576, -0.06917886435985565, 0.008670952171087265, 0.00004631328192772344, -0.003247183281928301, 0.006930863484740257, 0.06106238067150116, -0.0005887547158636153, -0.007562014274299145, -0.02032659947872162, 0.003276676405221224, ...
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 testScan_MultiInputSameTypeOutput(self): with self.test_session() as sess: elems = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]) r = functional_ops.scan(lambda a, x: (a[0] + x[0], a[1] + x[1]), (elems, -elems)) r_value = sess.run(r) self.assertAllEqual(np.cumsum(...
11,750
[ 0.04138351231813431, 0.03250374644994736, 0.04273684695363045, -0.03841567784547806, -0.002961900783702731, -0.013818247243762016, -0.0017658626893535256, 0.017866376787424088, 0.05712491646409035, 0.020668013021349907, -0.003125131828710437, 0.00010749133070930839, -0.017272809520363808, ...
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 testScan_MultiInputSingleOutput(self): with self.test_session(): elems = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]) initializer = np.array(1.0) # Multiply a * 1 each time r = functional_ops.scan(lambda a, x: a * (x[0] + x[1]), (elems + 1, -elems), initializer)...
11,751
[ 0.030338462442159653, 0.022984061390161514, 0.040940746665000916, -0.04586856812238693, 0.007012191694229841, 0.012929311953485012, -0.015069679357111454, -0.018255341798067093, 0.004666498396545649, -0.011168486438691616, 0.033573899418115616, -0.010633394122123718, 0.0007668612524867058, ...
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 testScan_Scoped(self): with self.test_session() as sess: with variable_scope.variable_scope("root") as varscope: elems = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") r = functional_ops.scan(simple_scoped_fn, elems) # Check that we have the one variable we asked for here. ...
11,752
[ 0.034449782222509384, 0.05536828562617302, 0.05135193467140198, -0.020512085407972336, 0.002401145175099373, 0.004891940858215094, -0.0013320603175088763, 0.016997776925563812, 0.03088766150176525, 0.0321069099009037, 0.0029151425696909428, -0.018444141373038292, -0.009736068546772003, -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 testScan_MultiOutputMismatchedInitializer(self): with self.test_session(): elems = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]) initializer = np.array(1.0) # Multiply a * 1 each time with self.assertRaisesRegexp( ValueError, "two structures don't have the same number of elements"):...
11,753
[ 0.04503355175256729, 0.039053287357091904, 0.017613928765058517, -0.02091881074011326, 0.02510741539299488, -0.006936619523912668, -0.008740383200347424, -0.01050177589058876, 0.025180049240589142, 0.021899379789829254, 0.011657878756523132, -0.04079652205109596, 0.047139957547187805, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def testScan_Control(self): with self.test_session() as sess: s = array_ops.placeholder(dtypes.float32, shape=[None]) b = array_ops.placeholder(dtypes.bool) with ops.control_dependencies([b]): c = functional_ops.scan(lambda a, x: x * a, s) self.assertAllClose( np.array([1....
11,754
[ 0.022456899285316467, 0.05850578472018242, 0.046825580298900604, -0.0394403375685215, 0.027367299422621727, 0.01639419049024582, -0.009421422146260738, 0.005555299576371908, 0.04609229415655136, -0.008354227989912033, 0.011856980621814728, -0.004517568275332451, 0.007535827811807394, -0.01...
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 testScanFoldl_Nested(self): with self.test_session(): elems = constant_op.constant([1.0, 2.0, 3.0, 4.0], name="data") inner_elems = constant_op.constant([0.5, 0.5], name="data") def r_inner(a, x): return functional_ops.foldl( lambda b, y: b * y * x, inner_elems, initialize...
11,755
[ 0.014093974605202675, 0.006244638469070196, 0.03271593526005745, -0.007432612590491772, 0.04299097880721092, 0.03848787024617195, -0.014952301979064941, 0.01612161658704281, 0.017912907525897026, 0.01972907781600952, 0.0030523468740284443, 0.003548372769728303, 0.03376085311174393, -0.0013...
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 testFoldShape(self): with self.test_session(): x = constant_op.constant([[1, 2, 3], [4, 5, 6]]) def fn(_, current_input): return current_input initializer = constant_op.constant([0, 0, 0]) y = functional_ops.foldl(fn, x, initializer=initializer) self.assertAllEqual(y.get_...
11,756
[ 0.030394189059734344, 0.05619390681385994, 0.05235676467418671, -0.04745936393737793, 0.025875451043248177, 0.011587153188884258, -0.024701589718461037, -0.020725606009364128, 0.05518413335084915, 0.005329711828380823, 0.007478636689484119, 0.0064057521522045135, -0.007188326679170132, -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 testScan_Grad(self): with self.test_session(): elems = constant_op.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name="data") v = constant_op.constant(2.0, name="v") # pylint: disable=unnecessary-lambda r = functional_ops.scan( lambda a, x: math_ops.multiply(a, x), elems, initializ...
11,757
[ 0.011355449445545673, 0.018537579104304314, 0.021836038678884506, 0.012531781569123268, 0.029485154896974564, 0.002491578459739685, -0.009972224943339825, -0.0081161018460989, 0.0024132546968758106, 0.024567021057009697, -0.021185806021094322, -0.012330800294876099, 0.03960515931248665, 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 testScanUnknownShape(self): x = array_ops.placeholder(dtypes.float32) initializer = array_ops.placeholder(dtypes.float32) def fn(_, current_input): return current_input y = functional_ops.scan(fn, x, initializer=initializer) self.assertIs(None, y.get_shape().dims)
11,758
[ 0.01330959890037775, 0.037429507821798325, 0.04142358526587486, -0.013752056285738945, 0.02563861571252346, 0.02719319611787796, -0.017160173505544662, 0.001346804667264223, 0.00988354254513979, 0.010690729133784771, 0.005689166020601988, 0.010947832837700844, 0.03680767863988876, 0.006056...
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 testScanShape(self): with self.test_session(): x = constant_op.constant([[1, 2, 3], [4, 5, 6]]) def fn(_, current_input): return current_input initializer = constant_op.constant([0, 0, 0]) y = functional_ops.scan(fn, x, initializer=initializer) self.assertAllEqual(y.get_s...
11,759
[ 0.06947960704565048, -0.0003305243735667318, 0.025030354037880898, -0.036206696182489395, -0.006566102150827646, 0.02677665650844574, -0.009930646978318691, 0.0026092687621712685, 0.012724732980132103, -0.003355813678354025, 0.01998935639858246, -0.05970030277967453, -0.005137043539434671, ...
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 TestSerializerTools(DragonTestCase): def test_m2m(self): reverse_m2m = ReverseM2M.objects.create(number=12) m2m = M2M.objects.create(name='test') m2m.many.add(reverse_m2m) mapping = serializer_tools.get_id_mappings(M2MSerializer(instance=m2m)) self.assertEqual(list(mapp...
11,760
[ 0.013853918761014938, 0.009467043913900852, 0.04628332331776619, -0.02529326267540455, 0.02811424992978573, 0.02015332691371441, 0.015611059032380581, -0.00918614026159048, 0.0038519632071256638, 0.03963726758956909, 0.011744154617190361, 0.0020051724277436733, 0.043605778366327286, 0.0191...
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 testScanVaryingShape(self): with self.test_session() as sess: x = array_ops.placeholder(dtype=dtypes.float32, shape=[None, 2]) x_t = array_ops.transpose(x) # scan over dimension 0 (with shape None) result = functional_ops.scan(lambda a, x: a + x, x) # scanned over transposed dimens...
11,761
[ -0.011941822245717049, 0.032975584268569946, -0.01322253979742527, -0.010170741006731987, 0.007488157134503126, -0.0408906452357769, -0.02216448448598385, 0.0017681973986327648, 0.006115136202424765, -0.016626248136162758, 0.007003561593592167, 0.0032854434102773666, -0.004620966035872698, ...
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": "accepted_media_type", "annotation": null, "type_comment": null}},...
def get_indent(self, accepted_media_type, renderer_context): if accepted_media_type: # If the media type looks like 'application/json; indent=4', # then pretty print the result. # Note that we coerce `indent=0` into `indent=None`. base_media_type, params = parse_h...
11,762
[ -0.005471839103847742, -0.008487928658723831, 0.027578460052609444, -0.058899011462926865, -0.004219601862132549, -0.019733702763915062, -0.009969174861907959, -0.050011537969112396, 0.002899148967117071, 0.015475121326744556, 0.002760282251983881, -0.043579813092947006, 0.060731079429388046...
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": "response", "annotation": null, "type_comment": null}}, {"_type": ...
def get_template_names(self, response, view): if response.template_name: return [response.template_name] elif self.template_name: return [self.template_name] elif hasattr(view, 'get_template_names'): return view.get_template_names() elif hasattr(view, ...
11,763
[ 0.023690970614552498, -0.024442099034786224, 0.012748868204653263, -0.02626916579902172, 0.006942855194211006, -0.012261650525033474, -0.022330820560455322, -0.0051310136914253235, 0.027791721746325493, -0.002887781010940671, -0.011754131875932217, -0.04912780597805977, 0.05485261604189873, ...
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": "response", "annotation": null, "type_comment": null}}], "kwarg": ...
def get_exception_template(self, response): template_names = [name % {'status_code': response.status_code} for name in self.exception_template_names] try: # Try to find an appropriate error template return self.resolve_template(template_names) e...
11,764
[ 0.008910122327506542, -0.003084273310378194, 0.014176233671605587, -0.014678855426609516, 0.0279869232326746, -0.05981205403804779, -0.03390415757894516, 0.01157744787633419, -0.00396100664511323, -0.006494108587503433, -0.015981104224920273, -0.025542352348566055, 0.02954048290848732, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def render(self, data, accepted_media_type=None, renderer_context=None): renderer_context = renderer_context or {} response = renderer_context['response'] if response and response.exception: request = renderer_context['request'] template = self.get_exception_template(res...
11,765
[ 0.047707393765449524, -0.0020084972493350506, 0.024389958009123802, 0.016743268817663193, -0.004563186317682266, -0.09454087913036346, 0.0490182563662529, -0.015591301023960114, -0.03656507655978203, -0.011261487379670143, -0.02016938291490078, -0.034658368676900864, -0.006837331689894199, ...
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 GenericContentForm(forms.Form): def __init__(self): super(GenericContentForm, self).__init__() self.fields[content_type_field] = forms.ChoiceField( label='Media type', choices=choices, ...
11,766
[ 0.05877560004591942, 0.016754375770688057, -0.018138432875275612, -0.018138432875275612, -0.003618841292336583, -0.041334398090839386, 0.01159277930855751, -0.03504890576004982, -0.013819758780300617, 0.0316355936229229, 0.011894566006958485, -0.0011934891808778048, 0.057152196764945984, -...
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": "field", "annotation": null, "type_comment": null}}, {"_type": "ar...
def render_field(self, field, parent_style): if isinstance(field._field, serializers.HiddenField): return '' style = dict(self.default_style[field]) style.update(field.style) if 'template_pack' not in style: style['template_pack'] = parent_style.get('template_pac...
11,767
[ 0.02539714053273201, 0.006601289380341768, 0.0010763973696157336, 0.010313746519386768, 0.021684683859348297, -0.043098922818899155, -0.017136309295892715, 0.0175542663782835, -0.0006799512775614858, 0.04071410000324249, 0.006619729101657867, -0.027339419350028038, 0.03483809158205986, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def render(self, data, accepted_media_type=None, renderer_context=None): self.accepted_media_type = accepted_media_type or '' self.renderer_context = renderer_context or {} response = renderer_context['response'] request = renderer_context['request'] view = self.renderer_context...
11,768
[ 0.038109488785266876, 0.0006318198866210878, 0.03041410632431507, 0.02561725117266178, -0.003368004923686385, -0.08867038786411285, 0.0430288165807724, -0.012635122053325176, -0.03555796667933464, -0.008073005825281143, -0.01661549136042595, -0.022616663947701454, -0.007695381063967943, 0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def __init__(self): super(GenericContentForm, self).__init__() self.fields[content_type_field] = forms.ChoiceField( label='Media type', choices=choices, initial=initial ) ...
11,769
[ 0.023196760565042496, 0.00039336777990683913, 0.06277231872081757, 0.02666451968252659, -0.014409812167286873, 0.03575514256954193, 0.0015783690614625812, 0.00974695011973381, 0.026938805356621742, 0.052506182342767715, -0.0016616345383226871, -0.03930126875638962, -0.043376374989748, -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": "module", "annotation": null, "type_comment": null}}], "kwarg": nu...
def __init__(self, module): self.module = module try: region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) self.client = boto3_conn(module, conn_type='client', resource='cloudformation', region=region, ...
11,770
[ -0.009339535608887672, 0.005236934870481491, -0.010928754694759846, -0.0397765189409256, 0.01618008315563202, -0.023907369002699852, -0.07213668525218964, 0.007830929942429066, 0.012863454408943653, 0.013462290167808533, 0.008544926531612873, -0.056152377277612686, 0.024782590568065643, -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": "stack_name", "annotation": null, "type_comment": null}}], "kwarg"...
def describe_stack(self, stack_name): try: func = partial(self.client.describe_stacks,StackName=stack_name) response = self.paginated_response(func, 'Stacks') if response: return response[0] self.module.fail_json(msg="Error describing stack - an em...
11,771
[ 0.03914753720164299, 0.014206767082214355, 0.0069572231732308865, -0.054862674325704575, -0.014405544847249985, 0.04015311598777771, -0.02353763021528721, -0.018568186089396477, 0.029091717675328255, 0.05832374840974808, 0.025537101551890373, -0.06594745814800262, 0.011581731028854847, -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(): argument_spec = ec2_argument_spec() argument_spec.update(dict( stack_name=dict(required=True, type='str' ), all_facts=dict(required=False, default=False, type='bool'), stack_policy=dict(required=False, default=False, type='bool'), stack_events=dict(required=False, def...
11,772
[ 0.017415735870599747, -0.008740421384572983, -0.02595541626214981, -0.018479127436876297, 0.012836645357310772, 0.01026497595012188, -0.059506479650735855, -0.019802941009402275, 0.005021266173571348, -0.016591066494584084, 0.02043229341506958, -0.050478510558605194, 0.012131335213780403, ...
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": "stack_name", "annotation": null, "type_comment": null}}], "kwarg"...
def get_stack_policy(self, stack_name): try: response = self.client.get_stack_policy(StackName=stack_name) stack_policy = response.get('StackPolicyBody') if stack_policy: return json.loads(stack_policy) return dict() except Exception as e: ...
11,773
[ 0.008219203911721706, 0.0088275745511055, 0.022273795679211617, -0.01610318385064602, -0.04799915850162506, -0.03250434622168541, 0.0651576817035675, 0.024508623406291008, 0.014600882306694984, 0.033423107117414474, -0.02490592747926712, -0.002588676754385233, -0.007275609765201807, 0.0258...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settings", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def test_invalid_unicode_characters(settings): # Adds a BooleanField that uses non valid unicode characters "ñ" form_helper = FormHelper() form_helper.add_layout( Layout( 'españa' ) ) template = get_template_from_string(""" {% load crispy_forms_tags %} {%...
11,774
[ 0.05051812157034874, -0.012461277656257153, 0.015290039591491222, 0.017245987430214882, -0.031421348452568054, -0.03137928247451782, 0.04462924972176552, 0.04908796772360802, -0.051317326724529266, 0.01924399845302105, -0.02164161019027233, 0.004640116821974516, 0.03095865063369274, -0.002...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fie...
def test_unicode_form_field(): class UnicodeForm(forms.Form): def __init__(self, *args, **kwargs): super(UnicodeForm, self).__init__(*args, **kwargs) self.fields['contraseña'] = forms.CharField() helper = FormHelper() helper.layout = Layout('contraseña') if PY2:...
11,775
[ 0.033138785511255264, 0.061599668115377426, 0.04533630609512329, -0.03390386328101158, 0.018099548295140266, 0.007896692492067814, 0.025990774855017662, -0.007393927313387394, -0.011738474480807781, 0.016962861642241478, 0.021378451958298683, -0.04461494833230972, 0.04109559208154678, -0.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": "ClassDef", "_fields": {"body": [{"_type": "ClassDef", "_fields...
def test_meta_extra_fields_with_missing_fields(): class FormWithMeta(TestForm): class Meta: fields = ('email', 'first_name', 'last_name') form = FormWithMeta() # We remove email field on the go del form.fields['email'] form_helper = FormHelper() form_helper.layout = Layout(...
11,776
[ -0.009252671152353287, 0.007400910370051861, 0.04093494266271591, -0.02810751646757126, -0.008621109649538994, -0.010914349928498268, 0.038874708116054535, -0.020479734987020493, -0.012318499386310577, 0.0010883691720664501, -0.027052871882915497, 0.017033744603395462, 0.038948286324739456, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settings", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def test_layout_unresolved_field(settings): form_helper = FormHelper() form_helper.add_layout( Layout( 'typo' ) ) template = get_template_from_string(""" {% load crispy_forms_tags %} {% crispy form form_helper %} """) c = Context({'form': TestForm(), ...
11,777
[ 0.03728502243757248, -0.01261772122234106, 0.049222227185964584, -0.013036022894084454, -0.011050651781260967, 0.008384760469198227, 0.05509093403816223, 0.008715655654668808, 0.00045771239092573524, -0.0033245605882257223, -0.0006785693112760782, -0.019866200163960457, 0.038508713245391846,...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settings", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def test_double_rendered_field(settings): form_helper = FormHelper() form_helper.add_layout( Layout( 'is_company', 'is_company', ) ) template = get_template_from_string(""" {% load crispy_forms_tags %} {% crispy form form_helper %} """) c ...
11,778
[ 0.03572003170847893, -0.010625733062624931, 0.00868601817637682, -0.0016759013524278998, 0.005855742841959, 0.023300977423787117, 0.02054389752447605, 0.014126979745924473, 0.034109700471162796, 0.03481727093458176, 0.021959036588668823, -0.047504715621471405, 0.04345449060201645, 0.018055...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields":...
def test_context_pollution(): class ExampleForm(forms.Form): comment = forms.CharField() form = ExampleForm() form2 = TestForm() template = get_template_from_string(""" {% load crispy_forms_tags %} {{ form.as_ul }} {% crispy form2 %} {{ form.as_ul }} """) ...
11,779
[ 0.005133891478180885, -0.02795354090631008, 0.05735921114683151, -0.021878788247704506, -0.01842997409403324, -0.013734748587012291, 0.035214200615882874, -0.010655018500983715, 0.0007502681692130864, 0.01159285381436348, -0.0028210689779371023, -0.02049926295876503, 0.03037375956773758, 0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settings", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def test_layout_fieldset_row_html_with_unicode_fieldnames(settings): form_helper = FormHelper() form_helper.add_layout( Layout( Fieldset( 'Company Data', 'is_company', css_id="fieldset_company_data", css_class="fieldsets", ...
11,780
[ 0.040153492242097855, 0.020846718922257423, 0.00494736060500145, -0.029695656150579453, -0.01992734894156456, 0.011813906952738762, 0.010555518791079521, 0.0072113098576664925, 0.0030626519583165646, -0.011245045810937881, 0.011457650922238827, -0.018444864079356194, 0.055208176374435425, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_change_layout_dynamically_delete_field(): template = get_template_from_string(""" {% load crispy_forms_tags %} {% crispy form form_helper %} """) form = TestForm() form_helper = FormHelper() form_helper.add_layout( Layout( Fieldset( 'Comp...
11,781
[ 0.010324944742023945, -0.006381257902830839, 0.01242782361805439, -0.02419889159500599, -0.006283375900238752, -0.0025986023247241974, 0.014840134419500828, 0.004859354812651873, -0.008708316832780838, 0.012225745245814323, 0.006409675348550081, -0.04822096601128578, 0.06077508628368378, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_modelformset_layout(): CrispyModelFormSet = modelformset_factory(CrispyTestModel, form=TestForm4, extra=3) formset = CrispyModelFormSet(queryset=CrispyTestModel.objects.none()) helper = FormHelper() helper.layout = Layout( 'email' ) html = render_crispy_form(form=formset, helpe...
11,782
[ -0.0062820096500217915, -0.03004741668701172, 0.023597845807671547, -0.03012329526245594, -0.0006848718039691448, -0.015453680418431759, 0.03755927085876465, -0.010976918041706085, 0.0026983870193362236, 0.021991776302456856, 0.0012820104602724314, -0.044059429317712784, 0.029769200831651688...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settings", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def test_formset_layout(settings): TestFormSet = formset_factory(TestForm, extra=3) formset = TestFormSet() helper = FormHelper() helper.form_id = 'thisFormsetRocks' helper.form_class = 'formsets-that-rock' helper.form_method = 'POST' helper.form_action = 'simpleAction' helper.layout = L...
11,783
[ 0.010735630057752132, 0.004180931486189365, -0.002248518168926239, -0.03289874270558357, 0.023379817605018616, -0.007837009616196156, 0.02669593319296837, 0.006423485465347767, -0.02351102977991104, 0.00743144191801548, -0.009113357402384281, 0.0014068149030208588, 0.025717798620462418, 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_i18n(): template = get_template_from_string(""" {% load crispy_forms_tags %} {% crispy form form.helper %} """) form = TestForm() form_helper = FormHelper() form_helper.layout = Layout( HTML(_("i18n text")), Fieldset( _("i18n legend"), ...
11,784
[ 0.0036216469015926123, -0.013065836392343044, 0.03990788385272026, -0.006368009839206934, 0.007915613241493702, -0.014055288396775723, 0.05596744641661644, 0.0008467423031106591, 0.01321806013584137, 0.011366008780896664, -0.010179935954511166, -0.01655428856611252, -0.00880358275026083, 0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "settings", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def test_l10n(settings): settings.USE_L10N = True settings.USE_THOUSAND_SEPARATOR = True form = TestForm5(data={'pk': 1000}) html = render_crispy_form(form) # Make sure values are unlocalized assert 'value="1,000"' not in html # Make sure label values are NOT localized. # Dirty check,...
11,785
[ 0.015880266204476357, 0.003169088391587138, 0.04571380838751793, -0.0062743304297327995, 0.003180696628987789, -0.014939988031983376, 0.02435438521206379, 0.0262349434196949, 0.015682924538850784, 0.02353019081056118, -0.0022752429358661175, -0.010911879129707813, 0.05567380040884018, 0.00...
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_modelform_layout_without_meta(): test_form = TestForm4() test_form.helper = FormHelper() test_form.helper.layout = Layout('email') html = render_crispy_form(test_form) assert 'email' in html assert 'password' not in html
11,786
[ 0.0411483570933342, 0.012922238558530807, 0.07130247354507446, 0.011027599684894085, -0.01968022994697094, -0.030234169214963913, 0.040668025612831116, 0.0058373562060296535, 0.04509774595499039, 0.023162629455327988, 0.0082056550309062, -0.013062335550785065, 0.013742804527282715, 0.03330...
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_specialspaceless_not_screwing_intended_spaces(): # see issue #250 test_form = TestForm() test_form.fields['email'].widget = forms.Textarea() test_form.helper = FormHelper() test_form.helper.layout = Layout( 'email', HTML("<span>first span</span> <span>second span</span>") ...
11,787
[ 0.026277249678969383, -0.009950933046638966, 0.055705830454826355, -0.01613239012658596, 0.026980239897966385, -0.0145324831828475, 0.02824077196419239, 0.017998946830630302, -0.0015271833399310708, 0.020059432834386826, -0.016423281282186508, -0.011235706508159637, 0.04392470046877861, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_layout_composition(): form_helper = FormHelper() form_helper.add_layout( Layout( Layout( MultiField( "Some company data", 'is_company', 'email', css_id="multifield_info", ...
11,788
[ 0.007958900183439255, -0.0006558393943123519, 0.051069606095552444, -0.004133416805416346, 0.016486292704939842, -0.019731439650058746, 0.027832461521029472, 0.035128120332956314, -0.0024353403132408857, 0.010629631578922272, 0.01590595580637455, 0.01261343527585268, 0.008343816734850407, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_second_layout_multifield_column_buttonholder_submit_div(): form_helper = FormHelper() form_helper.add_layout( Layout( MultiField( "Some company data", 'is_company', 'email', css_id="multifield_info", tit...
11,789
[ 0.0626019686460495, -0.016573967412114143, -0.01644030585885048, -0.03392560034990311, 0.0626019686460495, 0.0585678331553936, 0.01136726327240467, 0.02171384170651436, -0.008451022207736969, -0.007886000908911228, -0.006036010570824146, -0.03161690756678581, -0.004067548085004091, 0.00890...
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 TestDotDict(unittest.TestCase): def setUp(self): self.dd = DotDict([('z', 1), (2, 'y'), ('x', 3)]) def test_get(self): assert_equal(self.dd[2], 'y') assert_equal(self.dd.x, 3) assert_raises(KeyError, self.dd.__getitem__, 'nonex') assert_raises(AttributeError, self...
11,790
[ 0.005830259528011084, 0.01130465418100357, 0.023119382560253143, -0.012455285526812077, 0.02156543731689453, -0.03888421505689621, 0.0012514595873653889, -0.01104961708188057, -0.015503864735364914, 0.010195540264248848, 0.015610624104738235, 0.01717643067240715, 0.05067521706223488, 0.004...
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_form_inline(): form = TestForm() form.helper = FormHelper() form.helper.form_class = 'form-inline' form.helper.field_template = 'bootstrap3/layout/inline_field.html' form.helper.layout = Layout( 'email', 'password1', 'last_name', ) html = render_crispy_form(...
11,791
[ 0.09045582264661789, -0.024412792176008224, -0.00829392485320568, -0.033920932561159134, 0.036721982061862946, 0.017435872927308083, -0.015264419838786125, -0.011833780445158482, -0.0030259015038609505, 0.001602089498192072, 0.013247152790427208, -0.02153465338051319, 0.013581221923232079, ...
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_is_ordered(self): assert_equal(list(self.dd), ['z', 2, 'x']) self.dd.z = 'new value' self.dd.a_new_item = 'last' self.dd.pop('x') assert_equal(self.dd.items(), [('z', 'new value'), (2, 'y'), ('a_new_item', 'last')]) self.dd....
11,792
[ 0.06215813383460045, -0.06629239022731781, 0.011279080994427204, -0.02680058777332306, 0.03470856323838234, 0.02821873500943184, -0.0038938969373703003, -0.01688557118177414, -0.009374196641147137, -0.031607866287231445, 0.02219761535525322, -0.0376410037279129, -0.01664520800113678, 0.020...
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_order_does_not_affect_equality(self): d = dict(a=1, b=2, c=3, d=4, e=5, f=6, g=7) od1 = OrderedDict(sorted(d.items())) od2 = OrderedDict(reversed(od1.items())) dd1 = DotDict(sorted(d.items())) dd2 = DotDict(reversed(dd1.items())) for d1, d2 in [(dd1, dd2), (dd1, ...
11,793
[ -0.0009122040355578065, -0.06709464639425278, 0.021336833015084267, -0.007939686067402363, 0.022299913689494133, -0.012875476852059364, -0.0013063220540061593, 0.037330858409404755, 0.01168882381170988, -0.05163948982954025, 0.0007387921214103699, 0.00575268967077136, 0.0024865262676030397, ...
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 testBaseApi(self): factory.make_twitter_connection() transaction.commit() params = { 'api_key': self.api_key } res = self.app.get('/api/v1/admin/social_connections', params=params, status=200) connecti...
11,794
[ -0.007468998897820711, 0.005108460783958435, -0.024123750627040863, -0.016610162332654, -0.025840505957603455, -0.015651453286409378, -0.010417581535875797, 0.004316969774663448, 0.01191695500165224, 0.00634864903986454, 0.006142415571957827, -0.034290507435798645, 0.02312045358121395, 0.0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def get_context(obj): if isinstance(obj, _cprequest.Request): return "path=%s;stage=%s" % (obj.path_info, obj.stage) elif isinstance(obj, _cprequest.Response): return "status=%s" % obj.status elif isinstance(obj, _cpwsgi.AppResponse): return "PATH_INFO=%s" % obj.environ.get('PATH_INF...
11,795
[ 0.027109652757644653, 0.03370238468050957, 0.03378601372241974, -0.05533435568213463, -0.02313728630542755, 0.024489285424351692, -0.032503705471754074, -0.01064175833016634, 0.007150257937610149, 0.056728165596723557, 0.04856042563915253, -0.02110232040286064, -0.027848372235894203, -0.03...
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 stats(self): output = ["Statistics:"] for trial in range(10): if request_counter.count > 0: break time.sleep(0.5) else: output.append("\nNot all requests closed properly.") # gc_collect isn't perfectly synchronous,...
11,796
[ -0.025458961725234985, 0.03565176948904991, 0.046651702374219894, 0.0036579961888492107, -0.024697959423065186, -0.007731083780527115, -0.007702257949858904, -0.03477546572685242, 0.02193068154156208, -0.0003437478735577315, -0.021411815658211708, -0.0668758973479271, 0.07384020835161209, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "res.partner"}}, "targets": [{"_type": "Name", "_fields": {"id": "_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": nul...
class res_partner(osv.osv): _name = 'res.partner' _inherit = 'res.partner' _columns = { 'property_product_pricelist': fields.property( type='many2one', relation='product.pricelist', string="Sale Pricelist", help="This pricelist will be used, instead...
11,797
[ 0.02546665072441101, 0.0277940072119236, -0.006987664382904768, -0.021863725036382675, -0.041914794594049454, -0.026966005563735962, -0.0033092100638896227, 0.014165544882416725, 0.028219198808073997, 0.01465787086635828, 0.02452675811946392, 0.03726008161902428, 0.0120284054428339, -0.021...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "tag", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def get_commits(tag): commit_start_marker = "|=== COMMIT START MARKER ===|" commit_end_marker = "|=== COMMIT END MARKER ===|" field_end_marker = "|=== COMMIT FIELD END MARKER ===|" log_format =\ commit_start_marker + "%h" +\ field_end_marker + "%an" +\ field_end_marker + "%s" +\ ...
11,798
[ -0.007320750504732132, -0.019983956590294838, -0.00411527743563056, -0.03715386614203453, -0.009653446264564991, 0.01041514240205288, -0.02054465003311634, -0.007934339344501495, 0.018386509269475937, 0.0736306682229042, -0.01865098625421524, 0.023951126262545586, 0.03321843594312668, 0.00...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "str_list", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def nice_join(str_list): str_list = list(str_list) # sometimes it's a set if not str_list: return "" elif len(str_list) == 1: return next(iter(str_list)) elif len(str_list) == 2: return " and ".join(str_list) else: return ", ".join(str_list[:-1]) + ", and " + str_lis...
11,799
[ 0.0214603953063488, -0.035862989723682404, 0.008721275255084038, -0.025935295969247818, -0.031526267528533936, -0.05867329239845276, 0.007599892094731331, -0.0031409345101565123, 0.005043564829975367, -0.01275506429374218, 0.013849874027073383, -0.010560129769146442, -0.021874934434890747, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "author", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "jira_client", "annotation": null, "type_comment": null}}], "kwa...
def get_jira_name(author, jira_client): if jira_client: try: return jira_client.user(author).displayName except JIRAError as e: # If this is not a "not found" exception if e.status_code != 404: raise e return None
11,800
[ 0.028629183769226074, -0.052102770656347275, -0.024547670036554337, -0.0032613053917884827, -0.025602225214242935, -0.08295823633670807, -0.005433881655335426, 0.023395473137497902, -0.02208704501390457, -0.01534961722791195, -0.0002900328254327178, -0.0027706450782716274, -0.021969871595501...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "author", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "github_client", "annotation": null, "type_comment": null}}], "k...
def get_github_name(author, github_client): if github_client: try: return github_client.get_user(author).name except GithubException as e: # If this is not a "not found" exception if e.status != 404: raise e return None