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 |
|---|---|---|---|---|---|
12,201 | [
0.01961580477654934,
0.0009111483232118189,
-0.009738260880112648,
-0.04477974772453308,
0.02613893151283264,
-0.04647436738014221,
-0.028529969975352287,
-0.015553359873592854,
0.024769306182861328,
0.010469500906765461,
0.018048861995339394,
-0.05743136256933212,
0.006314199883490801,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg... | def main(request, response):
headers = [("Content-type", "text/plain"),
("X-Request-Method", request.method),
("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"),
("X-Request-Content-Length", request.headers.get("Content-Length", "NO")),
... | |
12,202 | [
0.013994773849844933,
-0.044535715132951736,
0.016356706619262695,
-0.00792574044317007,
0.0064795296639204025,
-0.01438632421195507,
0.020891115069389343,
0.004989111330360174,
0.017695557326078415,
0.0020903744734823704,
0.005538545083254576,
-0.03645209223031998,
0.028924215584993362,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "user_999"}}], "func": {"_type": "Name", "_fields": {"id": "fixture", "ctx": {"_type": "Load", "_fi... | class TestPotatoCaptchaSerializer(TestCase):
fixtures = fixture('user_999')
def setUp(self):
self.request = mock.Mock()
self.request.META = {}
self.request.user = mock.Mock()
self.context = {'request': self.request}
self.request.user.is_authenticated = lambda: False
... | |
12,203 | [
0.050696540623903275,
-0.002627002540975809,
-0.017490306869149208,
-0.0205666646361351,
-0.006377394311130047,
-0.005415312480181456,
0.00525112496688962,
0.011135956272482872,
-0.0012198855401948094,
-0.007788832299411297,
0.007155125495046377,
-0.05221743881702423,
-0.013031315989792347,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
self.SerializerClass.Meta = type('Meta', (self.Struct,),
{'model': UserProfile,
'url_basename': self.url_basename})
self.request = RequestFactory().get('/')
self.request.API_VERSION = 1
se... | |
12,204 | [
0.002491551684215665,
-0.0378047414124012,
-0.045146532356739044,
-0.037300679832696915,
0.006591174751520157,
-0.0029175400268286467,
-0.0010766133200377226,
0.01710527576506138,
0.0028298767283558846,
-0.018036697059869766,
-0.014661665074527264,
-0.06798279285430908,
0.020962456241250038,... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Potato"}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_typ... | class TestURLSerializerMixin(TestCase):
SerializerClass = type('Potato', (URLSerializerMixin, Serializer),
{'Meta': None})
Struct = type('Struct', (object,), {})
url_basename = 'potato'
def setUp(self):
self.SerializerClass.Meta = type('Meta', (self.Struct,),
... | |
12,205 | [
0.020828835666179657,
0.038902852684259415,
0.006354052573442459,
-0.0009581983322277665,
0.017606893554329872,
0.03768114745616913,
-0.012720082886517048,
-0.004665228072553873,
0.009174749255180359,
0.041609760373830795,
-0.02795543521642685,
-0.006168401800096035,
0.044771816581487656,
... | 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": "value", "annotation": ... | class DragActionTest(tab_test_case.TabTestCase):
def CheckWithinRange(self, value, expected, error_ratio):
error_range = abs(expected * error_ratio)
return abs(value - expected) <= error_range
# https://github.com/catapult-project/catapult/issues/3099 (Android)
# crbug.com/483212 (CrOS)
@decorators.Dis... | |
12,206 | [
0.02217288501560688,
0.024294400587677956,
0.013650447130203247,
0.00569172715768218,
-0.005094671621918678,
0.0013729246566072106,
-0.034162487834692,
-0.006764608900994062,
-0.012583627365529537,
0.03753266856074333,
-0.013432233594357967,
0.005243177991360426,
0.033144157379865646,
-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 testDragAction(self):
self.Navigate('draggable.html')
utils.InjectJavaScript(self._tab, 'gesture_common.js')
div_width = self._tab.EvaluateJavaScript(
'__GestureCommon_GetBoundingVisibleRect(document.body).width')
div_height = self._tab.EvaluateJavaScript(
'__GestureCommon_GetBound... | |
12,207 | [
0.05197771638631821,
0.020791087299585342,
0.10144936293363571,
-0.0080751096829772,
-0.018505459651350975,
0.01575574465095997,
0.010053278878331184,
0.02183528244495392,
-0.011422335170209408,
-0.025455158203840256,
0.029028626158833504,
-0.024109307676553726,
0.020141365006566048,
0.021... | 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": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,... | def forwards(self, orm):
# Changing field 'GroupObjectPermission.object_pk'
db.alter_column('guardian_groupobjectpermission', 'object_pk', self.gf('django.db.models.fields.CharField')(max_length=255))
# Changing field 'UserObjectPermission.object_pk'
db.alter_column('guardian_u... | |
12,208 | [
0.039544083178043365,
0.03192688152194023,
0.06068621575832367,
-0.030217410996556282,
-0.027276115491986275,
0.001305671175941825,
-0.006036568898707628,
-0.013902020640671253,
-0.027628066018223763,
-0.001574347261339426,
0.006586490664631128,
-0.03333468362689018,
-0.0011540499981492758,
... | 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": "orm", "annotation": nu... | class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'GroupObjectPermission.object_pk'
db.alter_column('guardian_groupobjectpermission', 'object_pk', self.gf('django.db.models.fields.CharField')(max_length=255))
# Changing field 'UserObjectPermission.object_... | |
12,209 | [
0.06750444322824478,
0.03977510333061218,
0.08475397527217865,
-0.018947981297969818,
-0.012148149311542511,
0.015346298925578594,
-0.0012482419842854142,
0.014226043596863747,
-0.020730754360556602,
-0.026693405583500862,
0.022417161613702774,
-0.01739407889544964,
0.012961238622665405,
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": "orm", "annotation": null, "type_comment": null}}], "kwarg": null,... | def backwards(self, orm):
# Changing field 'GroupObjectPermission.object_pk'
db.alter_column('guardian_groupobjectpermission', 'object_pk', self.gf('django.db.models.fields.TextField')())
# Changing field 'UserObjectPermission.object_pk'
db.alter_column('guardian_userobjectpermission',... | |
12,210 | [
0.016348261386156082,
-0.00492154760286212,
0.049108002334833145,
-0.011252864263951778,
-0.014565505087375641,
0.01968619041144848,
-0.002204739488661289,
-0.032721810042858124,
0.01299768965691328,
0.05492408946156502,
0.010298267006874084,
-0.015033320523798466,
-0.004023847170174122,
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_ovr_exceptions():
ovr = OneVsRestClassifier(LinearSVC(random_state=0))
# test predicting without fitting
with pytest.raises(NotFittedError):
ovr.predict([])
# Fail on multioutput data
msg = "Multioutput target data is not supported with label binarization"
with pytest.raises(V... | |
12,211 | [
0.00934682134538889,
-0.014883158728480339,
0.0236918106675148,
-0.005527058150619268,
-0.007682827301323414,
0.029568370431661606,
0.003983688075095415,
0.0056043812073767185,
-0.024223793298006058,
0.05587061122059822,
0.026500187814235687,
-0.01685025915503502,
-0.013794448226690292,
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_ovr_partial_fit():
# Test if partial_fit is working as intended
X, y = shuffle(iris.data, iris.target, random_state=0)
ovr = OneVsRestClassifier(MultinomialNB())
ovr.partial_fit(X[:100], y[:100], np.unique(y))
ovr.partial_fit(X[100:], y[100:])
pred = ovr.predict(X)
ovr2 = OneVsRestC... | |
12,212 | [
0.017289824783802032,
-0.015016661025583744,
0.021950960159301758,
0.007364822551608086,
0.023994512856006622,
0.016658391803503036,
-0.0022114559542387724,
-0.02144581265747547,
0.011325639672577381,
0.06938891857862473,
-0.0022846448700875044,
-0.03336270526051521,
-0.009362451732158661,
... | 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_ovr_fit_predict():
# A classifier which implements decision_function.
ovr = OneVsRestClassifier(LinearSVC(random_state=0))
pred = ovr.fit(iris.data, iris.target).predict(iris.data)
assert len(ovr.estimators_) == n_classes
clf = LinearSVC(random_state=0)
pred2 = clf.fit(iris.data, iris.... | |
12,213 | [
0.049796734005212784,
0.013102438300848007,
0.01610119268298149,
-0.0026005790568888187,
0.010246778838336468,
0.04616338759660721,
0.010308993980288506,
-0.04046451300382614,
0.00726668955758214,
0.053504735231399536,
0.021227693185210228,
-0.017805878072977066,
0.005761091131716967,
0.03... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ovr_ovo_regressor():
# test that ovr and ovo work on regressors which don't have a decision_
# function
ovr = OneVsRestClassifier(DecisionTreeRegressor())
pred = ovr.fit(iris.data, iris.target).predict(iris.data)
assert len(ovr.estimators_) == n_classes
assert_array_equal(np.unique(pred... | |
12,214 | [
-0.010275508277118206,
-0.0009727271972224116,
0.04578866809606552,
-0.02135300636291504,
-0.035137224942445755,
-0.0009351338958367705,
0.01617765985429287,
0.004645908251404762,
-0.012957165017724037,
0.063908651471138,
0.020638734102249146,
-0.027468187734484673,
-0.0032831502612680197,
... | 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_ovr_partial_fit_exceptions():
ovr = OneVsRestClassifier(MultinomialNB())
X = np.abs(np.random.randn(14, 2))
y = [1, 1, 1, 1, 2, 3, 3, 0, 0, 2, 3, 1, 2, 3]
ovr.partial_fit(X[:7], y[:7], np.unique(y))
# If a new class that was not in the first call of partial fit is seen
# it should raise... | |
12,215 | [
-0.016448242589831352,
0.04771518334746361,
-0.0008275044965557754,
-0.013876614160835743,
0.01972006820142269,
0.043717700988054276,
0.0359518863260746,
-0.0335075668990612,
0.0268111452460289,
0.07944042980670929,
0.02118411473929882,
-0.015289736911654472,
0.03666481375694275,
0.0088415... | 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_ovr_always_present():
# Test that ovr works with classes that are always present or absent.
# Note: tests is the case where _ConstantPredictor is utilised
X = np.ones((10, 2))
X[:5, :] = 0
# Build an indicator matrix where two features are always on.
# As list of lists, it would be: [[... | |
12,216 | [
0.01573321595788002,
-0.03814977779984474,
0.000036163986806059256,
-0.01893218420445919,
0.014876986853778362,
0.03398755192756653,
-0.005309811793267727,
-0.01850407011806965,
-0.0007885932573117316,
0.049185626208782196,
-0.027613399550318718,
-0.030134519562125206,
0.008574186824262142,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "For", "_fields": {"body": [{"_type": "Assign", "_fields": {"va... | def test_ovr_fit_predict_sparse():
for sparse in [
sp.csr_matrix,
sp.csc_matrix,
sp.coo_matrix,
sp.dok_matrix,
sp.lil_matrix,
]:
base_clf = MultinomialNB(alpha=1)
X, Y = datasets.make_multilabel_classification(
n_samples=100,
n_fea... | |
12,217 | [
-0.006559597793966532,
-0.007126165553927422,
0.041346870362758636,
-0.03411998227238655,
0.006735863164067268,
-0.0029414319433271885,
0.004069846589118242,
-0.0031475997529923916,
0.007403154391795397,
0.06768598407506943,
0.017928728833794594,
-0.04469591751694679,
0.022209463641047478,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ovr_binary():
# Toy dataset where features correspond directly to labels.
X = np.array([[0, 0, 5], [0, 5, 0], [3, 0, 0], [0, 0, 6], [6, 0, 0]])
y = ["eggs", "spam", "spam", "eggs", "spam"]
Y = np.array([[0, 1, 1, 0, 1]]).T
classes = set("eggs spam".split())
def conduct_test(base_clf, ... | |
12,218 | [
-0.009025108069181442,
-0.005554847419261932,
0.024990737438201904,
-0.0385071262717247,
0.01750323921442032,
-0.008769852109253407,
0.008241108618676662,
-0.006484707351773977,
0.001079518347978592,
0.07925078272819519,
0.022109994664788246,
-0.044074129313230515,
0.014646807685494423,
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_ovr_multiclass():
# Toy dataset where features correspond directly to labels.
X = np.array([[0, 0, 5], [0, 5, 0], [3, 0, 0], [0, 0, 6], [6, 0, 0]])
y = ["eggs", "spam", "ham", "eggs", "ham"]
Y = np.array([[0, 0, 1], [0, 1, 0], [1, 0, 0], [0, 0, 1], [1, 0, 0]])
classes = set("ham eggs spam"... | |
12,219 | [
-0.002315969904884696,
-0.008910209871828556,
0.03924599289894104,
0.013336792588233948,
0.0051339236088097095,
0.013918637298047543,
-0.00628049997612834,
-0.029594218358397484,
-0.005827003158628941,
0.07269635796546936,
0.0017227166099473834,
-0.044037654995918274,
0.016291651874780655,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "base_clf", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test_predict_proba", "annotation": null, "type_comment": null... | def conduct_test(base_clf, test_predict_proba=False):
clf = OneVsRestClassifier(base_clf).fit(X, y)
assert set(clf.classes_) == classes
y_pred = clf.predict(np.array([[0, 0, 4]]))[0]
assert_array_equal(y_pred, ["eggs"])
if hasattr(base_clf, "decision_function"):
dec =... | |
12,220 | [
-0.01401066966354847,
-0.005148680415004492,
0.043259747326374054,
-0.02205115742981434,
0.002112433547154069,
-0.013685679994523525,
0.002742853481322527,
-0.00638544699177146,
-0.03091013804078102,
0.06764601916074753,
0.0010216113878414035,
-0.020642869174480438,
0.015960607677698135,
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_ovr_multilabel():
# Toy dataset where features correspond directly to labels.
X = np.array([[0, 4, 5], [0, 5, 0], [3, 3, 3], [4, 0, 6], [6, 0, 0]])
y = np.array([[0, 1, 1], [0, 1, 0], [1, 1, 1], [1, 0, 1], [1, 0, 0]])
for base_clf in (
MultinomialNB(),
LinearSVC(random_state=0)... | |
12,221 | [
-0.003385675372555852,
-0.019318604841828346,
0.03146073594689369,
-0.01601974293589592,
-0.010851523838937283,
-0.009786627255380154,
-0.0014389120042324066,
-0.012616705149412155,
0.00415540998801589,
0.04150780290365219,
-0.026113105937838554,
-0.03900761157274246,
0.0040483418852090836,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ovr_multilabel_predict_proba():
base_clf = MultinomialNB(alpha=1)
for au in (False, True):
X, Y = datasets.make_multilabel_classification(
n_samples=100,
n_features=20,
n_classes=5,
n_labels=3,
length=50,
allow_unlabeled=au... | |
12,222 | [
0.002387160202488303,
0.0009815338999032974,
0.05647572502493858,
-0.016089284792542458,
-0.04621588811278343,
0.002414850052446127,
0.002597020473331213,
0.00909977313131094,
-0.029357116669416428,
0.05904068052768707,
-0.01864258572459221,
-0.04957365244626999,
0.0031333300285041332,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ovr_multilabel_dataset():
base_clf = MultinomialNB(alpha=1)
for au, prec, recall in zip((True, False), (0.51, 0.66), (0.51, 0.80)):
X, Y = datasets.make_multilabel_classification(
n_samples=100,
n_features=20,
n_classes=5,
n_labels=2,
... | |
12,223 | [
0.008081783540546894,
-0.002505352720618248,
0.017962129786610603,
-0.004317141603678465,
0.0000670420631649904,
-0.007200133986771107,
-0.006277341395616531,
-0.01723330095410347,
0.003288551000878215,
0.056989796459674835,
-0.019525587558746338,
-0.041402239352464676,
-0.007970107719302177... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ovr_multilabel_decision_function():
X, Y = datasets.make_multilabel_classification(
n_samples=100,
n_features=20,
n_classes=5,
n_labels=3,
length=50,
allow_unlabeled=True,
random_state=0,
)
X_train, Y_train = X[:80], Y[:80]
X_test = X[80:]... | |
12,224 | [
0.0023160807322710752,
-0.012478917837142944,
0.04321543499827385,
0.010332240723073483,
0.0073941112495958805,
-0.0011146730976179242,
0.012197030708193779,
0.0009317176300100982,
-0.006580975838005543,
0.040244780480861664,
-0.01946103945374489,
-0.022724423557519913,
0.01766130141913891,
... | 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_ovr_single_label_predict_proba():
base_clf = MultinomialNB(alpha=1)
X, Y = iris.data, iris.target
X_train, Y_train = X[:80], Y[:80]
X_test = X[80:]
clf = OneVsRestClassifier(base_clf).fit(X_train, Y_train)
# Decision function only estimator.
decision_only = OneVsRestClassifier(svm.... | |
12,225 | [
0.015915019437670708,
-0.013822793960571289,
0.04001087695360184,
-0.019029850140213966,
-0.018594948574900627,
0.015738708898425102,
0.0018806522712111473,
-0.009179933927953243,
-0.007675412110984325,
0.08157329261302948,
0.029338175430893898,
-0.04259677231311798,
0.029949387535452843,
... | 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_ovr_pipeline():
# Test with pipeline of length one
# This test is needed because the multiclass estimators may fail to detect
# the presence of predict_proba or decision_function.
clf = Pipeline([("tree", DecisionTreeClassifier())])
ovr_pipe = OneVsRestClassifier(clf)
ovr_pipe.fit(iris.... | |
12,226 | [
0.005819242913275957,
-0.054080888628959656,
0.016620192676782608,
0.0039483834989368916,
0.0016410808311775327,
0.010648670606315136,
-0.00944675225764513,
-0.011279541999101639,
0.007010284345597029,
0.03643824905157089,
0.01976367086172104,
-0.013183032162487507,
0.009354297071695328,
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_ovo_fit_on_list():
# Test that OneVsOne fitting works with a list of targets and yields the
# same output as predict from an array
ovo = OneVsOneClassifier(LinearSVC(random_state=0))
prediction_from_array = ovo.fit(iris.data, iris.target).predict(iris.data)
iris_data_list = [list(a) for a i... | |
12,227 | [
0.02225678786635399,
-0.026488449424505234,
0.022793548181653023,
-0.027387209236621857,
-0.005948042497038841,
0.02688789740204811,
0.008856529369950294,
0.004515644162893295,
-0.014904433861374855,
0.03253011405467987,
0.019872577860951424,
-0.032030802220106125,
0.006484801881015301,
-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_ovo_partial_fit_predict():
temp = datasets.load_iris()
X, y = temp.data, temp.target
ovo1 = OneVsOneClassifier(MultinomialNB())
ovo1.partial_fit(X[:100], y[:100], np.unique(y))
ovo1.partial_fit(X[100:], y[100:])
pred1 = ovo1.predict(X)
ovo2 = OneVsOneClassifier(MultinomialNB())
... | |
12,228 | [
0.031326718628406525,
-0.029777469113469124,
0.016096236184239388,
-0.011961109936237335,
0.014615337364375591,
0.002884906018152833,
0.011915544047951698,
-0.002772414591163397,
0.00183830875903368,
0.05723106488585472,
0.009443581104278564,
-0.04048551246523857,
-0.004536678083240986,
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_ovo_fit_predict():
# A classifier which implements decision_function.
ovo = OneVsOneClassifier(LinearSVC(random_state=0))
ovo.fit(iris.data, iris.target).predict(iris.data)
assert len(ovo.estimators_) == n_classes * (n_classes - 1) / 2
# A classifier which implements predict_proba.
ovo... | |
12,229 | [
0.010668661445379257,
0.008182819932699203,
0.02475922927260399,
-0.02094058133661747,
-0.011158390901982784,
0.010216127149760723,
-0.010910427197813988,
-0.020990174263715744,
-0.0009701601229608059,
0.031342681497335434,
0.042054735124111176,
-0.03526051715016365,
-0.03959989175200462,
... | 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_ovo_ties():
# Test that ties are broken using the decision function,
# not defaulting to the smallest label
X = np.array([[1, 2], [2, 1], [-2, 1], [-2, -1]])
y = np.array([2, 0, 1, 2])
multi_clf = OneVsOneClassifier(Perceptron(shuffle=False, max_iter=4, tol=None))
ovo_prediction = multi... | |
12,230 | [
0.032507456839084625,
-0.022444451227784157,
0.02999170497059822,
-0.005281228572130203,
0.038130901753902435,
0.0054816254414618015,
0.0028533432632684708,
-0.02459023892879486,
-0.006338707637041807,
0.06057535111904144,
0.020680958405137062,
-0.0574183315038681,
-0.015131506137549877,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields"... | def test_ovo_decision_function():
n_samples = iris.data.shape[0]
ovo_clf = OneVsOneClassifier(LinearSVC(random_state=0))
# first binary
ovo_clf.fit(iris.data, iris.target == 0)
decisions = ovo_clf.decision_function(iris.data)
assert decisions.shape == (n_samples,)
# then multi-class
ov... | |
12,231 | [
0.016830332577228546,
-0.008825661614537239,
0.03415823355317116,
-0.025998074561357498,
-0.013011476024985313,
0.013011476024985313,
0.021544815972447395,
0.015648601576685905,
-0.010380570776760578,
0.035874854773283005,
0.04876193776726723,
-0.028585441410541534,
-0.013621000573039055,
... | 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_ovo_ties2():
# test that ties can not only be won by the first two labels
X = np.array([[1, 2], [2, 1], [-2, 1], [-2, -1]])
y_ref = np.array([2, 0, 1, 2])
# cycle through labels so that each label wins once
for i in range(3):
y = (y_ref + i) % 3
multi_clf = OneVsOneClassifi... | |
12,232 | [
0.04898228123784065,
-0.006966873072087765,
-0.01734789088368416,
-0.01748647354543209,
-0.027036001905798912,
0.021265970543026924,
0.02746434509754181,
-0.004040912259370089,
0.0016677030362188816,
0.019716376438736916,
0.0413224995136261,
-0.03152100369334221,
-0.016088059172034264,
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": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ovo_string_y():
# Test that the OvO doesn't mess up the encoding of string labels
X = np.eye(4)
y = np.array(["a", "b", "c", "d"])
ovo = OneVsOneClassifier(LinearSVC())
ovo.fit(X, y)
assert_array_equal(y, ovo.predict(X)) | |
12,233 | [
0.010704821906983852,
-0.0041287560015916824,
0.03084186464548111,
-0.02644246444106102,
0.02192789688706398,
0.0017001606756821275,
-0.011988939717411995,
-0.007111595012247562,
0.0119774229824543,
0.017309678718447685,
0.04367152601480484,
-0.0377749502658844,
0.015443965792655945,
0.041... | 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_ovo_one_class():
# Test error for OvO with one class
X = np.eye(4)
y = np.array(["a"] * 4)
ovo = OneVsOneClassifier(LinearSVC())
msg = "when only one class"
with pytest.raises(ValueError, match=msg):
ovo.fit(X, y) | |
12,234 | [
0.004069937858730555,
0.02560275048017502,
0.023390311747789383,
-0.0160312969237566,
-0.000019271939891041256,
0.003845144994556904,
0.018858956173062325,
0.0009368843748234212,
0.010257663205265999,
0.025531763210892677,
0.025555424392223358,
0.004963194951415062,
-0.010689502581954002,
... | 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": "Attribute", "_fields"... | def test_ovo_float_y():
# Test that the OvO errors on float targets
X = iris.data
y = iris.data[:, 0]
ovo = OneVsOneClassifier(LinearSVC())
msg = "Unknown label type"
with pytest.raises(ValueError, match=msg):
ovo.fit(X, y) | |
12,235 | [
0.027597855776548386,
0.03120623156428337,
0.0389704629778862,
-0.01330122072249651,
0.023354902863502502,
0.040463581681251526,
0.03556117042899132,
-0.004473142325878143,
0.03294820711016655,
0.01834050379693508,
0.03197767958045006,
-0.018987523391842842,
-0.031952790915966034,
-0.00531... | 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": "Attribute", "_fields"... | def test_ecoc_float_y():
# Test that the OCC errors on float targets
X = iris.data
y = iris.data[:, 0]
ovo = OutputCodeClassifier(LinearSVC())
msg = "Unknown label type"
with pytest.raises(ValueError, match=msg):
ovo.fit(X, y)
ovo = OutputCodeClassifier(LinearSVC(), code_size=-1)
... | |
12,236 | [
0.055766619741916656,
-0.020530598238110542,
0.019356442615389824,
-0.010219700634479523,
0.02384786866605282,
0.0339706726372242,
0.020804187282919884,
0.005557282827794552,
0.024987824261188507,
0.02574019320309162,
-0.00859526451677084,
-0.04787812754511833,
-0.02765531837940216,
0.0075... | 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_ecoc_fit_predict():
# A classifier which implements decision_function.
ecoc = OutputCodeClassifier(LinearSVC(random_state=0), code_size=2, random_state=0)
ecoc.fit(iris.data, iris.target).predict(iris.data)
assert len(ecoc.estimators_) == n_classes * 2
# A classifier which implements predi... | |
12,237 | [
0.0401332825422287,
-0.020910507068037987,
0.022275583818554878,
-0.002567276591435075,
0.001192891621030867,
0.04082822799682617,
0.010759293101727962,
-0.009934041649103165,
0.017783237621188164,
0.023789579048752785,
-0.01025049202144146,
-0.02136966958642006,
0.01779564842581749,
0.001... | 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": "Tuple", "_fields": {"... | def test_ecoc_delegate_sparse_base_estimator():
# Non-regression test for
# https://github.com/scikit-learn/scikit-learn/issues/17218
X, y = iris.data, iris.target
X_sp = sp.csc_matrix(X)
# create an estimator that does not support sparse input
base_estimator = CheckingClassifier(
check... | |
12,238 | [
-0.010483958758413792,
-0.01705465465784073,
0.027987124398350716,
-0.0037899231538176537,
0.0045271641574800014,
0.011952834203839302,
0.024421457201242447,
-0.0038403805810958147,
-0.023031070828437805,
0.03433356434106827,
-0.006957536563277245,
-0.059652045369148254,
0.020317576825618744... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_pairwise_indices():
clf_precomputed = svm.SVC(kernel="precomputed")
X, y = iris.data, iris.target
ovr_false = OneVsOneClassifier(clf_precomputed)
linear_kernel = np.dot(X, X.T)
ovr_false.fit(linear_kernel, y)
n_estimators = len(ovr_false.estimators_)
precomputed_indices = ovr_fals... | |
12,239 | [
-0.008172761648893356,
-0.018172236159443855,
-0.005815234035253525,
-0.02052086777985096,
-0.017555423080921173,
0.02619079500436783,
0.05242903530597687,
-0.028254743665456772,
-0.005385244730859995,
0.02545536495745182,
-0.014317159540951252,
-0.07700663059949875,
0.015111899003386497,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "MultiClassClassifier", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "... | def test_pairwise_tag(MultiClassClassifier):
clf_precomputed = svm.SVC(kernel="precomputed")
clf_notprecomputed = svm.SVC()
ovr_false = MultiClassClassifier(clf_notprecomputed)
assert not ovr_false._get_tags()["pairwise"]
ovr_true = MultiClassClassifier(clf_precomputed)
assert ovr_true._get_ta... | |
12,240 | [
0.020743872970342636,
0.007488723378628492,
0.012437603436410427,
-0.00016955568571574986,
0.007379717659205198,
0.013080740347504616,
0.044256504625082016,
-0.016176514327526093,
-0.00703089777380228,
0.023240115493535995,
-0.038762591779232025,
-0.0658833235502243,
0.009129266254603863,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "MultiClassClassifier", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "... | def test_pairwise_cross_val_score(MultiClassClassifier):
clf_precomputed = svm.SVC(kernel="precomputed")
clf_notprecomputed = svm.SVC(kernel="linear")
X, y = iris.data, iris.target
multiclass_clf_notprecomputed = MultiClassClassifier(clf_notprecomputed)
multiclass_clf_precomputed = MultiClassClass... | |
12,241 | [
0.04334929957985878,
0.03196294605731964,
0.04069964587688446,
-0.02621009387075901,
-0.005514145363122225,
-0.0021811905317008495,
0.02243851311504841,
-0.030268123373389244,
-0.005821481347084045,
0.036188069730997086,
0.04714474827051163,
-0.025899773463606834,
-0.00379545078612864,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "MultiClassClassifier", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "... | def test_support_missing_values(MultiClassClassifier):
# smoke test to check that pipeline OvR and OvO classifiers are letting
# the validation of missing values to
# the underlying pipeline or classifiers
rng = np.random.RandomState(42)
X, y = iris.data, iris.target
X = np.copy(X) # Copy to av... | |
12,242 | [
-0.027503956109285355,
0.023774605244398117,
0.026380913332104683,
-0.04339607059955597,
0.04576929658651352,
-0.06941676139831543,
0.023075353354215622,
-0.025978313758969307,
0.0031280983239412308,
-0.0024672511499375105,
-0.047422073781490326,
-0.008179142139852047,
-0.02977123111486435,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "use_minified", "annotation": null, "type_comment": null}}, {"... | def bootstrap_find_resource(filename,
use_minified=None,
cdn='bootstrap'):
# FIXME: get rid of this function and instead manipulate the flask routing
# system
config = current_app.config
if None == use_minified:
use_minified = confi... | |
12,243 | [
-0.014829814434051514,
-0.00035974866477772593,
0.05655437707901001,
-0.005422936286777258,
0.003418397856876254,
-0.07057986408472061,
-0.00936289131641388,
-0.029760170727968216,
-0.02316216006875038,
0.038331300020217896,
-0.009890732355415821,
-0.027699077501893044,
-0.04207645729184151,... | 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": "app", "annotation": null, "type_comment": null}}], "kwarg": null,... | def init_app(self, app):
app.config.setdefault('BOOTSTRAP_USE_MINIFIED', True)
app.config.setdefault('BOOTSTRAP_JQUERY_VERSION', '1')
app.config.setdefault('BOOTSTRAP_HTML5_SHIM', True)
app.config.setdefault('BOOTSTRAP_GOOGLE_ANALYTICS_ACCOUNT', None)
app.config.setdefault('BOOTS... | |
12,244 | [
-0.01839223876595497,
0.015034559182822704,
0.017157627269625664,
0.0011906204745173454,
0.0015836479142308235,
-0.0802612379193306,
-0.004202868789434433,
-0.047307513654232025,
-0.03140757605433464,
0.02605374902486801,
-0.03620755672454834,
-0.022649914026260376,
-0.02986142598092556,
-... | 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": "app", "annotation": nu... | class Bootstrap(object):
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
app.config.setdefault('BOOTSTRAP_USE_MINIFIED', True)
app.config.setdefault('BOOTSTRAP_JQUERY_VERSION', '1')
app.config.setdefault('BOOTSTRAP_HTML5_... | |
12,245 | [
0.027150707319378853,
0.014091615565121174,
-0.009040458127856255,
0.01601586677134037,
0.004605294670909643,
-0.00023668135690968484,
0.01802225038409233,
0.03548130393028259,
0.009304455481469631,
0.02094382420182228,
0.0021427820902317762,
-0.011211106553673744,
0.06082509085536003,
0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_as_crispy_errors_form_without_non_field_errors(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{{ form|as_crispy_errors }}
"""
)
form = TestForm({"password1": "god", "password2": "god"})
form.is_valid()
... | |
12,246 | [
0.004065971355885267,
0.010156968608498573,
-0.0042188032530248165,
-0.008985255844891071,
0.0019231375772505999,
0.00011004709085682407,
-0.0031696746591478586,
0.013754891231656075,
0.0034387228079140186,
0.02049224078655243,
0.015206796117126942,
-0.03420892357826233,
0.027255062013864517... | 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 TestBasicFunctionalityTags(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_as_crispy_errors_form_without_non_field_errors(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{{ form|as_crispy_err... | |
12,247 | [
0.02325587533414364,
-0.008860797621309757,
-0.017257429659366608,
-0.004605948459357023,
0.008961961604654789,
0.019542552530765533,
-0.002508278237655759,
0.040489502251148224,
0.005843722727149725,
0.038942284882068634,
0.021744361147284508,
-0.03253918141126633,
0.07102920114994049,
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_crispy_filter_with_form(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{{ form|crispy }}
"""
)
c = Context({"form": TestForm()})
html = template.render(c)
self.assertTrue("<td>" not in html)
... | |
12,248 | [
0.025002459064126015,
0.02215193584561348,
0.004478097427636385,
0.014131824485957623,
-0.0006039240979589522,
0.007591326255351305,
0.015810733661055565,
0.038433730602264404,
-0.010284828022122383,
0.029133299365639687,
-0.0006903607281856239,
-0.028456903994083405,
0.05749357491731644,
... | 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_as_crispy_errors_form_with_non_field_errors(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{{ form|as_crispy_errors }}
"""
)
form = TestForm({"password1": "god", "password2": "wargame"})
form.is_valid()
... | |
12,249 | [
0.0006170088308863342,
-0.013420871458947659,
-0.024388594552874565,
-0.013289878144860268,
-0.001753525692038238,
0.016898151487112045,
0.008520526811480522,
0.0324387364089489,
0.013861485756933689,
0.03043810836970806,
0.027103731408715248,
-0.05735130235552788,
0.048681922256946564,
-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_crispy_filter_with_formset(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{{ testFormset|crispy }}
"""
)
TestFormset = formset_factory(TestForm, extra=4)
testFormset = TestFormset()
c = Context(... | |
12,250 | [
0.007200862746685743,
0.0019209005404263735,
-0.01499940361827612,
-0.03606753051280975,
0.018160197883844376,
0.011861597187817097,
-0.010763939470052719,
0.026987431570887566,
0.00001803762643248774,
0.02471166104078293,
0.021183066070079803,
-0.03225158900022507,
0.051032453775405884,
-... | 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_classes_filter(self):
template = get_template_from_string(
u"""
{% load crispy_forms_field %}
{{ testField|classes }}
"""
)
test_form = TestForm()
test_form.fields["email"].widget.attrs.update({"class": "email-fields"})
c = Co... | |
12,251 | [
0.021498514339327812,
-0.0012887819902971387,
0.03466854989528656,
-0.012016089633107185,
0.008014907129108906,
-0.0247847530990839,
0.03399123251438141,
0.03534586727619171,
0.013834808953106403,
0.014336524531245232,
0.00677943229675293,
-0.017271561548113823,
0.027820132672786713,
-0.01... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_inputs(self):
form_helper = FormHelper()
submit = Submit("my-submit", "Submit", css_class="button white")
reset = Reset("my-reset", "Reset")
hidden = Hidden("my-hidden", "Hidden")
button = Button("my-button", "Button")
form_helper.add_input(submit)
form_h... | |
12,252 | [
0.002907327376306057,
-0.0003032049862667918,
0.01633983664214611,
-0.008507724851369858,
0.021019086241722107,
0.011998394504189491,
0.023371221497654915,
0.016039563342928886,
0.023108482360839844,
0.0305777657777071,
0.01740330271422863,
-0.019405119121074677,
0.011923326179385185,
0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "crispy_forms.tests.urls"}}, "targets": [{"_type": "Name", "_fields": {"id": "urls", "ctx": {"_type": "Store", "_fields": {}}}}], "type_co... | class TestFormHelpers(TestCase):
urls = "crispy_forms.tests.urls"
def setUp(self):
pass
def tearDown(self):
pass
def test_inputs(self):
form_helper = FormHelper()
submit = Submit("my-submit", "Submit", css_class="button white")
reset = Reset("my-reset", "Reset"... | |
12,253 | [
0.04194851592183113,
0.022694703191518784,
0.028286151587963104,
0.01749541610479355,
-0.004044944886118174,
-0.015357508324086666,
0.012979244813323021,
0.039975062012672424,
-0.0050949230790138245,
0.03476312384009361,
0.00028324892628006637,
-0.012308777309954166,
0.04230272397398949,
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_form_show_errors_non_field_errors(self):
form = TestForm({"password1": "wargame", "password2": "god"})
form.helper = FormHelper()
form.helper.form_show_errors = True
form.is_valid()
template = get_template_from_string(
u"""
{% load crispy_forms_t... | |
12,254 | [
0.015715384855866432,
0.005487912334501743,
0.034713014960289,
-0.0014474696945399046,
0.01543967705219984,
-0.016030481085181236,
0.021150780841708183,
0.014717582613229752,
0.004582013003528118,
0.044323425740003586,
-0.0016427632654085755,
-0.028831232339143753,
0.02888374961912632,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_form_with_helper_without_layout(self):
form_helper = FormHelper()
form_helper.form_id = "this-form-rocks"
form_helper.form_class = "forms-that-rock"
form_helper.form_method = "GET"
form_helper.form_action = "simpleAction"
form_helper.form_error_title = "ERRORS"
... | |
12,255 | [
-0.008890458382666111,
0.02662946656346321,
0.04190788418054581,
-0.016787100583314896,
0.04023156687617302,
-0.003220920218154788,
0.01719420589506626,
0.0047745052725076675,
0.02128920517861843,
0.033885516226291656,
0.03017367608845234,
-0.01834367960691452,
0.012201180681586266,
-0.004... | 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_html5_required(self):
form = TestForm()
form.helper = FormHelper()
form.helper.html5_required = True
html = render_crispy_form(form)
# 6 out of 7 fields are required and an extra one for the SplitDateTimeWidget makes 7.
self.assertEqual(html.count('required="requ... | |
12,256 | [
0.03151487186551094,
0.02653089165687561,
0.033176202327013016,
0.030734553933143616,
-0.005043764133006334,
-0.01490160170942545,
0.027588101103901863,
0.011264301836490631,
0.007815789431333542,
0.04347139596939087,
0.004187928978353739,
-0.019054919481277466,
0.03393134847283363,
0.0166... | 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_form_show_errors(self):
form = TestForm(
{
"email": "invalidemail",
"first_name": "first_name_too_long",
"last_name": "last_name_too_long",
"password1": "yes",
"password2": "yes",
}
)
... | |
12,257 | [
-0.004134829621762037,
-0.0028001137543469667,
0.014272211119532585,
-0.012968329712748528,
-0.0032009691931307316,
-0.009720373898744583,
0.019640441983938217,
0.027064340189099312,
0.02001633495092392,
0.022342177107930183,
0.0001255425886483863,
0.017291106283664703,
0.04383859410881996,
... | 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_template_context(self):
helper = FormHelper()
helper.attrs = {
"id": "test-form",
"class": "test-forms",
"action": "submit/test/form",
"autocomplete": "off",
}
node = CrispyFormNode("form", "helper")
context = node.get_resp... | |
12,258 | [
0.020313424989581108,
0.008241642266511917,
0.012561949901282787,
-0.008617816492915154,
0.005252194590866566,
-0.018968315795063972,
0.009615249000489712,
-0.0005464504938572645,
0.0222626943141222,
-0.006805339362472296,
0.007643182761967182,
-0.011148445308208466,
0.07117678225040436,
-... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_attrs(self):
form = TestForm()
form.helper = FormHelper()
form.helper.attrs = {"id": "TestIdForm", "autocomplete": "off"}
html = render_crispy_form(form)
self.assertTrue('autocomplete="off"' in html)
self.assertTrue('id="TestIdForm"' in html) | |
12,259 | [
0.020265523344278336,
0.003999477252364159,
0.013378632254898548,
-0.03192807734012604,
0.015117289498448372,
-0.0025755278766155243,
0.0263056643307209,
0.01171900425106287,
0.02558310516178608,
0.013175412081182003,
0.0003349950129631907,
0.014880199916660786,
0.0570821650326252,
-0.0069... | 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_template_context_using_form_attrs(self):
helper = FormHelper()
helper.form_id = "test-form"
helper.form_class = "test-forms"
helper.form_action = "submit/test/form"
node = CrispyFormNode("form", "helper")
context = node.get_response_dict(helper, {}, False)
... | |
12,260 | [
-0.004438732750713825,
0.0036375506315380335,
0.0026782809291034937,
-0.011345474980771542,
0.0017481731483712792,
0.007778526283800602,
0.022396260872483253,
0.017251506447792053,
0.025637825950980186,
0.026472773402929306,
0.0007716365507803857,
-0.032145511358976364,
0.038112934678792953,... | 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_without_helper(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form %}
"""
)
c = Context({"form": TestForm()})
html = template.render(c)
# Lets make sure everything loads right
s... | |
12,261 | [
0.019062159582972527,
0.01672222837805748,
0.0038792025297880173,
-0.008745193481445312,
-0.0016530188731849194,
0.010470597073435783,
0.011711468920111656,
0.018731260672211647,
-0.006103909108787775,
0.03039545752108097,
-0.016084065660834312,
-0.032853566110134125,
0.029071860015392303,
... | 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_invalid_helper(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
"""
)
c = Context({"form": TestForm(), "form_helper": "invalid"})
settings.CRISPY_FAIL_SILENTLY = False
... | |
12,262 | [
0.008586938492953777,
-0.033328015357255936,
0.016203882172703743,
-0.02554318867623806,
-0.002550899051129818,
0.009712380357086658,
0.027682149782776833,
0.006239675916731358,
0.025941135361790657,
0.01983514428138733,
-0.0022975190076977015,
-0.0553145557641983,
0.025816775858402252,
-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_formset_with_helper_without_layout(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy testFormSet formset_helper %}
"""
)
form_helper = FormHelper()
form_helper.form_id = "thisFormsetRocks"
... | |
12,263 | [
0.018796885386109352,
-0.024591239169239998,
0.00030130642699077725,
0.003612780012190342,
0.009833019226789474,
-0.009607039391994476,
0.013477668166160583,
0.07704173773527145,
0.010980301536619663,
0.013408135622739792,
-0.001045880955643952,
-0.00843078549951315,
0.03954067453742027,
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_CSRF_token_GET_form(self):
form_helper = FormHelper()
form_helper.form_method = "GET"
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
"""
)
c = Context(
{
... | |
12,264 | [
0.00969573576003313,
-0.025514481589198112,
0.0032444987446069717,
0.02909301593899727,
-0.0004858034080825746,
-0.018310939893126488,
0.022946767508983612,
0.07124535739421844,
0.030417539179325104,
0.014592982828617096,
-0.0039387112483382225,
-0.017311738803982735,
0.0023513175547122955,
... | 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_CSRF_token_POST_form(self):
form_helper = FormHelper()
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
"""
)
# The middleware only initializes the CSRF token when processing a real ... | |
12,265 | [
0.028335604816675186,
0.02935558743774891,
0.009148743003606796,
-0.0033802459947764874,
-0.02985313907265663,
-0.03059946745634079,
0.036918383091688156,
0.03467939794063568,
0.0021037133410573006,
0.03793836385011673,
-0.03236578032374382,
-0.007432187907397747,
-0.009148743003606796,
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_invalid_unicode_characters(self):
# Adds a BooleanField that uses non valid unicode characters "ñ"
form_helper = FormHelper()
form_helper.add_layout(Layout("españa"))
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% c... | |
12,266 | [
0.007504085078835487,
0.005460209213197231,
0.05105410888791084,
-0.01987924426794052,
0.009373524226248264,
0.008932494558393955,
0.015561102889478207,
-0.007912201806902885,
0.011815642938017845,
0.04312874376773834,
0.004311557859182358,
-0.011927546001970768,
0.022854547947645187,
0.02... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "crispy_forms.tests.urls"}}, "targets": [{"_type": "Name", "_fields": {"id": "urls", "ctx": {"_type": "Store", "_fields": {}}}}], "type_co... | class TestFormLayout(TestCase):
urls = "crispy_forms.tests.urls"
def test_invalid_unicode_characters(self):
# Adds a BooleanField that uses non valid unicode characters "ñ"
form_helper = FormHelper()
form_helper.add_layout(Layout("españa"))
template = get_template_from_string(
... | |
12,267 | [
0.04921744018793106,
0.05423678085207939,
0.05544514209032059,
-0.02656068652868271,
0.0204026959836483,
-0.0003569164837244898,
0.029604824259877205,
0.012234646826982498,
-0.013803191483020782,
0.01481403037905693,
0.009010416455566883,
-0.04608035087585449,
0.032741911709308624,
-0.0122... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_meta_extra_fields_with_missing_fields(self):
form = FormWithMeta()
# We remove email field on the go
del form.fields["email"]
form_helper = FormHelper()
form_helper.layout = Layout("first_name")
template = get_template_from_string(
u"""
... | |
12,268 | [
0.002672584028914571,
0.025641854852437973,
0.021293453872203827,
-0.01685783639550209,
0.00048553498345427215,
-0.011356924660503864,
0.011736942455172539,
-0.015412523411214352,
-0.023685697466135025,
-0.0029575973749160767,
-0.034513089805841446,
0.01120740920305252,
0.03894870728254318,
... | 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_layout_unresolved_field(self):
form_helper = FormHelper()
form_helper.add_layout(Layout("typo"))
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
"""
)
c = Context({"form": T... | |
12,269 | [
0.04048651456832886,
-0.018953556194901466,
0.0193961001932621,
-0.005373756401240826,
0.0066571361385285854,
0.02077431045472622,
0.03171148523688316,
0.02612277865409851,
0.03993017226457596,
0.043116495013237,
0.025187114253640175,
-0.051891524344682693,
0.0387922003865242,
0.0074410722... | 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_context_pollution(self):
form = ExampleForm()
form2 = TestForm()
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{{ form.as_ul }}
{% crispy form2 %}
{{ form.as_ul }}
"""
)
c = Con... | |
12,270 | [
0.05181777477264404,
0.0007099477224983275,
0.03400701656937599,
-0.0023400646168738604,
-0.00028890426619909704,
0.0110388258472085,
0.03141868859529495,
0.015837479382753372,
-0.010071407072246075,
-0.008527381345629692,
-0.007854672148823738,
-0.029752936214208603,
0.0448216050863266,
-... | 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_double_rendered_field(self):
form_helper = FormHelper()
form_helper.add_layout(Layout("is_company", "is_company"))
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
"""
)
c = ... | |
12,271 | [
0.01033051684498787,
-0.003484381129965186,
0.06608659774065018,
-0.000036685076338471845,
0.018280290067195892,
-0.022491455078125,
0.02792290411889553,
0.03545993193984032,
-0.0015343240229412913,
0.0193689726293087,
0.002552720485255122,
0.003651870647445321,
0.010276680812239647,
0.021... | 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_second_layout_multifield_column_buttonholder_submit_div(self):
form_helper = FormHelper()
form_helper.add_layout(
Layout(
MultiField(
"Some company data",
"is_company",
"email",
css_id="m... | |
12,272 | [
0.01702031120657921,
-0.027178579941391945,
0.057347048074007034,
-0.010011226870119572,
-0.0083508575335145,
-0.014496060088276863,
0.01483916211873293,
0.001066066906787455,
0.003718980588018894,
0.02012048289179802,
-0.01363830454647541,
-0.02225261554121971,
0.0315408781170845,
-0.0039... | 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_layout_fieldset_row_html_with_unicode_fieldnames(self):
form_helper = FormHelper()
form_helper.add_layout(
Layout(
Fieldset(
u"Company Data",
u"is_company",
css_id="fieldset_company_data",
... | |
12,273 | [
0.0160279031842947,
0.00819846335798502,
0.0564851351082325,
0.002006563125178218,
0.017417889088392258,
-0.003951622173190117,
0.02976786158978939,
0.011390512809157372,
-0.0045359088107943535,
0.04044492915272713,
-0.022018376737833023,
-0.0038870431017130613,
0.03732053562998772,
0.0121... | 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_layout_within_layout(self):
form_helper = FormHelper()
form_helper.add_layout(
Layout(
Layout(
MultiField(
"Some company data",
"is_company",
"email",
... | |
12,274 | [
0.044077515602111816,
0.021099166944622993,
0.013725162483751774,
-0.02241935208439827,
-0.016710445284843445,
0.013451610691845417,
0.015295112505555153,
0.005343179684132338,
-0.0033183018676936626,
-0.002356410725042224,
0.0030269098933786154,
-0.02221716195344925,
0.04976263642311096,
... | 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_change_layout_dynamically_delete_field(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
"""
)
form = TestForm()
form_helper = FormHelper()
form_helper.add_layout(
... | |
12,275 | [
0.010762267746031284,
-0.034600187093019485,
0.005161110777407885,
-0.02657877840101719,
0.008279151283204556,
-0.003988702781498432,
0.01806703209877014,
-0.006883576512336731,
0.01006448082625866,
0.015225591138005257,
-0.008826064877212048,
-0.049410879611968994,
0.03331776708364487,
-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_formset_layout(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy testFormSet formset_helper %}
"""
)
form_helper = FormHelper()
form_helper.form_id = "thisFormsetRocks"
form_helper.form_cl... | |
12,276 | [
0.01925414800643921,
0.007400483824312687,
0.04736778512597084,
-0.019066646695137024,
-0.015175972133874893,
-0.009539182297885418,
0.0228518508374691,
0.0006848230841569602,
-0.013441575691103935,
0.03637545928359032,
-0.011929837986826897,
-0.021820588037371635,
0.04516463354229927,
-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_multiwidget_field(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form %}
"""
)
test_form = TestForm()
test_form.helper = FormHelper()
test_form.helper.layout = Layout(
Multi... | |
12,277 | [
0.008807404898107052,
-0.0061421701684594154,
0.0200778990983963,
-0.039583563804626465,
0.025700705125927925,
-0.01143221091479063,
0.003669752273708582,
-0.016619624570012093,
-0.020413774996995926,
-0.011245613917708397,
-0.015960311517119408,
-0.020214736461639404,
0.05483480542898178,
... | 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 TestLayoutObjects(TestCase):
def test_field_type_hidden(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy test_form %}
"""
)
test_form = TestForm()
test_form.helper = FormHelper()
test_fo... | |
12,278 | [
0.02192007564008236,
-0.0016115937614813447,
0.007004580460488796,
-0.028522508218884468,
0.025713473558425903,
-0.005170905031263828,
0.028354445472359657,
0.007298688869923353,
-0.008805244229733944,
0.012268519960343838,
-0.02097172662615776,
-0.005867161322385073,
0.02205212414264679,
... | 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_i18n(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy form form.helper %}
"""
)
form = TestForm()
form_helper = FormHelper()
form_helper.layout = Layout(
HTML(_("i18n text")), ... | |
12,279 | [
0.01948689855635166,
0.008925480768084526,
0.0011886106804013252,
-0.023360220715403557,
0.015649665147066116,
0.0005589702632278204,
0.020894287154078484,
0.017189370468258858,
-0.00829396117478609,
-0.028989769518375397,
-0.0013622785918414593,
-0.011421488597989082,
0.07684093713760376,
... | 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_field_type_hidden(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy test_form %}
"""
)
test_form = TestForm()
test_form.helper = FormHelper()
test_form.helper.layout = Layout(
... | |
12,280 | [
0.040722355246543884,
-0.00635969452559948,
0.03132879361510277,
-0.010650266893208027,
-0.028891546651721,
-0.015677090734243393,
0.026200419291853905,
0.011411907151341438,
0.010307529009878635,
0.01504239160567522,
-0.013798379339277744,
-0.027393653988838196,
0.03117646649479866,
-0.00... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_appended_prepended_text(self):
template = get_template_from_string(
u"""
{% load crispy_forms_tags %}
{% crispy test_form %}
"""
)
test_form = TestForm()
test_form.helper = FormHelper()
test_form.helper.layout = Layout(
... | |
12,281 | [
0.013676934875547886,
0.009867018088698387,
0.04017069563269615,
-0.016099775210022926,
-0.003603975288569927,
-0.011175352148711681,
-0.012647227384150028,
-0.02185402251780033,
-0.004727567546069622,
0.023489439859986305,
-0.015881719067692757,
-0.013628478161990643,
0.020012663677334785,
... | 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 TestDynamicLayouts(TestCase):
def test_wrap_all_fields(self):
helper = FormHelper()
layout = Layout("email", "password1", "password2")
helper.layout = layout
helper.all().wrap(Field, css_class="test-class")
for field in layout.fields:
self.assertTrue(isinst... | |
12,282 | [
0.029675975441932678,
-0.002699385629966855,
0.06460107862949371,
-0.0034504940267652273,
0.0009583106730133295,
-0.03140266239643097,
0.0026662908494472504,
-0.001720930333249271,
0.002431749366223812,
0.03059687465429306,
-0.0041037569753825665,
0.015793420374393463,
0.0219749566167593,
... | 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_wrap_all_fields(self):
helper = FormHelper()
layout = Layout("email", "password1", "password2")
helper.layout = layout
helper.all().wrap(Field, css_class="test-class")
for field in layout.fields:
self.assertTrue(isinstance(field, Field))
self.ass... | |
12,283 | [
0.033154506236314774,
-0.0027481901925057173,
0.07802490144968033,
-0.02011389657855034,
0.016686635091900826,
-0.02950848452746868,
-0.0029426447581499815,
-0.01432887278497219,
-0.020600032061338425,
0.017427992075681686,
-0.022544579580426216,
0.004095699638128281,
0.013721201568841934,
... | 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_wrap_selected_fields(self):
helper = FormHelper()
layout = Layout("email", "password1", "password2")
helper.layout = layout
helper[1:3].wrap(Field, css_class="test-class")
self.assertFalse(isinstance(layout.fields[0], Field))
self.assertTrue(isinstance(layout.fi... | |
12,284 | [
0.020523490384221077,
0.024063345044851303,
0.04401176795363426,
-0.007533373311161995,
0.01527121476829052,
-0.02060016617178917,
0.00830012932419777,
0.01171858049929142,
-0.01714976504445076,
0.05134706199169159,
0.010830421932041645,
0.005868874955922365,
0.007335294969379902,
0.022798... | 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_wrap_filtered_fields(self):
helper = FormHelper()
layout = Layout("email", Div("password1"), "password2")
helper.layout = layout
helper.filter(basestring).wrap(Field, css_class="test-class")
self.assertTrue(isinstance(layout.fields[0], Field))
self.assertTrue(is... | |
12,285 | [
0.034759312868118286,
-0.0052507235668599606,
0.07317750155925751,
-0.04763665422797203,
0.004912158939987421,
-0.015075040981173515,
-0.006741596385836601,
-0.0562136285007,
-0.020777184516191483,
0.013994010165333748,
-0.009265982545912266,
-0.004027138464152813,
0.0015963030746206641,
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_get_field_names(self):
layout_1 = Div("field_name")
self.assertEqual(layout_1.get_field_names(), [[0], "field_name"])
layout_2 = Div(Div("field_name"))
self.assertEqual(layout_2.get_field_names(), [[0, 0], "field_name"])
layout_3 = Div(Div("field_name"), "password")
... | |
12,286 | [
0.03852936252951622,
-0.0174995306879282,
0.0741596668958664,
-0.06485464423894882,
0.0063475253991782665,
-0.01968551054596901,
-0.01586296781897545,
-0.03628493472933769,
-0.031164830550551414,
0.005839021876454353,
-0.021333763375878334,
0.017429392784833908,
0.009205665439367294,
0.015... | 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_layout_get_field_names(self):
layout_1 = Layout(Div("field_name"), "password")
self.assertEqual(
layout_1.get_field_names(), [[[0, 0], "field_name"], [[1], "password"]]
)
layout_2 = Layout(
Div("field_name"), "password", Fieldset("legend", "extra_field")... | |
12,287 | [
0.01454832125455141,
-0.014703530818223953,
-0.0190700963139534,
0.03164208307862282,
0.00934362318366766,
-0.04734930023550987,
0.04813569784164429,
0.038492001593112946,
0.04267231747508049,
0.005877273622900248,
-0.03348390385508537,
0.035532671958208084,
-0.021398242563009262,
-0.03309... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": {"_type": "Name", "_fields": {"id": "HttpRequest", "ctx": {"_type": "Load", "_fields": {}}}}, "type_comment": null}}, {"_type": "... | def api_wekan_webhook(
request: HttpRequest,
user_profile: UserProfile,
payload: Dict[str, Any] = REQ(argument_type="body"),
) -> HttpResponse:
topic = "Wekan Notification"
body = get_message_body(payload, payload["description"])
check_send_webhook_message(request, user_profile, topic, body)
... | |
12,288 | [
0.005717935971915722,
0.011225699447095394,
0.039339400827884674,
-0.008765441365540028,
0.011621318757534027,
-0.036026086658239365,
-0.005118325352668762,
-0.014724458567798138,
0.0018730104202404618,
-0.0032360428012907505,
-0.028583498671650887,
-0.015070625580847263,
0.04710343107581138... | 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_getitem_layout_object(self):
layout = Layout(Div(Div(Div("email")), Div("password1"), "password2"))
self.assertTrue(isinstance(layout[0], Div))
self.assertTrue(isinstance(layout[0][0], Div))
self.assertTrue(isinstance(layout[0][0][0], Div))
self.assertTrue(isinstance(lay... | |
12,289 | [
0.014432748779654503,
0.06971454620361328,
0.04240166395902634,
0.00950702652335167,
0.06140478327870369,
-0.01971382275223732,
0.03483540564775467,
-0.01963728480041027,
-0.011983554810285568,
0.016871009021997452,
-0.027837710455060005,
-0.008648714981973171,
0.04176750034093857,
0.02709... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "res.users.login"}}, "targets": [{"_type": "Name", "_fields": {"id": "_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment":... | class ResUsersLogin(orm.Model):
_name = 'res.users.login'
_columns = {
'user_id': fields.many2one('res.users', 'User', required=True),
'login_dt': fields.date('Latest connection'),
}
_sql_constraints = [
('user_id_unique',
'unique(user_id)',
'The user can only... | |
12,290 | [
0.04735283926129341,
0.0014726892113685608,
-0.00761999748647213,
0.005856738891452551,
0.006576783489435911,
0.001479776226915419,
-0.024742312729358673,
0.006060846149921417,
0.04093480855226517,
0.012178388424217701,
0.035310521721839905,
-0.03828141465783119,
0.05102676898241043,
-0.02... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tag", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def handle_starttag(self, tag, raw_attrs):
attrs = dict(raw_attrs)
if tag == 'a':
# Handle special cases for href's that: start with a space, contain
# just a '.' (period), contain python templating code, are an absolute
# url, are a zip file, or execute javascript on the page.
href = a... | |
12,291 | [
0.012265658937394619,
0.050475187599658966,
0.05028684809803963,
-0.0034578093327581882,
0.06403568387031555,
-0.022365404292941093,
0.0047026206739246845,
0.0024337091017514467,
-0.015043677762150764,
0.01284245029091835,
-0.006827333942055702,
-0.008428226225078106,
0.04381265118718147,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "res.users"}}, "targets": [{"_type": "Name", "_fields": {"id": "_inherit", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": nu... | class ResUsers(orm.Model):
_inherit = 'res.users'
# Function to retrieve the login date from the res.users object
# (used in some functions, and the user state)
def _get_login_date(self, cr, uid, ids, name, args, context=None):
res = {}
user_login_obj = self.pool['res.users.login']
... | |
12,292 | [
0.01251798402518034,
0.026563040912151337,
0.05296533554792404,
-0.0029612164944410324,
0.046816855669021606,
0.0056561995297670364,
0.05107658728957176,
-0.018093811348080635,
-0.030521376058459282,
0.015331014059484005,
-0.008564671501517296,
0.015471665188670158,
-0.013150915503501892,
... | 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def cron_sync_login_date(self, cr, uid, context=None):
# Simple SQL query to update the original login_date column.
try:
cr.execute("UPDATE res_users SET login_date = "
"(SELECT login_dt FROM res_users_login "
"WHERE res_users_login.user_id = res... | |
12,293 | [
-0.015516499988734722,
0.020677324384450912,
0.02840154804289341,
-0.008591922000050545,
0.03983475640416145,
-0.030329767614603043,
0.0015156377339735627,
-0.004301632288843393,
0.017342638224363327,
0.015459788031876087,
0.0156866367906332,
-0.028015904128551483,
0.01994006335735321,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def _get_login_date(self, cr, uid, ids, name, args, context=None):
res = {}
user_login_obj = self.pool['res.users.login']
for user_id in ids:
login_ids = user_login_obj.search(
cr, uid, [('user_id', '=', user_id)], limit=1,
context=context)
... | |
12,294 | [
0.01674777641892433,
0.03260352835059166,
0.04785716161131859,
0.0021757057402282953,
0.040854763239622116,
0.020427381619811058,
0.03735356405377388,
0.04941820725798607,
-0.007905574515461922,
0.04078786075115204,
0.004822512157261372,
-0.0024307691492140293,
0.03405306860804558,
0.02228... | 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": "db", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def _login(self, db, login, password):
if not password:
return False
user_id = False
cr = self.pool.cursor()
try:
# check if user exists
res = self.search(cr, SUPERUSER_ID, [('login', '=', login)])
if res:
user_id = res[0]
... | |
12,295 | [
0.06275279819965363,
0.0532703772187233,
0.08693049848079681,
-0.022477317601442337,
-0.013702351599931717,
0.015824727714061737,
0.025257505476474762,
0.0017701974138617516,
0.015725435689091682,
0.038326866924762726,
0.014521514065563679,
0.00743451900780201,
0.03040829859673977,
-0.0443... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def main_run(args):
with common.temporary_file() as tempfile_path:
rc = common.run_command([
os.path.join(common.SRC_DIR, 'tools', 'checkperms', 'checkperms.py'),
'--root', args.paths['checkout'],
'--json', tempfile_path
])
with open(tempfile_path) as f:
checkperms_results =... | |
12,296 | [
-0.008742940612137318,
-0.01220734603703022,
0.06849221885204315,
-0.018937185406684875,
-0.054166439920663834,
0.002203291282057762,
0.018550951033830643,
0.00033685777452774346,
-0.0007878302712924778,
0.0021389189641922712,
0.009462741203606129,
-0.007256523706018925,
-0.02199194952845573... | 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 setUp(self):
super(BaseLimitTestSuite, self).setUp()
self.time = 0.0
self.stubs.Set(limits.Limit, "_get_time", self._get_time)
self.absolute_limits = {}
def stub_get_project_quotas(context, project_id, usages=True):
return dict((k, dict(limit=v))
... | |
12,297 | [
-0.01534536387771368,
-0.007861046120524406,
0.07208051532506943,
-0.039933107793331146,
-0.04613655060529709,
0.02978658117353916,
-0.0030970133375376463,
-0.029610775411128998,
0.015282575972378254,
0.023168737068772316,
0.02591884694993496,
-0.020669778808951378,
-0.006203445140272379,
... | 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 LimitsViewBuilderTest(test.TestCase):
def setUp(self):
super(LimitsViewBuilderTest, self).setUp()
self.view_builder = views.limits.ViewBuilder()
self.rate_limits = [{"URI": "*",
"regex": ".*",
"value": 10,
... | |
12,298 | [
0.01723780855536461,
-0.033405594527721405,
0.02442784234881401,
-0.042748723179101944,
-0.0004094142932444811,
0.008905984461307526,
-0.012403132393956184,
0.025158589705824852,
0.03687664493918419,
-0.0038690464571118355,
-0.03228337690234184,
-0.01653316058218479,
-0.015671921893954277,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_response_to_delays_usernames(self):
delay = self._request("GET", "/delayed", "user1")
self.assertEqual(delay, None)
delay = self._request("GET", "/delayed", "user2")
self.assertEqual(delay, None)
delay = self._request("GET", "/delayed", "user1")
self.assertEqua... | |
12,299 | [
0.03871278464794159,
0.019429851323366165,
0.0806087851524353,
-0.04277750477194786,
-0.02720423974096775,
0.0544084794819355,
-0.014104087837040424,
-0.01927069015800953,
0.06268483400344849,
0.008282478898763657,
0.027938827872276306,
-0.03388898819684982,
0.004692180547863245,
-0.016871... | 17 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class LimitsXMLSerializationTest(test.TestCase):
def test_xml_declaration(self):
serializer = limits.LimitsTemplate()
fixture = {"limits": {
"rate": [],
"absolute": {}}}
output = serializer.serialize(fixture)
has_dec = output.startswith("<?xml ... | |
12,300 | [
-0.011362893506884575,
-0.03499545902013779,
0.056432995945215225,
-0.021162372082471848,
-0.06223638728260994,
0.01709749549627304,
0.00568770058453083,
-0.03422000631690025,
-0.0031377719715237617,
0.008980250917375088,
0.03419499099254608,
0.007685743737965822,
-0.008342377841472626,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
super(LimitsViewBuilderTest, self).setUp()
self.view_builder = views.limits.ViewBuilder()
self.rate_limits = [{"URI": "*",
"regex": ".*",
"value": 10,
"verb": "POST",
... |