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 |
|---|---|---|---|---|---|
18,101 | [
0.02321435697376728,
-0.015245248563587666,
0.00488252192735672,
0.012034507468342781,
-0.000888584356289357,
0.006485005374997854,
0.025639737024903297,
0.011976759880781174,
-0.02665608748793602,
0.06647852808237076,
0.010504207573831081,
-0.0318533293902874,
-0.03915257006883621,
-0.037... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_initial(self):
initial = super(UpdateDomainView, self).get_initial()
domain_id = self.kwargs['domain_id']
initial['domain_id'] = domain_id
try:
# get initial domain info
domain_info = api.keystone.domain_get(self.request,
... | |
18,102 | [
0.026990806683897972,
-0.037992630153894424,
-0.03288016468286514,
-0.013858788646757603,
0.012380183674395084,
0.02741684392094612,
-0.000754965643864125,
-0.0039690518751740456,
0.030148504301905632,
0.020136594772338867,
0.006923129316419363,
-0.046262793242931366,
-0.025261590257287025,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_Add():
assert str(x + y) == "x + y"
assert str(x + 1) == "x + 1"
assert str(x + x**2) == "x**2 + x"
assert str(5 + x + y + x*y + x**2 + y**2) == "x**2 + x*y + x + y**2 + y + 5"
assert str(1 + x + x**2/2 + x**3/3) == "x**3/3 + x**2/2 + x + 1"
assert str(2*x - 7*x**2 + 2 + 3*y) == "-7*x**... | |
18,103 | [
0.019108738750219345,
-0.01652582921087742,
-0.004505142103880644,
-0.023377710953354836,
0.02196667715907097,
0.02477678656578064,
-0.017530294135212898,
-0.015090880915522575,
0.031114477664232254,
0.007784598506987095,
-0.03202328085899353,
-0.03946109861135483,
-0.0184630099684,
0.0396... | 11 | {"_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_printmethod():
class R(Abs):
def _sympystr(self, printer):
return "foo(%s)" % printer._print(self.args[0])
assert sstr(R(x)) == "foo(x)"
class R(Abs):
def _sympystr(self, printer):
return "foo"
assert sstr(R(x)) == "foo" | |
18,104 | [
0.02545778825879097,
0.008912542834877968,
-0.013609145767986774,
-0.01403768826276064,
0.015612875111401081,
0.022203175351023674,
0.017280718311667442,
-0.04387356713414192,
0.018728500232100487,
0.03259245678782463,
-0.02416057698428631,
-0.032522961497306824,
0.04139496758580208,
0.033... | 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_Matrix_str():
M = Matrix([[x**+1, 1], [y, x + y]])
assert str(M) == "Matrix([[x, 1], [y, x + y]])"
assert sstr(M) == "Matrix([\n[x, 1],\n[y, x + y]])"
M = Matrix([[1]])
assert str(M) == sstr(M) == "Matrix([[1]])"
M = Matrix([[1, 2]])
assert str(M) == sstr(M) == "Matrix([[1, 2]]... | |
18,105 | [
0.016070405021309853,
-0.013339485973119736,
0.0313238687813282,
-0.012125744484364986,
0.019174780696630478,
0.019408194348216057,
0.01521845068782568,
-0.000992000219412148,
0.009844143874943256,
0.03918984532356262,
0.013071062043309212,
-0.03596876189112663,
-0.0030197654850780964,
-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_factorial():
n = Symbol('n', integer=True)
assert str(factorial(-2)) == "zoo"
assert str(factorial(0)) == "1"
assert str(factorial(7)) == "5040"
assert str(factorial(n)) == "factorial(n)"
assert str(factorial(2*n)) == "factorial(2*n)"
assert str(factorial(factorial(n))) == 'factoria... | |
18,106 | [
0.06935666501522064,
-0.012749766930937767,
-0.009791150689125061,
-0.0006856705876998603,
0.01178289856761694,
0.05050918832421303,
-0.025048328563570976,
-0.05796051770448685,
-0.005188858602195978,
0.01314940582960844,
0.048575449734926224,
-0.027355920523405075,
0.004466930404305458,
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": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_Order():
assert str(O(x)) == "O(x)"
assert str(O(x**2)) == "O(x**2)"
assert str(O(x*y)) == "O(x*y, x, y)"
assert str(O(x, x)) == "O(x)"
assert str(O(x, (x, 0))) == "O(x)"
assert str(O(x, (x, oo))) == "O(x, (x, oo))"
assert str(O(x, x, y)) == "O(x, x, y)"
assert str(O(x, x, y)) =... | |
18,107 | [
0.0481954962015152,
-0.017340248450636864,
0.0064042964950203896,
-0.017966683954000473,
0.05501963570713997,
0.03548020124435425,
0.004358387086540461,
0.027829699218273163,
0.02525731921195984,
0.021405411884188652,
0.018819700926542282,
-0.04984821751713753,
-0.02467086911201477,
0.0244... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_Mul():
assert str(x/y) == "x/y"
assert str(y/x) == "y/x"
assert str(x/y/z) == "x/(y*z)"
assert str((x + 1)/(y + 2)) == "(x + 1)/(y + 2)"
assert str(2*x/3) == '2*x/3'
assert str(-2*x/3) == '-2*x/3'
assert str(-1.0*x) == '-1.0*x'
assert str(1.0*x) == '1.0*x'
class CustomClass... | |
18,108 | [
0.024972770363092422,
0.03456556797027588,
-0.013221263885498047,
0.03666522353887558,
0.037321366369724274,
0.017335275188088417,
0.005613296292722225,
-0.03406690061092377,
0.0461399145424366,
0.027767935767769814,
0.02224321849644184,
-0.03813498094677925,
0.003621904645115137,
0.000124... | 15 | {"_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_PolyElement():
Ruv, u,v = ring("u,v", ZZ)
Rxyz, x,y,z = ring("x,y,z", Ruv)
assert str(x - x) == "0"
assert str(x - 1) == "x - 1"
assert str(x + 1) == "x + 1"
assert str(x**2) == "x**2"
assert str(x**(-2)) == "x**(-2)"
assert str(x**QQ(1, 2)) == "x**(1/2)"
assert str((u**2 ... | |
18,109 | [
0.008640220388770103,
-0.0028828687500208616,
-0.006211835891008377,
0.027503808960318565,
0.032897237688302994,
-0.010719777084887028,
-0.005058017559349537,
-0.020969977602362633,
0.02592066302895546,
0.0431206040084362,
0.024324100464582443,
-0.03257524222135544,
0.011538183316588402,
0... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_Poly():
assert str(Poly(0, x)) == "Poly(0, x, domain='ZZ')"
assert str(Poly(1, x)) == "Poly(1, x, domain='ZZ')"
assert str(Poly(x, x)) == "Poly(x, x, domain='ZZ')"
assert str(Poly(2*x + 1, x)) == "Poly(2*x + 1, x, domain='ZZ')"
assert str(Poly(2*x - 1, x)) == "Poly(2*x - 1, x, domain='ZZ')... | |
18,110 | [
0.03756823390722275,
-0.018299201503396034,
-0.004488663747906685,
0.028125131502747536,
0.027257386595010757,
0.03231072425842285,
-0.0288652665913105,
0.016168123111128807,
0.06850077211856842,
0.026925602927803993,
0.024118194356560707,
-0.04001833498477936,
-0.0341227762401104,
0.01104... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_Pow():
assert str(x**-1) == "1/x"
assert str(x**-2) == "x**(-2)"
assert str(x**2) == "x**2"
assert str((x + y)**-1) == "1/(x + y)"
assert str((x + y)**-2) == "(x + y)**(-2)"
assert str((x + y)**2) == "(x + y)**2"
assert str((x + y)**(1 + x)) == "(x + y)**(x + 1)"
assert str(x**R... | |
18,111 | [
0.006233121734112501,
0.027895404025912285,
-0.011165924370288849,
-0.00033680530032142997,
0.04365449398756027,
0.00603257492184639,
0.021969571709632874,
-0.02005467377603054,
-0.00893403310328722,
0.045181237161159515,
0.01587553881108761,
-0.01953713409602642,
-0.002738109789788723,
0.... | 12 | {"_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_FracElement():
Fuv, u,v = field("u,v", ZZ)
Fxyzt, x,y,z,t = field("x,y,z,t", Fuv)
assert str(x - x) == "0"
assert str(x - 1) == "x - 1"
assert str(x + 1) == "x + 1"
assert str(x/3) == "x/3"
assert str(x/z) == "x/z"
assert str(x*y/z) == "x*y/z"
assert str(x/(z*t)) == "x/(z*... | |
18,112 | [
0.019255856052041054,
-0.030985655263066292,
-0.021628936752676964,
-0.002850522054359317,
0.0197643730789423,
0.037200868129730225,
-0.030985655263066292,
-0.029968619346618652,
0.03507639467716217,
0.04545014724135399,
-0.0022106377873569727,
-0.035844821482896805,
0.0019422536715865135,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_sqrt():
assert str(sqrt(x)) == "sqrt(x)"
assert str(sqrt(x**2)) == "sqrt(x**2)"
assert str(1/sqrt(x)) == "1/sqrt(x)"
assert str(1/sqrt(x**2)) == "1/sqrt(x**2)"
assert str(y/sqrt(x)) == "y/sqrt(x)"
assert str(x**(1/2)) == "x**0.5"
assert str(1/x**(1/2)) == "x**(-0.5)" | |
18,113 | [
-0.0018209412228316069,
-0.03347952291369438,
0.0223739892244339,
0.015151317231357098,
0.024016739800572395,
0.009958325885236263,
-0.018491124734282494,
0.016631150618195534,
0.019645122811198235,
0.03576036915183067,
0.031062915921211243,
-0.0543057955801487,
-0.045508258044719696,
0.00... | 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_Rational():
n1 = Rational(1, 4)
n2 = Rational(1, 3)
n3 = Rational(2, 4)
n4 = Rational(2, -4)
n5 = Rational(0)
n7 = Rational(3)
n8 = Rational(-3)
assert str(n1*n2) == "1/12"
assert str(n1*n2) == "1/12"
assert str(n3) == "1/2"
assert str(n1*n3) == "1/8"
assert str(... | |
18,114 | [
-0.024928729981184006,
0.02068151906132698,
0.06548517197370529,
-0.024941332638263702,
-0.009647594764828682,
0.013081911019980907,
-0.024021312594413757,
-0.017291313037276268,
-0.0049466765485703945,
0.03705281391739845,
0.020769739523530006,
-0.03493550792336464,
0.031053785234689713,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_GroebnerBasis():
assert str(groebner(
[], x, y)) == "GroebnerBasis([], x, y, domain='ZZ', order='lex')"
F = [x**2 - 3*y - x + 1, y**2 - 2*x + y - 1]
assert str(groebner(F, order='grlex')) == \
"GroebnerBasis([x**2 - x - 3*y + 1, y**2 - 2*x + y - 1], x, y, domain='ZZ', order='grlex... | |
18,115 | [
0.03490797430276871,
-0.03665945306420326,
0.02782907523214817,
-0.010642674751579762,
0.053517453372478485,
-0.009991951286792755,
-0.032086145132780075,
0.015994420275092125,
0.04150035232305527,
0.054782409220933914,
0.030821187421679497,
-0.017952673137187958,
-0.04179226607084274,
-0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_Float():
# NOTE prec is the whole number of decimal digits
assert str(Float('1.23', prec=1 + 2)) == '1.23'
assert str(Float('1.23456789', prec=1 + 8)) == '1.23456789'
assert str(
Float('1.234567890123456789', prec=1 + 18)) == '1.234567890123456789'
assert str(pi.evalf(1 + 2)) == '3.... | |
18,116 | [
0.04235002398490906,
-0.006031488999724388,
0.031822334975004196,
-0.013365646824240685,
-0.0036620942410081625,
0.010640676133334637,
-0.004592571873217821,
0.027050314471125603,
0.01066726166754961,
0.059656910598278046,
0.049262143671512604,
-0.0017878463258966804,
-0.009437701664865017,
... | 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_wild_str():
# Check expressions containing Wild not causing infinite recursion
w = Wild('x')
assert str(w + 1) == 'x_ + 1'
assert str(exp(2**w) + 5) == 'exp(2**x_) + 5'
assert str(3*w + 1) == '3*x_ + 1'
assert str(1/w + 1) == '1 + 1/x_'
assert str(w**2 + 1) == 'x_**2 + 1'
assert... | |
18,117 | [
0.009617050178349018,
-0.021467825397849083,
0.025587506592273712,
-0.017415020614862442,
0.029212292283773422,
-0.0076307752169668674,
-0.0037618852220475674,
0.007042249199002981,
0.029961325228214264,
0.048901163041591644,
0.007336512207984924,
-0.016960250213742256,
-0.022765256464481354... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_full_prec():
assert sstr(S("0.3"), full_prec=True) == "0.300000000000000"
assert sstr(S("0.3"), full_prec="auto") == "0.300000000000000"
assert sstr(S("0.3"), full_prec=False) == "0.3"
assert sstr(S("0.3")*x, full_prec=True) in [
"0.300000000000000*x",
"x*0.300000000000000"
... | |
18,118 | [
0.06323372572660446,
-0.026285024359822273,
0.007710452191531658,
0.014178144745528698,
0.029612412676215172,
0.03391529992222786,
-0.004957673605531454,
-0.022089041769504547,
0.03749658539891243,
0.04944310709834099,
-0.013950973749160767,
-0.03789747506380081,
0.026432018727064133,
0.03... | 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_noncommutative():
A, B, C = symbols('A,B,C', commutative=False)
assert sstr(A*B*C**-1) == "A*B*C**(-1)"
assert sstr(C**-1*A*B) == "C**(-1)*A*B"
assert sstr(A*C**-1*B) == "A*C**(-1)*B"
assert sstr(sqrt(A)) == "sqrt(A)"
assert sstr(1/sqrt(A)) == "A**(-1/2)" | |
18,119 | [
0.048488300293684006,
0.008977094665169716,
0.007243812084197998,
0.018074100837111473,
-0.025792112573981285,
-0.01050325483083725,
-0.017681660130620003,
0.026053739711642265,
0.0013953468296676874,
-0.01747453771531582,
0.01365913636982441,
-0.053764455020427704,
0.03662785142660141,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "all", "value": {"_typ... | class RemoveContactForm(forms.Form):
contact = forms.ModelChoiceField(Contact.objects.all())
group = forms.ModelChoiceField(ContactGroup.user_groups.all())
def __init__(self, *args, **kwargs):
org = kwargs['org']
del kwargs['org']
super(RemoveContactForm, self).__init__(*args, **kw... | |
18,120 | [
0.04874860495328903,
0.007259494625031948,
0.00184237165376544,
0.04976053535938263,
-0.02301039732992649,
-0.02642015926539898,
-0.013298073783516884,
0.026948124170303345,
-0.027542082592844963,
0.012484130449593067,
0.006275062914937735,
-0.04580080881714821,
0.046328771859407425,
-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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def __init__(self, *args, **kwargs):
org = kwargs['org']
del kwargs['org']
super(RemoveContactForm, self).__init__(*args, **kwargs)
self.fields['contact'].queryset = Contact.objects.filter(org=org)
self.fields['group'].queryset = ContactGroup.user_groups.filter(org=org) | |
18,121 | [
0.02207443304359913,
0.013806638307869434,
0.03829780966043472,
0.008487497456371784,
-0.00010108896094607189,
0.0030122522730380297,
-0.010349197313189507,
0.04734034836292267,
0.016986558213829994,
-0.036517053842544556,
0.02400551177561283,
-0.05527280643582344,
0.049861159175634384,
-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 execute(self):
data = self.cleaned_data
contact = data['contact']
group = data['group']
if group.is_dynamic:
raise ValueError("Can't manually add/remove contacts for a dynamic group") # should never happen
# remove contact from group
group.update_contac... | |
18,122 | [
0.03754912689328194,
0.005315815098583698,
0.04973229020833969,
0.027302777394652367,
-0.03157208859920502,
-0.002983312588185072,
-0.021409042179584503,
0.018326805904507637,
-0.03036418743431568,
-0.03717426210641861,
-0.00772120850160718,
-0.059312209486961365,
0.0004728133790194988,
0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CharField", "value": {"_type": "Name", "_fields": {"id": "fo... | class ContactGroupForm(forms.ModelForm):
preselected_contacts = forms.CharField(required=False, widget=forms.HiddenInput)
group_query = forms.CharField(required=False, widget=forms.HiddenInput)
def __init__(self, user, *args, **kwargs):
self.user = user
super(ContactGroupForm, self).__init_... | |
18,123 | [
-0.01633070595562458,
-0.04710384085774422,
0.03675839304924011,
0.0008933536591939628,
0.00016906842938624322,
-0.02851865254342556,
-0.06266779452562332,
0.0009727469878271222,
-0.02508542872965336,
0.016456590965390205,
0.011730183847248554,
-0.00715255131945014,
0.03392025828361511,
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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def get_queryset(self, **kwargs):
qs = super(ContactListView, self).get_queryset(**kwargs)
qs = qs.filter(is_test=False)
org = self.request.user.get_org()
# contact list views don't use regular field searching but use more complex contact searching
query = self.request.REQUEST.g... | |
18,124 | [
0.012139933183789253,
0.032902415841817856,
0.015348579734563828,
0.03647492825984955,
-0.02833753637969494,
-0.021203534677624702,
-0.014620845206081867,
-0.016010155901312828,
0.014731108210980892,
-0.02311108075082302,
0.017487678676843643,
-0.047589417546987534,
0.022548740729689598,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": ... | class ContactActionForm(BaseActionForm):
ALLOWED_ACTIONS = (('label', _("Add to Group")),
('unlabel', _("Remove from Group")),
('unblock', _("Unblock Contacts")),
('block', _("Block Contacts")),
('delete', _("Delete Contacts... | |
18,125 | [
-0.006227433681488037,
-0.015028995461761951,
0.014759965240955353,
0.027612263336777687,
-0.002963916165754199,
-0.021510174497961998,
-0.03614785149693489,
0.0215346310287714,
-0.03309069201350212,
0.030791709199547768,
0.010895716026425362,
-0.017841583117842674,
0.02844381146132946,
-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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def get_context_data(self, **kwargs):
org = self.request.user.get_org()
# if there isn't a search filtering the queryset, we can replace the count function with a quick cache lookup to
# speed up paging
if hasattr(self, 'folder') and 'search' not in self.request.REQUEST:
org... | |
18,126 | [
0.007152309641242027,
0.012632216326892376,
-0.01744873635470867,
0.06283774971961975,
0.01923263445496559,
-0.03434000536799431,
-0.020403316244482994,
0.06475543975830078,
-0.00828954391181469,
-0.01766057498753071,
0.007860293611884117,
-0.02004653587937355,
0.0346967875957489,
-0.01720... | 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": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def post(self, request, *args, **kwargs):
user = self.request.user
org = user.get_org()
form = ContactActionForm(self.request.POST, org=org, user=user)
if form.is_valid():
form.execute()
return self.get(request, *args, **kwargs) | |
18,127 | [
0.009678359143435955,
-0.02755836956202984,
-0.013593953102827072,
0.020931188017129898,
0.029040222987532616,
-0.027434881776571274,
-0.04700770229101181,
0.007697408553212881,
-0.0192641019821167,
-0.03998947888612747,
-0.01867753453552723,
-0.04095679894089699,
0.023750826716423035,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an... | class ContactActionMixin(SmartListView):
@csrf_exempt
def dispatch(self, *args, **kwargs):
return super(ContactActionMixin, self).dispatch(*args, **kwargs)
def post(self, request, *args, **kwargs):
user = self.request.user
org = user.get_org()
form = ContactActionForm(self... | |
18,128 | [
0.040587350726127625,
0.014175817370414734,
0.04084920510649681,
0.016520598903298378,
-0.008807812817394733,
-0.02206714078783989,
0.011706058867275715,
0.0051180534064769745,
-0.018413089215755463,
0.03654051944613457,
0.007849665358662605,
-0.03953993692994118,
0.018020307645201683,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an... | class ContactForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs['user']
self.org = self.user.get_org()
del kwargs['user']
super(ContactForm, self).__init__(*args, **kwargs)
def add_extra_fields(self, inc_contact_fields):
extra_fields = []
... | |
18,129 | [
0.024890363216400146,
0.011315962299704552,
0.038131941109895706,
0.026174107566475868,
0.0002767329278867692,
-0.03841721639037132,
0.015393037348985672,
-0.002071225317195058,
0.008320560678839684,
0.014454002492129803,
-0.0024827958550304174,
-0.03401920571923256,
0.04055679216980934,
-... | 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": "inc_contact_fields", "annotation": null, "type_comment": null}}],... | def add_extra_fields(self, inc_contact_fields):
extra_fields = []
# add all URN scheme fields if org is not anon
if not self.org.is_anon:
for urn_options in URN_SCHEME_CHOICES:
scheme, label = urn_options
urn = self.instance.get_urn(scheme) if self.... | |
18,130 | [
0.024981025606393814,
-0.01039794646203518,
0.05247097089886665,
0.037893299013376236,
-0.009267852641642094,
-0.003660639515146613,
0.04057524353265762,
0.01905479095876217,
-0.02697085775434971,
0.008705508895218372,
-0.011149540543556213,
-0.060862865298986435,
0.02422402612864971,
0.02... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ModelMultipleChoiceField", "value": {"_type": "Name", "_fiel... | class UpdateContactForm(ContactForm):
groups = forms.ModelMultipleChoiceField(queryset=ContactGroup.user_groups.filter(pk__lt=0),
required=False, label=_("Groups"),
help_text=_("Add or remove groups this contact belongs to"))
... | |
18,131 | [
0.020327920094132423,
-0.00790826790034771,
0.03072545677423477,
0.031873323023319244,
0.01801883988082409,
-0.003201680723577738,
0.03614445775747299,
0.03312797099351883,
-0.016390470787882805,
0.01282674353569746,
0.012105990201234818,
-0.05095994472503662,
-0.004678224679082632,
0.0065... | 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 clean(self):
channel = self.org.get_receive_channel(TEL_SCHEME)
country = channel.country if channel else None
# validate URN fields
for field_key, value in self.cleaned_data.iteritems():
if field_key.startswith('__urn__') and value:
scheme = field_key[7:... | |
18,132 | [
0.04539325833320618,
-0.027681561186909676,
0.021965205669403076,
0.051582224667072296,
-0.001804646453820169,
-0.02621871419250965,
0.03670620173215866,
0.00025230590836144984,
-0.038979239761829376,
0.05248244106769562,
-0.019140787422657013,
-0.06139455363154411,
0.022572850808501244,
0... | 14 | {"_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 __init__(self, *args, **kwargs):
super(UpdateContactForm, self).__init__(*args, **kwargs)
choices = [('', 'No Preference')]
# if they had a preference that has since been removed, make sure we show it
if self.instance.language:
if not self.instance.org.languages.filter(... | |
18,133 | [
0.03010421060025692,
0.013835422694683075,
0.02382381074130535,
-0.011274594813585281,
0.0033082186710089445,
0.0015092662069946527,
0.02739274688065052,
0.02108917012810707,
-0.028342917561531067,
0.0012318914523348212,
0.02468128129839897,
-0.015480841509997845,
0.03545761480927467,
-0.0... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_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, ... | class Import(OrgPermsMixin, SmartCSVImportView):
class ImportForm(forms.ModelForm):
def clean_csv_file(self):
try:
Contact.get_import_file_headers(ContentFile(self.cleaned_data['csv_file'].read()))
except Exception as e:
raise ... | |
18,134 | [
0.0029123229905962944,
-0.021873807534575462,
0.019082648679614067,
-0.003923972137272358,
-0.006469882093369961,
-0.041435275226831436,
-0.03216255456209183,
0.00389477564021945,
-0.005404220428317785,
-0.003734196536242962,
-0.002161980140954256,
-0.03643688187003136,
0.035852957516908646,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Contacts"}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields":... | class List(ContactActionMixin, ContactListView):
title = _("Contacts")
refresh = 30000
folder = OrgFolder.contacts_all
def get_gear_links(self):
links = []
if self.has_org_perm('contacts.contactgroup_create') and self.request.REQUEST.get('search', None):
... | |
18,135 | [
-0.0023807191755622625,
0.01674669422209263,
-0.004208659287542105,
0.02743794582784176,
0.010716376826167107,
-0.04640831798315048,
-0.0543733648955822,
-0.006671038921922445,
-0.010471395216882229,
0.01344258338212967,
-0.009730168618261814,
-0.06909739226102829,
0.04186045378446579,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "... | class Omnibox(OrgPermsMixin, SmartListView):
fields = ('id', 'text')
def get_queryset(self, **kwargs):
org = self.derive_org()
return omnibox_query(org, **self.request.REQUEST)
def get_paginate_by(self, queryset):
if not self.request.REQUEST.get('search', N... | |
18,136 | [
0.008923796936869621,
-0.0037874917034059763,
0.01492231898009777,
0.010329523123800755,
-0.0057594915851950645,
-0.033555299043655396,
-0.01896306872367859,
-0.02164931409060955,
0.02476808987557888,
0.013624725863337517,
-0.022662347182631493,
-0.04493769258260727,
0.014876789413392544,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Failed Contacts"}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_f... | class Failed(ContactActionMixin, ContactListView):
title = _("Failed Contacts")
template_name = 'contacts/contact_failed.haml'
folder = OrgFolder.contacts_failed
def get_context_data(self, *args, **kwargs):
context = super(ContactCRUDL.Failed, self).get_context_data(*args, *... | |
18,137 | [
0.005948919802904129,
-0.04243524745106697,
-0.00918859988451004,
0.035157375037670135,
0.00379578722640872,
-0.04122607037425041,
-0.02895178832113743,
-0.022461021319031715,
0.01967763528227806,
-0.008612529374659061,
-0.015993067994713783,
-0.00784253515303135,
0.03474671021103859,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Blocked Contacts"}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_... | class Blocked(ContactActionMixin, ContactListView):
title = _("Blocked Contacts")
template_name = 'contacts/contact_list.haml'
folder = OrgFolder.contacts_blocked
def get_context_data(self, *args, **kwargs):
context = super(ContactCRUDL.Blocked, self).get_context_data(*args,... | |
18,138 | [
-0.01986738294363022,
0.004782019183039665,
-0.005776561796665192,
-0.003913627937436104,
0.003376750973984599,
-0.030041642487049103,
-0.047972749918699265,
0.016569843515753746,
-0.012709023430943489,
0.020993944257497787,
0.0241506639868021,
-0.05642196163535118,
0.03609691187739372,
0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "contacts/contact_filter.haml"}}, "targets": [{"_type": "Name", "_fields": {"id": "template_name", "ctx": {"_type": "Store", "_fields": {}... | class Filter(ContactActionMixin, ContactListView):
template_name = "contacts/contact_filter.haml"
def get_gear_links(self):
links = []
if self.has_org_perm('contacts.contactfield_managefields'):
links.append(dict(title=_('Manage Fields'),
... | |
18,139 | [
0.05772308260202408,
0.040697503834962845,
0.007346263621002436,
0.02622121013700962,
-0.008233960717916489,
-0.028724972158670425,
0.02572045847773552,
0.01787913218140602,
-0.006139905657619238,
-0.000421087141148746,
0.003656060667708516,
-0.03623625636100769,
0.03603140264749527,
0.006... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ContactForm", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "form_class", "ctx": {"_type": "Store", "_fields": {}... | class Create(ModalMixin, OrgPermsMixin, SmartCreateView):
form_class = ContactForm
exclude = ('is_active', 'uuid', 'language', 'org', 'fields', 'is_blocked', 'is_failed',
'created_by', 'modified_by', 'is_test', 'channel')
success_message = ''
submit_button_name = _("Cr... | |
18,140 | [
0.07920555770397186,
0.01469065248966217,
0.006437354721128941,
-0.014440552331507206,
-0.031882304698228836,
-0.02072567120194435,
0.01885535940527916,
0.0098408879712224,
-0.027424000203609467,
0.031556084752082825,
0.007573678158223629,
-0.006856000050902367,
0.006399295758455992,
0.008... | 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 CustomizeForm(forms.ModelForm):
def clean(self):
# don't allow users to specify field keys or labels
re_col_name_field = re.compile(r'column_\w+_label')
for key, value in self.data.items():
if re_col_name_field.match(key):
... | |
18,141 | [
0.03269613906741142,
0.01381526980549097,
0.015645187348127365,
0.007937720976769924,
-0.007755940780043602,
0.012185310013592243,
0.034829020500183105,
0.01589967869222164,
-0.014360609464347363,
0.026515623554587364,
0.0057078879326581955,
-0.06195057928562164,
0.01055535115301609,
0.036... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "UpdateContactForm", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "form_class", "ctx": {"_type": "Store", "_field... | class Update(ModalMixin, OrgObjPermsMixin, SmartUpdateView):
form_class = UpdateContactForm
exclude = ('is_active', 'uuid', 'org', 'fields', 'is_blocked', 'is_failed',
'created_by', 'modified_by', 'is_test', 'channel')
success_url = 'uuid@contacts.contact_read'
success... | |
18,142 | [
0.060130227357149124,
0.04820039123296738,
0.02265707030892372,
0.0018670435529202223,
-0.029560020193457603,
-0.044352058321237564,
0.03304757550358772,
0.009145807474851608,
-0.022404523566365242,
0.014250864274799824,
0.009735084138810635,
-0.0029238322749733925,
0.016199083998799324,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "form_class", "annotation": null, "type_comment": null}}], "kwarg"... | def get_form(self, form_class):
form = super(ContactCRUDL.Customize, self).get_form(form_class)
form.fields.clear()
self.headers = Contact.get_import_file_headers(self.get_object().csv_file.file)
self.column_controls = self.create_column_controls(self.headers... | |
18,143 | [
0.02856696955859661,
0.007691107224673033,
-0.0036017028614878654,
-0.026212548837065697,
0.02161582186818123,
-0.015729771926999092,
0.014406811445951462,
0.026526471599936485,
-0.013420197181403637,
0.0006478159921243787,
0.026974931359291077,
0.003240131074562669,
0.04237956926226616,
-... | 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": "task", "annotation": null, "type_comment": null}}], "kwarg": null... | def pre_save(self, task):
extra_fields = []
cleaned_data = self.form.cleaned_data
# enumerate the columns which the user has chosen to include as fields
for column in self.column_controls:
if cleaned_data[column['include_field']]:
labe... | |
18,144 | [
0.0455605648458004,
0.006633490789681673,
0.025600507855415344,
-0.03267093747854233,
-0.03350508585572243,
-0.03137998655438423,
0.012770462781190872,
0.006578873842954636,
-0.023971926420927048,
0.014597652480006218,
0.0229193065315485,
-0.00015407598402816802,
0.012661228887736797,
0.03... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class ImportForm(forms.ModelForm):
def clean_csv_file(self):
try:
Contact.get_import_file_headers(ContentFile(self.cleaned_data['csv_file'].read()))
except Exception as e:
raise forms.ValidationError(str(e))
return sel... | |
18,145 | [
0.002452570479363203,
0.013094805181026459,
0.02833239734172821,
-0.013614268973469734,
-0.00711015472188592,
-0.006547402590513229,
0.033570319414138794,
0.026124676689505577,
-0.012261499650776386,
-0.005719508044421673,
0.010048368945717812,
0.033202365040779114,
0.03305085375905037,
-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": "task", "annotation": null, "type_comment": null}}], "kwarg": null... | def post_save(self, task):
# configure import params with current org and timezone
org = self.derive_org()
params = dict(org_id=org.id, timezone=org.timezone, extra_fields=[], original_filename=self.form.cleaned_data['csv_file'].name)
task.import_params = json.dumps(param... | |
18,146 | [
-0.00956348329782486,
0.0028451653197407722,
0.009930413216352463,
-0.014222914353013039,
0.018031999468803406,
-0.014246211387217045,
0.013372568413615227,
0.029470903798937798,
-0.006336826831102371,
-0.01486358605325222,
0.0370657779276371,
0.01570228487253189,
0.01486358605325222,
0.00... | 12 | {"_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 get_context_data(self, **kwargs):
context = super(ContactCRUDL.Import, self).get_context_data(**kwargs)
context['task'] = None
context['group'] = None
context['show_form'] = True
analytics.track(self.request.user.username, 'temba.contact_imported')
... | |
18,147 | [
-0.005112052895128727,
-0.014948748983442783,
-0.010375574231147766,
0.013958380557596684,
0.01962096244096756,
-0.02686813473701477,
-0.028709055855870247,
0.032460808753967285,
-0.000021664325686288066,
0.015053612180054188,
-0.0006852481164969504,
-0.06739170849323273,
0.00711318105459213... | 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": "context", "annotation": null, "type_comment": null}}], "kwarg": {... | def render_to_response(self, context, **response_kwargs):
org = self.derive_org()
page = context['page_obj']
object_list = context['object_list']
results = omnibox_results_to_dict(org, object_list)
json_result = {'results': results, 'more': page.has_next(), ... | |
18,148 | [
0.027111902832984924,
-0.030677542090415955,
0.019023990258574486,
0.022393953055143356,
0.016099730506539345,
-0.026459651067852974,
0.003193312557414174,
0.0422658696770668,
-0.013240696862339973,
-0.030503608286380768,
0.011153493076562881,
-0.030894959345459938,
0.028459887951612473,
-... | 14 | {"_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": "queryset", "annotation": null, "type_comment": null}}], "kwarg": ... | def get_object(self, queryset=None):
uuid = self.kwargs.get('uuid')
contact = None
if self.request.user.is_superuser:
contact = Contact.objects.filter(uuid=uuid, is_active=True).first()
else:
contact = Contact.objects.filter(uuid=uuid, is_a... | |
18,149 | [
0.0353422537446022,
-0.014144300483167171,
-0.021802200004458427,
0.04279051721096039,
0.0010535777546465397,
0.0025171798188239336,
-0.021666552871465683,
0.021037643775343895,
0.01706688106060028,
-0.013959326781332493,
0.04967152699828148,
-0.02717876061797142,
0.04059549793601036,
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}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def post(self, request, *args, **kwargs):
form = RemoveContactForm(self.request.POST, org=request.user.get_org())
if form.is_valid():
result = form.execute()
return HttpResponse(json.dumps(result))
# shouldn't ever happen
else: # pragma: ... | |
18,150 | [
-0.0032932134345173836,
-0.008233034051954746,
0.030187789350748062,
-0.0008740141056478024,
-0.013125126250088215,
-0.04367087408900261,
-0.01648993045091629,
0.00927707739174366,
0.00008161255391314626,
-0.020045647397637367,
0.0277536753565073,
-0.017635395750403404,
0.056080084294080734,... | 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_gear_links(self):
links = []
if self.has_org_perm('contacts.contactgroup_create') and self.request.REQUEST.get('search', None):
links.append(dict(title=_('Save as Group'), js_class='add-dynamic-group', href="#"))
if self.has_org_perm('contacts.contactfield_m... | |
18,151 | [
0.015744648873806,
-0.008450227789580822,
0.008116328157484531,
0.011570904403924942,
-0.01770951971411705,
-0.05537595972418785,
-0.007403580937534571,
-0.019635863602161407,
0.013189032673835754,
0.003022754332050681,
0.0012770052999258041,
-0.00624135322868824,
0.04374084249138832,
-0.0... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_gear_links(self):
links = []
if self.has_org_perm("msgs.broadcast_send"):
links.append(dict(title=_('Send Message'),
style='btn-primary',
href='#',
js_class='contact-sen... | |
18,152 | [
-0.024274909868836403,
-0.011079934425652027,
0.014937481842935085,
0.035282738506793976,
0.0009103090851567686,
-0.03588360548019409,
-0.018025923520326614,
0.008424114435911179,
-0.01856670156121254,
0.006777747068554163,
0.004266134928911924,
-0.02161909081041813,
0.03307155892252922,
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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def get_context_data(self, *args, **kwargs):
context = super(ContactCRUDL.List, self).get_context_data(*args, **kwargs)
org = self.request.user.get_org()
context['actions'] = ('label', 'block')
context['contact_fields'] = ContactField.objects.filter(org=org, is_active=Tr... | |
18,153 | [
-0.008111604489386082,
0.0019956189207732677,
0.02951168268918991,
-0.006033812649548054,
-0.00947332102805376,
-0.05305998772382736,
-0.0013873954303562641,
-0.011545242741703987,
-0.007912042550742626,
0.005423387978225946,
0.024698719382286072,
-0.01940445974469185,
0.059399012476205826,
... | 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 get_gear_links(self):
links = []
if self.has_org_perm('contacts.contactfield_managefields'):
links.append(dict(title=_('Manage Fields'),
js_class='manage-fields',
href="#"))
if self.has_org_perm... | |
18,154 | [
-0.020151210948824883,
0.0019739961717277765,
-0.009270732291042805,
0.03461543470621109,
0.0017419341020286083,
-0.019857462495565414,
-0.020585959777235985,
0.034662432968616486,
-0.03033844195306301,
0.00008592171070631593,
0.019880961626768112,
-0.023652704432606697,
0.026601947844028473... | 10 | {"_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 get_context_data(self, *args, **kwargs):
context = super(ContactCRUDL.Filter, self).get_context_data(*args, **kwargs)
group = self.derive_group()
org = self.request.user.get_org()
if group.is_dynamic:
actions = ('block', 'label')
else:
... | |
18,155 | [
0.047642290592193604,
0.02566801942884922,
0.009228488430380821,
0.004723056685179472,
0.0082403514534235,
-0.025032788515090942,
0.024444611743092537,
0.019668620079755783,
0.013245733454823494,
-0.015669019892811775,
0.00022332323715090752,
-0.05999399349093437,
0.04128998517990112,
-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": "obj", "annotation": null, "type_comment": null}}], "kwarg": null,... | def save(self, obj):
urns = []
for field_key, value in self.form.cleaned_data.iteritems():
if field_key.startswith('__urn__') and value:
scheme = field_key[7:]
urns.append((scheme, value))
Contact.get_or_create(obj.org, self.re... | |
18,156 | [
0.09162329137325287,
0.01932535320520401,
0.0390179343521595,
-0.0023195587564259768,
-0.0025720279663801193,
-0.022584499791264534,
-0.026624003425240517,
-0.015354705043137074,
-0.023456664755940437,
0.025200996547937393,
0.010150400921702385,
-0.03210946545004845,
-0.0044382899068295956,
... | 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 clean(self):
# don't allow users to specify field keys or labels
re_col_name_field = re.compile(r'column_\w+_label')
for key, value in self.data.items():
if re_col_name_field.match(key):
field_label = value
... | |
18,157 | [
0.043677814304828644,
0.02157115936279297,
-0.00005229449016042054,
-0.0018553176196292043,
-0.007619170937687159,
0.011472410522401333,
0.05285108834505081,
-0.00951668806374073,
-0.01146659068763256,
0.003378860652446747,
0.025191575288772583,
-0.045004911720752716,
0.0023966338485479355,
... | 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": "obj", "annotation": null, "type_comment": null}}], "kwarg": null,... | def post_save(self, obj):
obj = super(ContactCRUDL.Update, self).post_save(obj)
if not self.org.is_anon:
urns = []
for field_key, value in self.form.cleaned_data.iteritems():
if field_key.startswith('__urn__') and value:
... | |
18,158 | [
0.061419688165187836,
0.004555220250040293,
0.030842119827866554,
-0.016369029879570007,
0.016578465700149536,
0.01663358137011528,
0.019753066822886467,
-0.01405421830713749,
0.01255510188639164,
0.017162680625915527,
0.03813929110765457,
-0.030952349305152893,
0.001500494428910315,
-0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "a", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "b", "annotation": null, "type_comment": null}}], "kwarg": null, "var... | def contact_cmp(a, b):
if a.__class__ == b.__class__:
return a.pk - b.pk
else:
if a.created_on == b.created_on:
return 0
elif a.created_on < b.created_on:
return -1
... | |
18,159 | [
0.02286635711789131,
0.023885641247034073,
0.02041025087237358,
0.005222297739237547,
0.001636381377466023,
0.008301641792058945,
0.0024822033010423183,
0.024462826550006866,
0.01693485863506794,
-0.009818288497626781,
0.004230644553899765,
-0.056932564824819565,
0.021380413323640823,
0.01... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ContactGroup", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}]... | class ContactGroupCRUDL(SmartCRUDL):
model = ContactGroup
actions = ('read', 'update', 'create', 'delete', 'list')
class List(OrgPermsMixin, SmartListView):
pass
class Read(OrgObjPermsMixin, SmartReadView):
fields = ('name', 'contacts')
def get_context_data(self, **kwargs):
... | |
18,160 | [
0.019186124205589294,
0.03848747909069061,
0.014622937887907028,
0.017204133793711662,
0.014346380718052387,
-0.022689176723361015,
-0.03182706981897354,
-0.0029009650461375713,
-0.007801204454153776,
-0.030651705339550972,
-0.008066237904131413,
-0.041414372622966766,
0.04148351028561592,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "name"}}, {"_type": "Constant", "_fields": {"kind": null,... | class Read(OrgObjPermsMixin, SmartReadView):
fields = ('name', 'contacts')
def get_context_data(self, **kwargs):
context = super(ContactGroupCRUDL.Read, self).get_context_data(**kwargs)
group = self.object
broadcasts = Broadcast.objects.filter(groups=group.id).order_... | |
18,161 | [
0.032134510576725006,
0.03450347110629082,
0.02185804769396782,
0.03235385939478874,
-0.009645836427807808,
-0.03132292255759239,
0.02568567357957363,
0.04509798809885979,
-0.004743404686450958,
-0.020574860274791718,
0.006180135067552328,
-0.04601924866437912,
0.03649953752756119,
-0.0098... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ContactGroupForm", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "form_class", "ctx": {"_type": "Store", "_fields... | class Create(ModalMixin, OrgPermsMixin, SmartCreateView):
form_class = ContactGroupForm
fields = ('name', 'preselected_contacts', 'group_query')
success_url = "id@contacts.contact_filter"
success_message = ''
submit_button_name = _("Create")
def save(self, obj):
... | |
18,162 | [
0.022812115028500557,
0.03358747437596321,
0.007049948442727327,
0.037328917533159256,
-0.000620344711933285,
-0.0066544245928525925,
0.041326917707920074,
0.024714907631278038,
-0.002950395457446575,
-0.009877410717308521,
0.0031535024754703045,
-0.05836651846766472,
0.018888944759964943,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ContactGroupForm", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "form_class", "ctx": {"_type": "Store", "_fields... | class Update(ModalMixin, OrgObjPermsMixin, SmartUpdateView):
form_class = ContactGroupForm
fields = ('name',)
success_url = 'id@contacts.contact_filter'
success_message = ''
def derive_fields(self):
return ('name', 'query') if self.get_object().is_dynamic else ('name... | |
18,163 | [
0.029846418648958206,
0.018569020554423332,
-0.012590358965098858,
0.015743810683488846,
-0.022847866639494896,
0.030244996771216393,
-0.014020548202097416,
0.04311670362949371,
0.020620523020625114,
-0.0010228201281279325,
0.020749473944306374,
-0.061615388840436935,
0.019073104485869408,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "id@contacts.contact_filter"}}, "targets": [{"_type": "Name", "_fields": {"id": "cancel_url", "ctx": {"_type": "Store", "_fields": {}}}}],... | class Delete(OrgObjPermsMixin, SmartDeleteView):
cancel_url = 'id@contacts.contact_filter'
redirect_url = '@contacts.contact_list'
success_message = ''
def pre_process(self, request, *args, **kwargs):
group = self.get_object()
triggers = group.trigger_set.filter(... | |
18,164 | [
0.024527426809072495,
-0.000267462688498199,
0.02860751561820507,
0.017445893958210945,
-0.013400979340076447,
-0.0051851118914783,
0.02895924635231495,
0.020998384803533554,
-0.013060972094535828,
-0.04258298873901367,
0.02778680808842182,
-0.03969879075884819,
0.017328649759292603,
-0.00... | 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": "obj", "annotation": null, "type_comment": null}}], "kwarg": {"_ty... | def post_save(self, obj, *args, **kwargs):
obj = super(ContactGroupCRUDL.Create, self).post_save(self.object, *args, **kwargs)
data = self.form.cleaned_data
# static group with initial contact ids
if data['preselected_contacts']:
preselected_ids = [int(c_... | |
18,165 | [
0.023940911516547203,
0.01614992879331112,
0.014507772400975227,
-0.01768096163868904,
-0.005852497182786465,
0.043091170489788055,
0.0040498292073607445,
0.03630029782652855,
0.020854150876402855,
-0.009494873695075512,
0.002842905931174755,
-0.04193054884672165,
0.00877874530851841,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def pre_process(self, request, *args, **kwargs):
group = self.get_object()
triggers = group.trigger_set.filter(is_archived=False)
if triggers.count() > 0:
trigger_list = ', '.join([trigger.__unicode__() for trigger in triggers])
messages.error(self.req... | |
18,166 | [
0.010394531302154064,
-0.007467117626219988,
0.03052603080868721,
0.035912979394197464,
-0.01633787527680397,
0.005092940758913755,
-0.012803482823073864,
0.03368738666176796,
0.04241272062063217,
-0.05741018429398537,
0.021206360310316086,
-0.026049554347991943,
0.005402753595262766,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def post(self, request, *args, **kwargs):
group = self.get_object()
group.release()
# make is_active False for all its triggers too
group.trigger_set.all().update(is_active=False)
return HttpResponseRedirect(reverse("contacts.contact_list")) | |
18,167 | [
0.06468692421913147,
0.030997656285762787,
0.007208885625004768,
-0.0140206478536129,
-0.028879666700959206,
-0.02947535179555416,
-0.01062855590134859,
-0.007666680030524731,
-0.019315620884299278,
0.043926216661930084,
0.00700480816885829,
-0.030666720122098923,
-0.01982305571436882,
-0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class ManageFieldsForm(forms.Form):
def clean(self):
used_labels = []
for key in self.cleaned_data:
if key.startswith('field_'):
idx = key[6:]
label = self.cleaned_data["label_%s" % idx]
if label:
if not ContactField.is... | |
18,168 | [
0.06683079153299332,
0.004091867245733738,
0.030426237732172012,
-0.019806217402219772,
-0.004635626915842295,
-0.025249889120459557,
-0.029770081862807274,
-0.01210852526128292,
-0.03127681091427803,
0.03436318039894104,
0.003930865786969662,
-0.026732318103313446,
-0.016537584364414215,
... | 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 clean(self):
used_labels = []
for key in self.cleaned_data:
if key.startswith('field_'):
idx = key[6:]
label = self.cleaned_data["label_%s" % idx]
if label:
if not ContactField.is_valid_label(label):
... | |
18,169 | [
0.02926497347652912,
0.007077670190483332,
0.012858481146395206,
0.012032650411128998,
0.01246085949242115,
-0.025227582082152367,
-0.014620251953601837,
-0.00815430749207735,
-0.008221597410738468,
0.006178432609885931,
0.012442506849765778,
-0.05299994349479675,
0.03320448845624924,
-0.0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "ContactField", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}]... | class ContactFieldCRUDL(SmartCRUDL):
model = ContactField
actions = ('managefields', 'json')
class Json(OrgPermsMixin, SmartListView):
paginate_by = None
def get_queryset(self, **kwargs):
qs = super(ContactFieldCRUDL.Json, self).get_queryset(**kwargs)
qs = qs.filter... | |
18,170 | [
0.049768056720495224,
0.03256399556994438,
-0.0026480131782591343,
0.010131021030247211,
-0.0073356530629098415,
-0.03333432599902153,
0.014111065305769444,
-0.01000846829265356,
-0.0015888079069554806,
0.029132520779967308,
0.02507077530026436,
-0.02451053448021412,
0.020040279254317284,
... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Manage Contact Fields"}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load... | class Managefields(ModalMixin, OrgPermsMixin, SmartFormView):
title = _("Manage Contact Fields")
submit_button_name = _("Update Fields")
success_url = "@contacts.contact_list"
form_class = ManageFieldsForm
def get_context_data(self, **kwargs):
context = super(Contact... | |
18,171 | [
0.003788238624110818,
-0.002684164559468627,
0.00967379193753004,
-0.0028333638329058886,
0.002161256968975067,
-0.02985120750963688,
-0.03753567859530449,
-0.013663805089890957,
-0.00994092971086502,
-0.013663805089890957,
-0.033443354070186615,
-0.0682053491473198,
0.013527394272387028,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "paginate_by", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}... | class Json(OrgPermsMixin, SmartListView):
paginate_by = None
def get_queryset(self, **kwargs):
qs = super(ContactFieldCRUDL.Json, self).get_queryset(**kwargs)
qs = qs.filter(org=self.request.user.get_org(), is_active=True)
return qs
def render_to_response(se... | |
18,172 | [
0.004134736489504576,
0.003476179437711835,
0.023874767124652863,
-0.013415663503110409,
0.008352834731340408,
-0.04332581162452698,
0.0025119634810835123,
0.009842228144407272,
-0.014682759530842304,
0.01998455822467804,
0.017505940049886703,
-0.028276260942220688,
0.013148905709385872,
0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def get_context_data(self, **kwargs):
context = super(ContactFieldCRUDL.Managefields, self).get_context_data(**kwargs)
num_fields = ContactField.objects.filter(org=self.request.user.get_org(), is_active=True).count()
contact_fields = []
for field_idx in range(1, num_fiel... | |
18,173 | [
0.04943034052848816,
0.01417348999530077,
0.02874789386987686,
-0.0024555984418839216,
-0.013607493601739407,
-0.04292138293385506,
0.026389576494693756,
-0.013430620543658733,
-0.001603656099177897,
0.02357138693332672,
0.02124844305217266,
-0.02440859004855156,
0.012027421034872532,
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}}, {"_type": "arg", "_fields": {"arg": "form_class", "annotation": null, "type_comment": null}}], "kwarg"... | def get_form(self, form_class):
form = super(ContactFieldCRUDL.Managefields, self).get_form(form_class)
form.fields.clear()
org = self.request.user.get_org()
contact_fields = ContactField.objects.filter(org=org, is_active=True).order_by('pk')
added_fields = ... | |
18,174 | [
0.027928387746214867,
0.03268111124634743,
0.040300171822309494,
-0.06036451458930969,
0.006283887196332216,
-0.02780589461326599,
0.01480939518660307,
-0.036747876554727554,
0.03226463496685028,
0.010307779535651207,
0.05688571557402611,
-0.00016967183910310268,
0.028344864025712013,
-0.0... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f_out", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type":... | def emit(f_out, filename, data={}):
full_filename = os.path.join(os.path.dirname(__file__),'web',filename)
with open(full_filename,'rU') as f_in:
for line in f_in:
if line.startswith('INCLUDE '):
emit(f_out, line[8:].strip())
elif line.startswith('DATA '):
... | |
18,175 | [
0.0688527449965477,
0.004495464265346527,
0.0036795390769839287,
0.044708918780088425,
0.0024714027531445026,
-0.016394110396504402,
0.02130856364965439,
0.03298984095454216,
0.0013514745514839888,
0.019582204520702362,
0.044381290674209595,
-0.02699168771505356,
0.013558849692344666,
-0.0... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "form", "annotation": null, "type_comment": null}}], "kwarg": null... | def form_valid(self, form):
try:
cleaned_data = form.cleaned_data
org = self.request.user.get_org()
for key in cleaned_data:
if key.startswith('field_'):
idx = key[6:]
label = cleaned_data["l... | |
18,176 | [
0.06272893399000168,
0.026572979986667633,
0.025452034547924995,
0.018803294748067856,
-0.030814986675977707,
0.03514491021633148,
-0.008297187276184559,
0.0024383291602134705,
-0.016154788434505463,
0.0777188241481781,
0.00863786693662405,
0.023737650364637375,
0.0171878170222044,
0.03472... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def striped_words(text):
items = re.split("\W+", text.upper())
count = 0
for t in items:
if t == "" or len(t) == 1 or any([not str.isalpha(i) for i in t]):
continue
flag = True
for i in range(len(t)-1):
if (VOWELS.find(t[i]) > -1 and VOWELS.find(t[i+1]) > -1) ... | |
18,177 | [
-0.04991074278950691,
0.02352968603372574,
0.028560820966959,
0.0009094630368053913,
-0.04239349812269211,
-0.022398564964532852,
-0.007305160630494356,
-0.05669747292995453,
-0.022245392203330994,
0.008459847420454025,
0.021314574405550957,
0.017461691051721573,
0.05057056248188019,
0.004... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "el", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}], "kwarg": nul... | def Map(el, options):
if options:
map = JS("""new $wnd['google']['maps']['Map'](@{{el}}, @{{options}})""")
else:
map = JS("""new $wnd['google']['maps']['Map'](@{{el}})""")
createListenerMethods(map)
return map | |
18,178 | [
0.0013091526925563812,
-0.019295653328299522,
0.02566923201084137,
-0.027156036347150803,
0.04206780716776848,
-0.01777605339884758,
0.034568190574645996,
0.025887880474328995,
-0.037301287055015564,
0.0008356439648196101,
0.018945816904306412,
-0.03277527913451195,
-0.0022862344048917294,
... | 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 example_parallel(BaseRecipe, RemoteCommandRecipeMixIn):
def go(self):
super(example_parallel, self).go()
node_command = "python %s" % (self.__file__.replace("master", "nodes"))
job = ComputeJob("localhost", node_command, arguments = ["example_argument"])
self._schedule_jobs([jo... | |
18,179 | [
0.002912705298513174,
-0.019253570586442947,
0.020857099443674088,
-0.006716883275657892,
0.01046779751777649,
-0.03830529749393463,
0.022449417039752007,
0.024086587131023407,
-0.007686850614845753,
0.026755398139357567,
0.0204758420586586,
0.0013112779706716537,
-0.016820242628455162,
-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 go(self):
super(example_parallel, self).go()
node_command = "python %s" % (self.__file__.replace("master", "nodes"))
job = ComputeJob("localhost", node_command, arguments = ["example_argument"])
self._schedule_jobs([job])
if self.error.isSet():
return 1
el... | |
18,180 | [
0.01190510205924511,
-0.0034918750170618296,
0.03317127004265785,
-0.005390639882534742,
0.006989925168454647,
0.0004878127947449684,
0.02539096400141716,
0.05078192800283432,
-0.03181280195713043,
-0.02539096400141716,
0.04660773277282715,
0.019253168255090714,
0.004739193711429834,
-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 flush(self):
batch_data = {
self.table.table_name: [
# We'll insert data here shortly.
],
}
for put in self._to_put:
item = Item(self.table, data=put)
batch_data[self.table.table_name].append({
'PutRequest': {
... | |
18,181 | [
0.05289027839899063,
0.044940996915102005,
-0.0029252313543111086,
0.0030186944641172886,
0.009431575424969196,
0.009083958342671394,
0.025185847654938698,
0.0630170926451683,
0.02948842942714691,
0.004856802057474852,
0.06107567995786667,
-0.011077838018536568,
-0.019191091880202293,
-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}}, {"_type": "arg", "_fields": {"arg": "type", "annotation": null, "type_comment": null}}, {"_type": "arg... | def __exit__(self, type, value, traceback):
if self._to_put or self._to_delete:
# Flush anything that's left.
self.flush()
if self._unprocessed:
# Finally, handle anything that wasn't processed.
self.resend_unprocessed() | |
18,182 | [
-0.008186466991901398,
0.049244362860918045,
0.020893070846796036,
-0.025224866345524788,
0.006447470746934414,
0.009705735370516777,
-0.014288649894297123,
0.05318692699074745,
0.02689480595290661,
0.0022647760342806578,
0.007401721552014351,
-0.02497374825179577,
-0.012072527781128883,
-... | 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": "resp", "annotation": null, "type_comment": null}}], "kwarg": null... | def handle_unprocessed(self, resp):
if len(resp.get('UnprocessedItems', [])):
table_name = self.table.table_name
unprocessed = resp['UnprocessedItems'].get(table_name, [])
# Some items have not been processed. Stow them for now &
# re-attempt processing on ``__ex... | |
18,183 | [
0.017982926219701767,
0.030213352292776108,
0.04042022302746773,
-0.01952286623418331,
0.006357021629810333,
0.011358642019331455,
0.01499213557690382,
0.05156887322664261,
-0.02255183644592762,
-0.010652306489646435,
0.0009322359110228717,
-0.0012750632595270872,
-0.03334413841366768,
-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 resend_unprocessed(self):
# If there are unprocessed records (for instance, the user was over
# their throughput limitations), iterate over them & send until they're
# all there.
boto.log.info(
"Re-sending %s unprocessed items." % len(self._unprocessed)
)
... | |
18,184 | [
-0.03697724640369415,
-0.002474029315635562,
0.0333271324634552,
-0.02378242276608944,
-0.0079577025026083,
-0.0037181288935244083,
0.0019143263343721628,
0.022773539647459984,
0.03468742221593857,
0.017321038991212845,
0.00040879580774344504,
-0.031059978529810905,
-0.007356907706707716,
... | 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def _get_current_rate(self, cr, uid, ids, raise_on_no_rate=True, context=None):
if context is None:
context = {}
res = {}
date = context.get('date') or time.strftime('%Y-%m-%d')
for id in ids:
cr.execute('SELECT rate FROM res_currency_rate '
... | |
18,185 | [
0.04926258325576782,
0.018573835492134094,
0.04926258325576782,
0.015362084843218327,
0.018384909257292747,
0.005036071874201298,
0.022340556606650352,
0.022883720695972443,
-0.019317733123898506,
-0.038470156490802765,
0.021206999197602272,
0.000038375692383851856,
0.012480956502258778,
-... | 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": "cr", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def init(self, cr):
# CONSTRAINT/UNIQUE INDEX on (name,company_id)
# /!\ The unique constraint 'unique_name_company_id' is not sufficient, because SQL92
# only support field names in constraint definitions, and we need a function here:
# we need to special-case company_id to treat all N... | |
18,186 | [
0.006564156152307987,
-0.017631368711590767,
-0.028071288019418716,
0.0008401223458349705,
0.009302955120801926,
0.005586813669651747,
0.034097764641046524,
0.007325866725295782,
-0.00662576500326395,
-0.015402243472635746,
-0.0037329436745494604,
-0.02858656272292137,
0.0071130357682704926,... | 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def copy(self, cr, uid, id, default=None, context=None):
if context is None:
context = {}
if not default:
default = {}
default.update(name=_("%s (copy)")
% (self.browse(cr, uid, id, context=context).name))
return super(res_currency, self).co... | |
18,187 | [
-0.004232693929225206,
0.012560408562421799,
0.012349506840109825,
-0.010808747261762619,
-0.030862050130963326,
0.009074660949409008,
-0.013134532608091831,
0.04136030375957489,
-0.016380086541175842,
0.01656755432486534,
-0.032174330204725266,
-0.03934501111507416,
0.004508038517087698,
... | 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
results = super(res_currency,self)\
.name_search(cr, user, name, args, operator=operator, context=context, limit=limit)
if not results:
name_... | |
18,188 | [
-0.041770100593566895,
-0.03693774342536926,
0.01885501854121685,
0.03232603892683983,
0.014949414879083633,
-0.03711426630616188,
0.02917066588997841,
0.04823530837893486,
0.05829720199108124,
0.008037379011511803,
0.019417690113186836,
-0.02017895132303238,
-0.015843069180846214,
-0.0025... | 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 _compute(self, cr, uid, from_currency, to_currency, from_amount, round=True, context=None):
if (to_currency.id == from_currency.id):
if round:
return self.round(cr, uid, to_currency, from_amount)
else:
return from_amount
else:
rate ... | |
18,189 | [
-0.05940791219472885,
-0.016544241458177567,
0.028905123472213745,
-0.025394463911652565,
-0.018751541152596474,
-0.008571682497859001,
0.04620615392923355,
0.01301256101578474,
0.06516791135072708,
-0.01027445774525404,
-0.011551538482308388,
-0.0007659857510589063,
-0.01259212289005518,
... | 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_conversion_rate(self, cr, uid, from_currency, to_currency, context=None):
if context is None:
context = {}
ctx = context.copy()
from_currency = self.browse(cr, uid, from_currency.id, context=ctx)
to_currency = self.browse(cr, uid, to_currency.id, context=ctx)
... | |
18,190 | [
-0.036922138184309006,
0.0342036671936512,
0.018048841506242752,
-0.04536721110343933,
-0.025446638464927673,
-0.009208251722157001,
-0.016277380287647247,
-0.03199769929051399,
0.018338514491915703,
-0.01731351763010025,
-0.033200956881046295,
-0.04425308480858803,
0.026605328544974327,
0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "res.currency.rate"}}, "targets": [{"_type": "Name", "_fields": {"id": "_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment... | class res_currency_rate(osv.osv):
_name = "res.currency.rate"
_description = "Currency Rate"
_columns = {
'name': fields.datetime('Date', required=True, select=True),
'rate': fields.float('Rate', digits=(12, 6), help='The rate of the currency to the currency of rate 1'),
'currency_i... | |
18,191 | [
-0.03173251077532768,
-0.05895237624645233,
0.019874824211001396,
0.02041490003466606,
-0.01024345587939024,
-0.049254998564720154,
0.01837461069226265,
0.04771878197789192,
0.02976422943174839,
0.014222021214663982,
0.003579508513212204,
-0.04159791022539139,
-0.017990555614233017,
-0.010... | 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount,
round=True, context=None):
context = context or {}
if not from_currency_id:
from_currency_id = to_currency_id
if not to_currency_id:
to_currency_id = from_currency_id
xc = se... | |
18,192 | [
0.006176019553095102,
0.01417643204331398,
-0.016698680818080902,
-0.010587461292743683,
0.0563468299806118,
-0.002117243129760027,
-0.03128385543823242,
0.03682681918144226,
0.034832946956157684,
0.03220103681087494,
0.006056386977434158,
-0.010537615045905113,
-0.017625831067562103,
-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 session(self):
def authenticate():
response = self.verifyUser(**self.auth.data)
if response.error:
print("Authentication failed with code {}".format(response.error))
raise ValueError
key = response.fetchone().get('sessionKey', None)
... | |
18,193 | [
-0.022279324010014534,
0.016203144565224648,
0.005440366920083761,
-0.041175320744514465,
-0.019218219444155693,
-0.0011723688803613186,
-0.0276650283485651,
0.022877736017107964,
-0.016295207664370537,
0.018251553177833557,
-0.01627219282090664,
-0.04524912312626839,
0.009465260431170464,
... | 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": "cr", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if operator in ['=', '!=']:
try:
date_format = '%Y-%m-%d'
if context.get('lang'):
lang_obj = self.pool['res.lang']
lang_ids = lang_obj.s... | |
18,194 | [
0.018488822504878044,
0.0014349400298669934,
-0.059030719101428986,
0.008183479309082031,
0.019215978682041168,
0.00908348336815834,
-0.04253263399004936,
0.07686391472816467,
-0.0026791507843881845,
0.009637790732085705,
0.030731258913874626,
-0.04446376860141754,
-0.0013045587111264467,
... | 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": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def handle_get(self, request, _page=None, _response=None, *args, **kwargs):
_is_bulk = kwargs.pop('_is_bulk', False)
data = kwargs.copy()
if _page:
data['pageNo'] = _page + 1
if _is_bulk:
data.update(requestName=request)
return data
data.updat... | |
18,195 | [
0.009346754290163517,
-0.013239500112831593,
0.005995245650410652,
0.00017921984544955194,
0.03622127324342728,
-0.007337930612266064,
-0.04696275666356087,
0.041612833738327026,
0.0020777792669832706,
0.01498811412602663,
0.0031277278903871775,
-0.051375921815633774,
0.04354879632592201,
... | 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": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def handle_csv(self, request, *args, **kwargs):
data = dict(request=request.replace('CSV', ''), responseType='CSV')
data.update(self.payload)
data.update(**kwargs)
r = requests.post(self.api_url, data=data, headers=self.headers)
retry, parsed_data = self._parse_response(r)
... | |
18,196 | [
0.05712047591805458,
0.021648863330483437,
-0.045050982385873795,
0.0010147904977202415,
0.023923011496663094,
0.01881570927798748,
-0.03168560191988945,
0.00707653583958745,
-0.015334611758589745,
-0.00222491635940969,
0.020518142729997635,
-0.054630350321531296,
0.059864699840545654,
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": "attr", "annotation": null, "type_comment": null}}], "kwarg": null... | def __getattr__(self, attr):
_attr = None
_is_bulk = len(attr) > 5 and attr.endswith('_bulk')
if _is_bulk:
attr = attr[:-5]
if attr in self.ERPLY_GET:
def method(*args, **kwargs):
_page = kwargs.pop('_page', 0)
_response = kwargs.po... | |
18,197 | [
0.0020706537179648876,
-0.01629786007106304,
-0.03517640754580498,
0.007806000765413046,
0.025806883350014687,
-0.002820448251441121,
-0.05114877596497536,
0.08174504339694977,
0.009293965063989162,
0.016344359144568443,
0.0110376738011837,
-0.0496143139898777,
-0.008021058514714241,
-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}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": {... | def handle_post(self, request, *args, **kwargs):
_is_bulk = kwargs.pop('_is_bulk', False)
data = kwargs.copy()
if _is_bulk:
data.update(requestName=request)
return data
data.update(request=request)
data.update(self.payload)
r = requests.post(self.a... | |
18,198 | [
0.025815678760409355,
-0.018827641382813454,
-0.02332312986254692,
-0.0012330602621659636,
0.012462741695344448,
0.0066764685325324535,
-0.02650558017194271,
0.049761947244405746,
-0.005060207098722458,
0.00007876146992202848,
-0.009936810471117496,
-0.06569644808769226,
0.02935420721769333,... | 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": "erply", "annotation": ... | class ErplyBulkRequest(object):
def __init__(self, erply, _json_dumps):
self.calls = []
self.erply = erply
self.json_dumper = _json_dumps
def attach(self, attr, *args, **kwargs):
if attr in self.erply.ERPLY_GET or attr in self.erply.ERPLY_POST:
self.calls.append((ge... | |
18,199 | [
0.014185859821736813,
0.01986219920217991,
-0.027952726930379868,
-0.004217350389808416,
0.05351121723651886,
-0.009202851913869381,
-0.00923776812851429,
0.025758009403944016,
0.018535392358899117,
0.026895273476839066,
0.00538204750046134,
-0.0004897588514722884,
-0.015831898897886276,
-... | 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 authenticate():
response = self.verifyUser(**self.auth.data)
if response.error:
print("Authentication failed with code {}".format(response.error))
raise ValueError
key = response.fetchone().get('sessionKey', None)
self._key = key
... | |
18,200 | [
0.04603548347949982,
-0.020255176350474358,
-0.011934720911085606,
0.017983974888920784,
0.03758399561047554,
0.0016051271231845021,
-0.01617138274013996,
0.03411168232560158,
-0.042039044201374054,
0.014347870834171772,
0.0254636500030756,
-0.03725641965866089,
0.0004487122059799731,
-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}}, {"_type": "arg", "_fields": {"arg": "erply", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, erply, data, request, page=0, *args, **kwargs):
self.request = request
self.erply = erply
self.error = None
# Result pagination setup
self.page = page
self.per_page = kwargs.get('recordsOnPage', 20)
self.kwargs = kwargs
status = data.... |