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 |
|---|---|---|---|---|---|
20,401 | [
0.015384667553007603,
-0.023039478808641434,
0.007348367944359779,
0.04520340636372566,
-0.011394660919904709,
-0.05268310755491257,
-0.033320941030979156,
-0.006235168315470219,
0.005537854973226786,
0.04030032455921173,
0.022826844826340675,
0.01968737132847309,
-0.018936900421977043,
-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_render_form_with_help_text(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
class Meta:
help_text = "Self-promotion is encouraged"
block = LinkBlock()
html = block.render_form(block.to_p... | |
20,402 | [
-0.005441984627395868,
-0.026764051988720894,
-0.0173505712300539,
0.016323000192642212,
0.016063155606389046,
-0.06137070432305336,
-0.0011316551826894283,
-0.021602582186460495,
0.032480645924806595,
0.005291392561048269,
0.012567057274281979,
0.02274826355278492,
-0.007181175518780947,
... | 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_render_form_uses_default_value(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock(default="Torchbox")
link = blocks.URLBlock(default="http://www.torchbox.com")
block = LinkBlock()
html = block.render_form(block.to_python({}), prefix='mylink')
... | |
20,403 | [
0.008314496837556362,
-0.007651232182979584,
-0.026625340804457664,
0.006372078787535429,
0.021591635420918465,
-0.03375543653964996,
-0.01813318394124508,
-0.023474832996726036,
0.005916084628552198,
-0.02923102304339409,
0.02719385363161564,
0.024256538599729538,
0.030889185145497322,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_media_inheritance(self):
class ScriptedCharBlock(blocks.CharBlock):
media = forms.Media(js=['scripted_char_block.js'])
class LinkBlock(blocks.StructBlock):
title = ScriptedCharBlock(default="Torchbox")
link = blocks.URLBlock(default="http://www.torchbox.com"... | |
20,404 | [
0.011963666416704655,
-0.014552817679941654,
0.02761017717421055,
0.034819625318050385,
0.03539995104074478,
-0.014441216364502907,
-0.029775243252515793,
-0.007800935301929712,
0.015099664218723774,
0.0009702343377284706,
0.033078644424676895,
-0.002195756882429123,
0.007047626189887524,
... | 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_html_declaration_inheritance(self):
class CharBlockWithDeclarations(blocks.CharBlock):
def html_declarations(self):
return '<script type="text/x-html-template">hello world</script>'
class LinkBlock(blocks.StructBlock):
title = CharBlockWithDeclarations(d... | |
20,405 | [
0.006145177874714136,
-0.028989208862185478,
-0.02979075349867344,
0.0010777717689052224,
-0.0038212540093809366,
-0.0433502197265625,
-0.019971827045083046,
-0.004046688787639141,
0.03172782063484192,
-0.0003621563664637506,
0.048716120421886444,
-0.0037043620832264423,
0.004625582136213779... | 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_searchable_content(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
block = LinkBlock()
content = block.get_searchable_content(block.to_python({
'title': "Wagtail site",
'link': 'http://www.w... | |
20,406 | [
0.01841084472835064,
-0.047589633613824844,
-0.028488237410783768,
0.008093515411019325,
0.023549027740955353,
-0.006794339045882225,
-0.013190732337534428,
-0.036072615534067154,
0.04330586642026901,
-0.015168757177889347,
0.05112433061003685,
0.009708707220852375,
0.02713053859770298,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_value_from_datadict(self):
block = blocks.StructBlock([
('title', blocks.CharBlock()),
('link', blocks.URLBlock()),
])
struct_val = block.value_from_datadict({
'mylink-title': "Torchbox",
'mylink-link': "http://www.torchbox.com"
}... | |
20,407 | [
0.011437725275754929,
-0.04444724693894386,
-0.03736323490738869,
-0.008516800589859486,
0.024904724210500717,
-0.025113800540566444,
-0.014905938878655434,
-0.012606094591319561,
0.07275868952274323,
0.031312309205532074,
0.05755758285522461,
-0.007871123030781746,
-0.020600203424692154,
... | 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_clean(self):
block = blocks.StructBlock([
('title', blocks.CharBlock()),
('link', blocks.URLBlock()),
])
value = block.to_python({'title': 'Torchbox', 'link': 'http://www.torchbox.com/'})
clean_value = block.clean(value)
self.assertTrue(isinstanc... | |
20,408 | [
0.02812536619603634,
0.003342769108712673,
-0.0466410294175148,
-0.008044485934078693,
0.023854387924075127,
-0.0025662274565547705,
0.00970070343464613,
-0.026742152869701385,
0.046471163630485535,
0.019995946437120438,
0.05299896374344826,
0.00008754104055697098,
0.0184671301394701,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_value_omitted_from_data(self):
block = blocks.StructBlock([
('title', blocks.CharBlock()),
('link', blocks.URLBlock()),
])
# overall value is considered present in the form if any sub-field is present
self.assertFalse(block.value_omitted_from_data({'myli... | |
20,409 | [
0.026149732992053032,
0.002657481236383319,
0.020638354122638702,
-0.032012902200222015,
0.021154312416911125,
0.005830921232700348,
0.008437099866569042,
-0.04660046473145485,
0.031332775950431824,
0.019336730241775513,
0.03245850279927254,
-0.02334713749587536,
-0.022479388862848282,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestStructBlockWithCustomStructValue(SimpleTestCase):
def test_initialisation(self):
class CustomStructValue(blocks.StructValue):
def joined(self):
return self.get('title', '') + self.get('link', '')
block = blocks.StructBlock([
('title', blocks.CharB... | |
20,410 | [
0.03392026200890541,
-0.018145719543099403,
0.0009055699338205159,
-0.01641101762652397,
0.013790247030556202,
-0.006826484110206366,
0.0016910212580114603,
-0.037339746952056885,
0.040933944284915924,
0.012161625549197197,
0.037439584732055664,
0.0052415416575968266,
-0.02170247957110405,
... | 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_initialisation(self):
class CustomStructValue(blocks.StructValue):
def joined(self):
return self.get('title', '') + self.get('link', '')
block = blocks.StructBlock([
('title', blocks.CharBlock()),
('link', blocks.URLBlock()),
], valu... | |
20,411 | [
0.012661591172218323,
-0.01032857596874237,
0.011325090192258358,
-0.03641379997134209,
-0.003476075828075409,
0.019508229568600655,
0.015815265476703644,
-0.04011848568916321,
-0.0032386709935963154,
0.02998921275138855,
0.04065777733922005,
-0.025885919108986855,
-0.02227502129971981,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_initialisation_with_multiple_subclassses(self):
class LinkStructValue(blocks.StructValue):
def url(self):
return self.get('page') or self.get('link')
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
page = blocks.PageChooserBlo... | |
20,412 | [
-0.005361451301723719,
-0.0045851957984268665,
-0.016727060079574585,
-0.028379244729876518,
0.010778548195958138,
-0.01707206293940544,
0.014512366615235806,
-0.027666982263326645,
0.014312042854726315,
0.02639826200902462,
0.04146708548069,
-0.008252239786088467,
-0.032207660377025604,
-... | 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_initialisation_from_subclass(self):
class LinkStructValue(blocks.StructValue):
def url(self):
return self.get('page') or self.get('link')
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
page = blocks.PageChooserBlock(required... | |
20,413 | [
0.025885453447699547,
0.0015661787474527955,
-0.02029506489634514,
-0.0013738052221015096,
0.020175427198410034,
0.03199790045619011,
-0.014943955466151237,
-0.03019244410097599,
0.030040176585316658,
-0.027342868968844414,
0.04352671653032303,
0.0002904296270571649,
0.006895536556839943,
... | 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_value_property(self):
class SectionStructValue(blocks.StructValue):
@property
def foo(self):
return 'bar %s' % self.get('title', '')
class SectionBlock(blocks.StructBlock):
title = blocks.CharBlock()
body = blocks.RichTextBlock()... | |
20,414 | [
0.008770270273089409,
-0.010719219222664833,
-0.023048946633934975,
-0.03937577083706856,
0.012312222272157669,
-0.02397090569138527,
0.02359745465219021,
-0.01570829562842846,
0.013479257933795452,
0.024227652698755264,
0.0289891567081213,
-0.011051824316382408,
-0.044534068554639816,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_initialisation_with_mixins(self):
class LinkStructValue(blocks.StructValue):
pass
class StylingMixinStructValue(blocks.StructValue):
pass
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
... | |
20,415 | [
-0.009903181344270706,
-0.0382169745862484,
-0.01474399771541357,
0.006618736777454615,
-0.005286681465804577,
-0.06894563883543015,
-0.019773129373788834,
-0.023528363555669785,
-0.0012323589762672782,
0.021157803013920784,
0.01568557508289814,
0.003353677922859788,
-0.006890132557600737,
... | 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 render(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
block = blocks.ListBlock(LinkBlock())
return block.render([
{
'title': "Wagtail",
'link': 'http://www.wagtail.io',
... | |
20,416 | [
0.04124363139271736,
-0.026612386107444763,
0.033894605934619904,
-0.015789274126291275,
0.016780279576778412,
0.007933609187602997,
0.004253528080880642,
-0.029507458209991455,
0.02981923520565033,
0.0027725875843316317,
0.02166849561035633,
-0.010505768470466137,
-0.012203838676214218,
-... | 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_render_with_template(self):
class SectionStructValue(blocks.StructValue):
def title_with_suffix(self):
title = self.get('title')
if title:
return 'SUFFIX %s' % title
return 'EMPTY TITLE'
class SectionBlock(blocks.... | |
20,417 | [
0.033461060374975204,
-0.002591991564258933,
0.0374310165643692,
-0.01165583822876215,
0.015040935017168522,
-0.0705612450838089,
0.010190735571086407,
0.014910966157913208,
0.0248358566313982,
0.02352435328066349,
0.028096891939640045,
-0.028238676488399506,
-0.00808760430663824,
-0.00798... | 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_render_form_values(self):
html = self.render_form()
self.assertInHTML(
(
'<input id="links-0-value-title" name="links-0-value-title" placeholder="Title"'
' type="text" value="Wagtail" />'
),
html
)
self.assertI... | |
20,418 | [
-0.007427380885928869,
-0.03294976428151131,
-0.009058449417352676,
0.016562456265091896,
-0.0038122113328427076,
-0.0669066309928894,
0.00006418396515073255,
-0.005136770196259022,
-0.003125301795080304,
0.028680527582764626,
0.009069396182894707,
0.006004301365464926,
0.007657262962311506,... | 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 render_form(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
block = blocks.ListBlock(LinkBlock)
html = block.render_form([
{
'title': "Wagtail",
'link': 'http://www.wagtail.i... | |
20,419 | [
-0.031275734305381775,
-0.018315663561224937,
0.008050777018070221,
0.027519864961504936,
0.021851282566785812,
-0.04741206392645836,
-0.018188148736953735,
-0.03173942118883133,
0.044699493795633316,
0.00098171376157552,
0.026105616241693497,
0.001954733394086361,
0.008444911800324917,
-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_html_declarations_uses_default(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock(default="Github")
link = blocks.URLBlock(default="http://www.github.com")
block = blocks.ListBlock(LinkBlock)
html = block.html_declarations()
self.asser... | |
20,420 | [
-0.026186082512140274,
-0.017811967059969902,
0.0023156122770160437,
0.01592213287949562,
0.012742233462631702,
-0.038407761603593826,
-0.014541536569595337,
-0.018445683643221855,
0.0401504822075367,
0.00570345064625144,
0.047845613211393356,
0.0031968746334314346,
0.007717764936387539,
-... | 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_html_declarations(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
block = blocks.ListBlock(LinkBlock)
html = block.html_declarations()
self.assertTagInTemplateScript(
'<input id="__PREFIX__-val... | |
20,421 | [
0.04193047806620598,
-0.0034983123186975718,
-0.03919588029384613,
-0.006195954978466034,
0.01350052934139967,
-0.004908723756670952,
0.00104010128416121,
-0.01664162054657936,
0.05336158350110054,
0.03389913961291313,
0.057204797863960266,
0.004871769808232784,
0.019388534128665924,
-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_value_omitted_from_data(self):
block = blocks.ListBlock(blocks.CharBlock())
# overall value is considered present in the form if the 'count' field is present
self.assertFalse(block.value_omitted_from_data({'mylist-count': '0'}, {}, 'mylist'))
self.assertFalse(block.value_omitte... | |
20,422 | [
0.008428603410720825,
-0.03478330001235008,
-0.027056150138378143,
-0.007949831895530224,
-0.002690305467694998,
-0.0435570627450943,
-0.01859414577484131,
-0.00311479764059186,
0.035250935703516006,
0.0035573828499764204,
0.046496495604515076,
-0.007793952710926533,
0.002043129177764058,
... | 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_searchable_content(self):
class LinkBlock(blocks.StructBlock):
title = blocks.CharBlock()
link = blocks.URLBlock()
block = blocks.ListBlock(LinkBlock())
content = block.get_searchable_content([
{
'title': "Wagtail",
'l... | |
20,423 | [
0.02038094401359558,
-0.023814555257558823,
-0.016285134479403496,
0.005907652899622917,
0.01586819440126419,
-0.00989616196602583,
-0.016738861799240112,
-0.03001958504319191,
0.006652624346315861,
0.016518129035830498,
0.03146660700440407,
-0.01251429133117199,
-0.026929333806037903,
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_ordering_in_form_submission_is_numeric(self):
block = blocks.ListBlock(blocks.CharBlock())
# check that items are ordered by 'order' numerically, not alphabetically
post_data = {'shoppinglist-count': '12'}
for i in range(0, 12):
post_data.update({
's... | |
20,424 | [
0.014981970191001892,
-0.012906083837151527,
-0.018801601603627205,
-0.01977430284023285,
-0.0021722670644521713,
-0.034922342747449875,
-0.014139753766357899,
-0.023748142644762993,
0.00478047039359808,
0.021945087239146233,
0.0272830817848444,
-0.006058623548597097,
-0.005661239381879568,
... | 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_ordering_in_form_submission_uses_order_field(self):
block = blocks.ListBlock(blocks.CharBlock())
# check that items are ordered by the 'order' field, not the order they appear in the form
post_data = {'shoppinglist-count': '3'}
for i in range(0, 3):
post_data.update... | |
20,425 | [
0.013349330984055996,
-0.01615586318075657,
0.008639237843453884,
0.003849830012768507,
0.018205851316452026,
-0.045319393277168274,
-0.017742164433002472,
-0.03506945073604584,
0.03326350823044777,
-0.0030856600496917963,
0.008023020811378956,
-0.0046216263435781,
-0.011390860192477703,
-... | 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_can_specify_default(self):
class ShoppingListBlock(blocks.StructBlock):
shop = blocks.CharBlock()
items = blocks.ListBlock(blocks.CharBlock(), default=['peas', 'beans', 'carrots'])
block = ShoppingListBlock()
# the value here does not specify an 'items' field, s... | |
20,426 | [
0.04383758455514908,
-0.008546832948923111,
0.013777170330286026,
0.029349736869335175,
0.03810229152441025,
-0.06533246487379074,
0.009968187659978867,
0.010778609663248062,
-0.008309940807521343,
0.027055619284510612,
0.020796669647097588,
-0.03216751292347908,
-0.02937467209994793,
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_form_render(self):
block = blocks.PageChooserBlock(help_text="pick a page, any page")
empty_form_html = block.render_form(None, 'page')
self.assertInHTML('<input id="page" name="page" placeholder="" type="hidden" />', empty_form_html)
self.assertIn('createPageChooser("page", ["... | |
20,427 | [
0.050095461308956146,
0.007290294393897057,
0.0021184254437685013,
-0.004594404250383377,
0.01893451437354088,
-0.03333790972828865,
-0.001971290446817875,
-0.021946823224425316,
0.03599582985043526,
0.06277753412723541,
0.05649977922439575,
-0.022351840510964394,
-0.05133582279086113,
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_clean(self):
required_block = blocks.PageChooserBlock()
nonrequired_block = blocks.PageChooserBlock(required=False)
christmas_page = Page.objects.get(slug='christmas')
self.assertEqual(required_block.clean(christmas_page), christmas_page)
with self.assertRaises(Validati... | |
20,428 | [
0.022378694266080856,
-0.022476471960544586,
-0.014642095193266869,
0.012301560491323471,
0.0427774079144001,
-0.04871735721826553,
0.0031991389114409685,
0.015314311720430851,
0.03490636497735977,
0.017062073573470116,
0.030164184048771858,
-0.02935752272605896,
-0.031019730493426323,
-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_response(self):
block = blocks.PageChooserBlock()
christmas_page = Page.objects.get(slug='christmas')
value = block.value_from_datadict({'page': str(christmas_page.id)}, {}, 'page')
self.assertEqual(value, christmas_page)
empty_value = block.value_from_datadict({'... | |
20,429 | [
0.007700300309807062,
-0.019155720248818398,
-0.0032166175078600645,
-0.01654095947742462,
0.029188573360443115,
-0.011409345082938671,
-0.023221848532557487,
-0.06938908994197845,
0.042872875928878784,
0.03354267030954361,
-0.01055119652301073,
-0.02258831448853016,
-0.01007892657071352,
... | 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 TestStaticBlock(unittest.TestCase):
def test_render_form_with_constructor(self):
block = blocks.StaticBlock(
admin_text="Latest posts - This block doesn't need to be configured, it will be displayed automatically",
template='tests/blocks/posts_static_block.html')
render... | |
20,430 | [
0.014793387614190578,
-0.002225252566859126,
-0.0013333066599443555,
-0.011716635897755623,
0.0317666158080101,
-0.03578569367527962,
-0.006153504364192486,
-0.04709361121058464,
0.03360585495829582,
0.032743003219366074,
-0.019800206646323204,
-0.03335608169436455,
-0.021741624921560287,
... | 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_render_form_with_subclass(self):
class PostsStaticBlock(blocks.StaticBlock):
class Meta:
admin_text = "Latest posts - This block doesn't need to be configured, it will be displayed automatically"
template = "tests/blocks/posts_static_block.html"
bloc... | |
20,431 | [
0.02064717374742031,
0.031038235872983932,
-0.0004768895742017776,
0.02147935889661312,
0.024898063391447067,
-0.008125045336782932,
0.0006399527774192393,
-0.0544743537902832,
-0.0002124390157405287,
0.013258724473416805,
-0.032117828726768494,
-0.02126569114625454,
-0.03270260617136955,
... | 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_render_form_with_subclass_displays_default_text_if_no_admin_text(self):
class LabelOnlyStaticBlock(blocks.StaticBlock):
class Meta:
label = "Latest posts"
block = LabelOnlyStaticBlock()
rendered_html = block.render_form(None)
self.assertEqual(render... | |
20,432 | [
0.007275442127138376,
0.03117888793349266,
0.009302843362092972,
0.009800026193261147,
0.012473764829337597,
-0.01598719134926796,
0.012827317230403423,
-0.07972603291273117,
0.01271683257073164,
0.01730196364223957,
-0.02324606105685234,
-0.02146724984049797,
-0.019843120127916336,
0.0158... | 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_render_form_with_subclass_displays_default_text_if_no_admin_text_and_no_label(self):
class NoMetaStaticBlock(blocks.StaticBlock):
pass
block = NoMetaStaticBlock()
rendered_html = block.render_form(None)
self.assertEqual(rendered_html, "This block has no options.") | |
20,433 | [
-0.0040628304705023766,
-0.025656240060925484,
0.025371959432959557,
-0.021581564098596573,
0.02301480807363987,
-0.029304495081305504,
-0.0023823229130357504,
-0.04105472192168236,
0.03212360292673111,
0.016962019726634026,
0.015256342478096485,
-0.003476503537967801,
-0.023417538031935692,... | 8 | {"_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 TestDateBlock(TestCase):
def test_render_form(self):
block = blocks.DateBlock()
value = date(2015, 8, 13)
result = block.render_form(value, prefix='dateblock')
# we should see the JS initialiser code:
# <script>initDateChooser("dateblock", {"dayOfWeekStart": 0, "forma... | |
20,434 | [
0.02437712252140045,
-0.020263254642486572,
0.010964196175336838,
-0.0003026479098480195,
0.0070094941183924675,
-0.05622287839651108,
0.016247333958745003,
-0.015549445524811745,
0.027597205713391304,
0.004285280127078295,
0.012231414206326008,
0.00325069110840559,
-0.025246422737836838,
... | 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_render_form(self):
block = blocks.DateBlock()
value = date(2015, 8, 13)
result = block.render_form(value, prefix='dateblock')
# we should see the JS initialiser code:
# <script>initDateChooser("dateblock", {"dayOfWeekStart": 0, "format": "Y-m-d"});</script>
# ex... | |
20,435 | [
-0.0004968517459928989,
-0.03637818619608879,
0.020986584946513176,
0.002929805079475045,
0.02730524353682995,
-0.022768771275877953,
0.018837161362171173,
-0.04056902229785919,
0.0361405611038208,
0.011049550026655197,
0.007820013910531998,
0.015056767500936985,
-0.010325875133275986,
-0.... | 8 | {"_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 TestDateTimeBlock(TestCase):
def test_render_form_with_format(self):
block = blocks.DateTimeBlock(format='%d.%m.%Y %H:%M')
value = datetime(2015, 8, 13, 10, 0)
result = block.render_form(value, prefix='datetimeblock')
self.assertIn(
'"format": "d.m.Y H:i"',
... | |
20,436 | [
0.011604527942836285,
-0.0322185717523098,
0.010385659523308277,
0.0013782483292743564,
0.013536743819713593,
-0.05625893175601959,
0.016996758058667183,
-0.00851522944867611,
0.02606244385242462,
0.008796075358986855,
0.0015629041008651257,
0.010542932897806168,
-0.046957336366176605,
-0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_render_form_with_format(self):
block = blocks.DateBlock(format='%d.%m.%Y')
value = date(2015, 8, 13)
result = block.render_form(value, prefix='dateblock')
self.assertIn('<script>initDateChooser("dateblock", {', result)
self.assertIn('"dayOfWeekStart": 0', result)
... | |
20,437 | [
0.014826608821749687,
-0.0376160703599453,
0.014591087587177753,
0.006555335130542517,
0.0265577994287014,
-0.04452468827366829,
0.024337172508239746,
-0.009774122387170792,
0.03393745794892311,
0.017036020755767822,
0.008557263761758804,
0.024359602481126785,
-0.03223273530602455,
-0.0403... | 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_render_form_with_format(self):
block = blocks.DateTimeBlock(format='%d.%m.%Y %H:%M')
value = datetime(2015, 8, 13, 10, 0)
result = block.render_form(value, prefix='datetimeblock')
self.assertIn(
'"format": "d.m.Y H:i"',
result
)
self.asser... | |
20,438 | [
0.03518136218190193,
0.016991738229990005,
0.03249914199113846,
-0.01798129454255104,
-0.0037336251698434353,
0.010820026509463787,
-0.019374487921595573,
-0.06494619697332382,
0.0470820888876915,
0.03463450074195862,
0.010598678141832352,
-0.02449153922498226,
-0.014231394045054913,
0.034... | 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 TestSystemCheck(TestCase):
def test_name_must_be_nonempty(self):
block = blocks.StreamBlock([
('heading', blocks.CharBlock()),
('', blocks.RichTextBlock()),
])
errors = block.check()
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].id... | |
20,439 | [
0.07016336917877197,
0.008596871979534626,
0.01913997158408165,
-0.004152779001742601,
0.026156308129429817,
-0.036098185926675797,
-0.0026791621930897236,
-0.03126360848546028,
0.04891601577401161,
0.015135949477553368,
0.02732156589627266,
-0.01927633211016655,
-0.018247434869408607,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_name_must_be_nonempty(self):
block = blocks.StreamBlock([
('heading', blocks.CharBlock()),
('', blocks.RichTextBlock()),
])
errors = block.check()
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].id, 'wagtailcore.E001')
self.as... | |
20,440 | [
0.07937949895858765,
0.0016265534795820713,
0.04377690702676773,
0.008537482470273972,
0.004659606143832207,
-0.03552872687578201,
-0.001348023535683751,
-0.016287079080939293,
0.06657635420560837,
0.01677950657904148,
0.009473096579313278,
-0.01172595750540495,
-0.013295574113726616,
0.02... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_name_cannot_contain_spaces(self):
block = blocks.StreamBlock([
('heading', blocks.CharBlock()),
('rich text', blocks.RichTextBlock()),
])
errors = block.check()
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].id, 'wagtailcore.E001')
... | |
20,441 | [
0.07308905571699142,
-0.0013715316308662295,
0.02920004166662693,
0.010038308799266815,
0.00307343783788383,
-0.011067553423345089,
-0.002751004882156849,
0.008608803153038025,
0.03987368568778038,
0.009987481869757175,
-0.0024746337439864874,
-0.029276283457875252,
-0.030216580256819725,
... | 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_name_cannot_begin_with_digit(self):
block = blocks.StreamBlock([
('heading', blocks.CharBlock()),
('99richtext', blocks.RichTextBlock()),
])
errors = block.check()
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].id, 'wagtailcore.E001'... | |
20,442 | [
0.06202317029237747,
-0.02399032562971115,
0.03226581960916519,
0.0082939388230443,
0.015100010670721531,
-0.00017435947665944695,
-0.003861077595502138,
-0.015468903817236423,
0.07451634109020233,
0.0022302642464637756,
-0.008546016179025173,
-0.009535877965390682,
-0.012677614577114582,
... | 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_name_cannot_contain_dashes(self):
block = blocks.StreamBlock([
('heading', blocks.CharBlock()),
('rich-text', blocks.RichTextBlock()),
])
errors = block.check()
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].id, 'wagtailcore.E001')
... | |
20,443 | [
0.015992389991879463,
0.037521108984947205,
0.058616895228624344,
-0.006507157348096371,
-0.01378835178911686,
-0.019324682652950287,
-0.013007755391299725,
-0.0346873477101326,
0.03355909138917923,
0.05950900539755821,
0.007379589136689901,
0.003309335559606552,
-0.0268026664853096,
0.021... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_system_checks_recurse_into_lists(self):
failing_block = blocks.RichTextBlock()
block = blocks.StreamBlock([
('paragraph_list', blocks.ListBlock(
blocks.StructBlock([
('heading', blocks.CharBlock()),
('rich text', failing_block)... | |
20,444 | [
0.04255043715238571,
0.034115564078092575,
0.046364933252334595,
-0.005681450478732586,
-0.009838445112109184,
-0.017944250255823135,
-0.007917765527963638,
-0.050850994884967804,
0.028554996475577354,
0.04118044301867485,
0.015513179823756218,
-0.011168146505951881,
-0.04910492151975632,
... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_system_checks_recurse_into_streams(self):
failing_block = blocks.RichTextBlock()
block = blocks.StreamBlock([
('carousel', blocks.StreamBlock([
('text', blocks.StructBlock([
('heading', blocks.CharBlock()),
('rich text', failin... | |
20,445 | [
0.027665115892887115,
0.037260983139276505,
0.05968327820301056,
-0.010328218340873718,
-0.021327190101146698,
-0.004089536610990763,
0.0013534825993701816,
-0.05166162550449371,
0.037260983139276505,
0.04270913451910019,
0.014770242385566235,
-0.01613912545144558,
-0.017343740910291672,
0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_system_checks_recurse_into_structs(self):
failing_block_1 = blocks.RichTextBlock()
failing_block_2 = blocks.RichTextBlock()
block = blocks.StreamBlock([
('two_column', blocks.StructBlock([
('left', blocks.StructBlock([
('heading', blocks.C... | |
20,446 | [
0.017618520185351372,
-0.06304178386926651,
0.014864590018987656,
0.007542894687503576,
0.00767008401453495,
-0.0160811860114336,
0.0068792966194450855,
-0.0015221273060888052,
-0.0008156722178682685,
0.005917080212384462,
-0.010363184846937656,
0.002817525528371334,
0.019288575276732445,
... | 8 | {"_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 TestTemplateRendering(TestCase):
def test_render_with_custom_context(self):
block = CustomLinkBlock()
value = block.to_python({'title': 'Torchbox', 'url': 'http://torchbox.com/'})
context = {'classname': 'important'}
result = block.render(value, context)
self.assertEqu... | |
20,447 | [
0.049556463956832886,
0.025791887193918228,
0.02367447502911091,
0.011493721045553684,
0.014427688904106617,
0.05014213174581528,
0.026783015578985214,
0.028044452890753746,
0.020993920043110847,
0.010249177925288677,
-0.0007588333683088422,
-0.014416426420211792,
-0.036333899945020676,
-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 next(self, ):
self._current = current = self._next
if current.datetime > self.end:
raise StopIteration()
# Increment to next timestep
self._next = _core.Timestep(current.datetime + self.delta, current.index + 1, self.delta.days)
# Return this timestep
re... | |
20,448 | [
0.015420746058225632,
-0.004288289695978165,
0.005707271862775087,
-0.023592716082930565,
0.00019660596444737166,
0.01844106987118721,
0.01726713217794895,
0.016925208270549774,
0.031092235818505287,
-0.01726713217794895,
0.027308283373713493,
0.015397951006889343,
-0.023455945774912834,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fie... | def start():
def fget(self):
return self._start
def fset(self, value):
if isinstance(value, pandas.Timestamp):
self._start = value
else:
self._start = pandas.to_datetime(value)
return locals() | |
20,449 | [
0.058093197643756866,
-0.017375271767377853,
0.0156572163105011,
-0.03255143389105797,
0.0021762042306363583,
0.022059837356209755,
-0.00783433485776186,
0.005944473668932915,
0.027947044000029564,
-0.035529397428035736,
0.0559857152402401,
-0.016195541247725487,
-0.02824483998119831,
-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": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fie... | def end():
def fget(self):
return self._end
def fset(self, value):
if isinstance(value, pandas.Timestamp):
self._end = value
else:
self._end = pandas.to_datetime(value)
return locals() | |
20,450 | [
0.022328222170472145,
-0.00973529927432537,
0.015414223074913025,
0.002489826874807477,
0.022945759817957878,
0.019119448959827423,
-0.0033752669114619493,
0.03433993458747864,
0.01697622984647751,
0.012138851918280125,
0.02801925502717495,
0.02576705999672413,
-0.029109027236700058,
-0.04... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fie... | def delta():
def fget(self):
return self._delta
def fset(self, value):
try:
self._delta = pandas.Timedelta(days=value)
except TypeError:
self._delta = pandas.to_timedelta(value)
return locals() | |
20,451 | [
0.04551820829510689,
0.012917020358145237,
0.0773649513721466,
-0.029194751754403114,
0.009041913785040379,
-0.03303556516766548,
0.012871296145021915,
0.04993056878447533,
-0.014928874559700489,
-0.03157239779829979,
0.043712109327316284,
-0.07238103449344635,
0.0010595100466161966,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def start(self):
# We may have just forked from parent process. A quick disposal of the
# existing sql connections avoids producing 500 errors later when they
# are discovered to be broken.
if CONF.database.connection:
api.get_engine().pool.dispose()
self._server = s... | |
20,452 | [
-0.004190477076917887,
-0.0037783444859087467,
0.022836025804281235,
0.02701820619404316,
-0.022592619061470032,
0.028567161411046982,
-0.01894151046872139,
-0.039852406829595566,
-0.02451774850487709,
-0.0232564564794302,
0.022659003734588623,
0.032395292073488235,
0.020413018763065338,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "host", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _get_socket(self, host, port, backlog):
bind_addr = (host, port)
# TODO(dims): eventlet's green dns/socket module does not actually
# support IPv6 in getaddrinfo(). We need to get around this in the
# future or monitor upstream for a fix
try:
info = socket.getaddr... | |
20,453 | [
-0.022609420120716095,
0.03053681179881096,
0.056111957877874374,
-0.026319393888115883,
0.02841682732105255,
-0.013092038221657276,
0.01345288660377264,
0.02313941717147827,
0.051240500062704086,
0.021853893995285034,
-0.002988277468830347,
-0.026251735165715218,
-0.018561149016022682,
-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": "application", "annotation": null, "type_comment": null}}, {"_type... | def _launch(self, application, workers=0):
service = WorkerService(self, application)
if workers < 1:
# The API service should run in the current process.
self._server = service
service.start()
systemd.notify_once()
else:
# The API serv... | |
20,454 | [
0.017969321459531784,
-0.0036541710142046213,
-0.024429284036159515,
-0.00960817001760006,
0.032524678856134415,
-0.042521264404058456,
-0.028579195961356163,
-0.022528091445565224,
0.01772400736808777,
0.004075806122273207,
-0.019359439611434937,
-0.022814292460680008,
-0.012735935859382153... | 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 get_content_type(self):
allowed_types = ("application/json")
if "Content-Type" not in self.headers:
LOG.debug("Missing Content-Type")
return None
_type = self.content_type
if _type in allowed_types:
return _type
return None | |
20,455 | [
0.005740270018577576,
0.021952245384454727,
-0.022577723488211632,
0.041765760630369186,
0.06065114587545395,
0.0051021818071603775,
-0.04422731697559357,
-0.03528904169797897,
0.004206840880215168,
-0.02635076455771923,
-0.038174308836460114,
-0.023768147453665733,
0.04029286280274391,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "datastring", "annotati... | class JSONDeserializer(TextDeserializer):
def _from_json(self, datastring):
try:
return jsonutils.loads(datastring)
except ValueError:
msg = _("Cannot understand JSON")
raise exception.MalformedRequestBody(reason=msg)
def default(self, datastring):
r... | |
20,456 | [
0.07777559012174606,
-0.0014394494937732816,
0.004102490842342377,
0.0075991484336555,
0.011658705770969391,
-0.009989087469875813,
0.012212065048515797,
-0.020646022632718086,
0.028583865612745285,
-0.02949977107346058,
-0.021638253703713417,
-0.010361174121499062,
0.00914950855076313,
-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": "body_serializers", "annotation": null, "type_comment": null}}, {"... | def __init__(self, body_serializers=None, headers_serializer=None):
self.body_serializers = {
'application/json': JSONDictSerializer(),
}
self.body_serializers.update(body_serializers or {})
self.headers_serializer = (headers_serializer or
... | |
20,457 | [
0.08081397414207458,
-0.006155133247375488,
0.00626902561634779,
0.007294055540114641,
0.019401296973228455,
-0.010557316243648529,
-0.007705057971179485,
-0.0015536388382315636,
0.02351132035255432,
-0.021193861961364746,
-0.020381759852170944,
-0.02408573403954506,
0.004625015426427126,
... | 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": "body_deserializers", "annotation": null, "type_comment": null}}, ... | def __init__(self, body_deserializers=None, headers_deserializer=None):
self.body_deserializers = {
'application/json': JSONDeserializer(),
}
self.body_deserializers.update(body_deserializers or {})
self.headers_deserializer = (headers_deserializer or
... | |
20,458 | [
0.07127033919095993,
0.02013019099831581,
-0.044023625552654266,
-0.0191105417907238,
0.050793252885341644,
-0.03868360444903374,
-0.03824210539460182,
-0.015641631558537483,
0.02783537656068802,
-0.031199168413877487,
-0.01068529486656189,
-0.05314790830016136,
-0.011794294230639935,
-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}}, {"_type": "... | def deserialize_body(self, request, action):
try:
content_type = request.best_match_content_type()
except exception.InvalidContentType:
LOG.debug("Unrecognized Content-Type provided in request")
return {}
if content_type is None:
LOG.debug("No Con... | |
20,459 | [
0.024226512759923935,
-0.014695810154080391,
0.02845251001417637,
-0.02604128047823906,
0.0070433286018669605,
-0.05248866230249405,
-0.03896039351820946,
0.028300222009420395,
0.00489225797355175,
0.03416331857442856,
0.005504583474248648,
-0.05736188590526581,
-0.04723472148180008,
-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": "req", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __call__(self, req):
print(("*" * 40) + " REQUEST ENVIRON")
for key, value in req.environ.items():
print(key, "=", value)
print()
resp = req.get_response(self.application)
print(("*" * 40) + " RESPONSE HEADERS")
for (key, value) in resp.headers.iteritems(... | |
20,460 | [
0.039334822446107864,
0.011858292855322361,
-0.04754886031150818,
-0.044733721762895584,
-0.026608850806951523,
-0.001801640959456563,
0.03688604012131691,
-0.02238614298403263,
0.03802366182208061,
-0.01852014660835266,
0.03567128628492355,
0.023465922102332115,
-0.0004684869199991226,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def filename_to_title(filename):
title = os.path.splitext(filename)[0]
title = title.replace('-', ' ').replace('_', ' ')
# Capitalize if the filename was all lowercase, otherwise leave it as-is.
if title.lower() == title:
title = title.capitalize()
return title | |
20,461 | [
0.0015455612447112799,
0.004839116707444191,
0.04742719978094101,
0.02447192184627056,
0.017698442563414574,
0.01242875400930643,
0.0009936898713931441,
-0.020526081323623657,
0.04958648979663849,
0.025217389687895775,
0.02532021328806877,
-0.0503319576382637,
0.04164339601993561,
0.011387... | 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_marching_cubes_isotropic():
ellipsoid_isotropic = ellipsoid(6, 10, 16, levelset=True)
_, surf = ellipsoid_stats(6, 10, 16)
verts, faces = marching_cubes(ellipsoid_isotropic, 0.)
surf_calc = mesh_surface_area(verts, faces)
# Test within 1% tolerance for isotropic. Will always underestimate.... | |
20,462 | [
0.013784892857074738,
0.015859190374612808,
0.06280659884214401,
0.0010035074083134532,
0.008074008859694004,
0.01328601036220789,
0.010023586452007294,
-0.039542946964502335,
0.04526695981621742,
0.018904995173215866,
0.0032771939877420664,
-0.06348927319049835,
0.033556368201971054,
0.02... | 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": "Tuple", "_fields": {"... | def test_marching_cubes_anisotropic():
spacing = (1., 10 / 6., 16 / 6.)
ellipsoid_anisotropic = ellipsoid(6, 10, 16, spacing=spacing,
levelset=True)
_, surf = ellipsoid_stats(6, 10, 16)
verts, faces = marching_cubes(ellipsoid_anisotropic, 0.,
... | |
20,463 | [
0.006682014558464289,
-0.0060259620659053326,
0.04795777052640915,
-0.02649201825261116,
0.002716195536777377,
-0.009747062809765339,
0.0189526230096817,
-0.013461221940815449,
-0.012787813320755959,
0.029157880693674088,
0.019133124500513077,
-0.04837431386113167,
-0.022215528413653374,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "orm", "annotation": nu... | class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'LinkedInAddToProfileConfiguration.trk_partner_name'
db.add_column('student_linkedinaddtoprofileconfiguration', 'trk_partner_name',
self.gf('django.db.models.fields.CharField')(default='', max_length=10,... | |
20,464 | [
-0.008497247472405434,
-0.005437616258859634,
0.07739032059907913,
0.029731029644608498,
-0.005148149561136961,
0.037450142204761505,
0.010956157930195332,
-0.0030113873071968555,
0.02354329079389572,
0.03881965950131416,
0.02963142842054367,
-0.035582613199949265,
0.024365002289414406,
-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_correct_mesh_orientation():
sphere_small = ellipsoid(1, 1, 1, levelset=True)
verts, faces = marching_cubes(sphere_small, 0.)
# Correct mesh orientation - descent
corrected_faces1 = correct_mesh_orientation(sphere_small, verts, faces,
gradient_dir... | |
20,465 | [
0.03912974148988724,
-0.012669270858168602,
-0.027267472818493843,
0.004100618418306112,
-0.010412290692329407,
0.013331931084394455,
-0.010766584426164627,
0.05574216693639755,
-0.008286530151963234,
0.0005949997575953603,
0.025338541716337204,
-0.03511441498994827,
-0.020076628774404526,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, "targets": [{"_type": "Name", "_fields": {"id": "stopit", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_typ... | class SuckerThread(websucker.Sucker):
stopit = 0
savedir = None
rootdir = None
def __init__(self, msgq):
self.msgq = msgq
websucker.Sucker.__init__(self)
self.setflags(verbose=VERBOSE)
self.urlopener.addheaders = [
('User-agent', 'websucker/%s' % websucker._... | |
20,466 | [
0.0029519645031541586,
0.0043273791670799255,
0.049597736448049545,
0.0013731959043070674,
-0.023935167118906975,
-0.010423569940030575,
0.046900149434804916,
-0.013073830865323544,
-0.02981543354690075,
-0.04131567105650902,
0.004984028171747923,
-0.0069214398972690105,
-0.01316848304122686... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Try", "_fields": {"... | class MySQLToGCSSystemTest(GoogleSystemTest):
@staticmethod
def init_db():
try:
hook = MySqlHook()
hook.run(CREATE_QUERY)
hook.run(LOAD_QUERY)
except (OperationalError, ProgrammingError):
pass
@staticmethod
def drop_db():
hook = My... | |
20,467 | [
0.00449316157028079,
0.014392929151654243,
0.02436676062643528,
-0.006813805550336838,
-0.022107835859060287,
-0.006474349647760391,
0.005533130839467049,
0.060879871249198914,
-0.017256703227758408,
0.04100627079606056,
0.012282131239771843,
-0.00624907435849309,
0.011134153231978416,
-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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def run1(self, url):
try:
try:
self.reset()
self.addroot(url)
self.run()
except Canceled:
self.message("[canceled]")
else:
self.message("[done]")
finally:
self.msgq.put(None) | |
20,468 | [
0.011670255102217197,
-0.030065007507801056,
-0.02858995646238327,
-0.03717995807528496,
0.006588921882212162,
-0.007798246573656797,
0.006816687062382698,
0.02431664802134037,
0.022993439808487892,
0.02148585021495819,
0.016475016251206398,
-0.031496673822402954,
-0.02031448669731617,
-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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def savefilename(self, url):
path = websucker.Sucker.savefilename(self, url)
if self.savedir:
n = len(self.rootdir)
if path[:n] == self.rootdir:
path = path[n:]
while path[:1] == os.sep:
path = path[1:]
path = os... | |
20,469 | [
0.007724031340330839,
-0.016062164679169655,
0.009859739802777767,
-0.011094765737652779,
-0.008740710094571114,
0.0030585662461817265,
-0.01090371236205101,
0.030841538682579994,
-0.048527657985687256,
0.016430625692009926,
0.020333580672740936,
-0.016580738127231598,
-0.05090218409895897,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "sucker", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_... | class App:
sucker = None
msgq = None
def __init__(self, top):
self.top = top
top.columnconfigure(99, weight=1)
self.url_label = Label(top, text="URL:")
self.url_label.grid(row=0, column=0, sticky='e')
self.url_entry = Entry(top, width=60, exportselection=0)
... | |
20,470 | [
0.01798320934176445,
-0.013894977048039436,
0.025432322174310684,
-0.002520659239962697,
-0.020253056660294533,
-0.004313963931053877,
-0.0009358417592011392,
0.0009875716641545296,
-0.06275312602519989,
0.035615283995866776,
-0.0031790402717888355,
0.029821529984474182,
-0.02024051733314991... | 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": "top", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __init__(self, top):
self.top = top
top.columnconfigure(99, weight=1)
self.url_label = Label(top, text="URL:")
self.url_label.grid(row=0, column=0, sticky='e')
self.url_entry = Entry(top, width=60, exportselection=0)
self.url_entry.grid(row=0, column=1, sticky='we',
... | |
20,471 | [
0.004738073796033859,
0.0003814679221250117,
-0.013987157493829727,
0.00320614711381495,
-0.00776862446218729,
0.005961193237453699,
-0.022258350625634193,
0.06151927262544632,
-0.03131670132279396,
0.02598825842142105,
0.029088443145155907,
-0.0027187159284949303,
-0.048609912395477295,
-... | 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": "event", "annotation": null, "type_comment": null}}], "kwarg": nul... | def go(self, event=None):
if not self.msgq:
self.msgq = Queue.Queue(0)
self.check_msgq()
if not self.sucker:
self.sucker = SuckerThread(self.msgq)
if self.sucker.stopit:
return
self.url_entry.selection_range(0, END)
url = self.url_e... | |
20,472 | [
0.019396308809518814,
0.027007851749658585,
-0.010938310995697975,
0.017506547272205353,
-0.038845110684633255,
0.02265089936554432,
-0.0012836275855079293,
0.04275587201118469,
0.014356943778693676,
0.02188974618911743,
0.028503913432359695,
0.020879248157143593,
-0.047690249979496,
0.039... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def check_msgq(self):
while not self.msgq.empty():
msg = self.msgq.get()
if msg is None:
self.go_button.configure(state=NORMAL)
self.auto_button.configure(state=NORMAL)
self.cancel_button.configure(state=DISABLED)
if self.su... | |
20,473 | [
-0.008122768253087997,
-0.017758537083864212,
0.013020790182054043,
0.006872618105262518,
0.0001598749222466722,
-0.014681246131658554,
-0.018297063186764717,
0.004747363738715649,
-0.01906638592481613,
0.030644696205854416,
-0.011257759295403957,
-0.06539244949817657,
0.004397962708026171,
... | 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": "top", "annotation": nu... | class AppArray:
def __init__(self, top=None):
if not top:
top = Tk()
top.title("websucker GUI")
top.iconname("wsgui")
top.wm_protocol('WM_DELETE_WINDOW', self.exit)
self.top = top
self.appframe = Frame(self.top)
self.appframe.pack(fill... | |
20,474 | [
0.027452684938907623,
0.0005859407829120755,
0.04214158281683922,
-0.0007363404729403555,
-0.020200533792376518,
0.00018037663539871573,
0.016719501465559006,
0.029483286663889885,
-0.05073867738246918,
0.05506359785795212,
-0.007225778419524431,
-0.028929485008120537,
0.0002653627598192543,... | 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 auto(self):
tries = ['PRIMARY', 'CLIPBOARD']
text = ""
for t in tries:
try:
text = self.top.selection_get(selection=t)
except TclError:
continue
text = text.strip()
if text:
break
if not t... | |
20,475 | [
0.017485300078988075,
0.017592063173651695,
-0.0017141287680715322,
-0.002913722302764654,
-0.030795006081461906,
-0.00759792048484087,
0.01411635521799326,
0.02718881145119667,
-0.018220774829387665,
0.028944458812475204,
0.0038404788356274366,
-0.011198184452950954,
-0.018541060388088226,
... | 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": "top", "annotation": null, "type_comment": null}}], "kwarg": null,... | def __init__(self, top=None):
if not top:
top = Tk()
top.title("websucker GUI")
top.iconname("wsgui")
top.wm_protocol('WM_DELETE_WINDOW', self.exit)
self.top = top
self.appframe = Frame(self.top)
self.appframe.pack(fill='both')
self... | |
20,476 | [
0.06143553927540779,
0.027612963691353798,
-0.020269325003027916,
0.030321411788463593,
-0.00925937108695507,
-0.002630002563819289,
0.01123015210032463,
-0.004893924109637737,
0.0017189289210364223,
0.018221473321318626,
0.052891816943883896,
0.0009447915945202112,
-0.00729959923774004,
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": "socket", "annotation": null, "type_comment": null}}, {"_type": "a... | def __init__(self, socket, io_loop=None):
self.socket = socket
self.io_loop = io_loop or IOLoop.instance()
self.poller = zmq.Poller()
self._send_queue = Queue()
self._recv_callback = None
self._send_callback = None
self._close_callback = None
self... | |
20,477 | [
0.015023350715637207,
-0.00012672433513216674,
0.01777626760303974,
-0.03264610841870308,
-0.030681202188134193,
-0.00028367064078338444,
-0.04412853345274925,
-0.017448782920837402,
-0.02832740731537342,
0.028184132650494576,
-0.0055314176715910435,
-0.04854957386851311,
-0.0022859950549900... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}], "kwarg": nu... | def add_options(self, parser):
ScrapyCommand.add_options(self, parser)
parser.add_option("--spider", dest="spider", default=None, \
help="use this spider without looking for one")
parser.add_option("-a", dest="spargs", action="append", default=[], metavar="NAME=VALUE", \
... | |
20,478 | [
0.012189634144306183,
0.006353118922561407,
0.062080301344394684,
-0.06018975377082825,
-0.0022381553426384926,
0.002632477320730686,
-0.022093025967478752,
-0.0025308055337518454,
-0.013893325813114643,
0.035722553730010986,
0.02082899771630764,
-0.0676640123128891,
-0.020158512517809868,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "requires_project", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": n... | class Command(ScrapyCommand):
requires_project = True
spider = None
items = {}
requests = {}
first_response = None
def syntax(self):
return "[options] <url>"
def short_desc(self):
return "Parse URL (using its spider) and print the results"
def add_options(self, pars... | |
20,479 | [
-0.0019356413977220654,
0.0030982340686023235,
0.07087890058755875,
-0.052518993616104126,
0.03841085731983185,
-0.033458512276411057,
-0.048532962799072266,
0.0023448136635124683,
-0.03891817107796669,
0.05179426074028015,
-0.02621118165552616,
-0.02836122363805771,
-0.04130978882312775,
... | 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": "lvl", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def print_requests(self, lvl=None, colour=True):
if lvl is None:
levels = self.requests.keys()
if levels:
requests = self.requests[max(levels)]
else:
requests = []
else:
requests = self.requests.get(lvl, [])
print("... | |
20,480 | [
0.02643672190606594,
0.015333298593759537,
0.04287555813789368,
-0.06719733774662018,
0.009685453958809376,
-0.03554537519812584,
-0.04352445900440216,
-0.0037522120401263237,
-0.04258715733885765,
0.04487032815814018,
0.023528682067990303,
-0.02261541411280632,
-0.02150987833738327,
-0.04... | 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": "lvl", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def print_items(self, lvl=None, colour=True):
if lvl is None:
items = [item for lst in self.items.values() for item in lst]
else:
items = self.items.get(lvl, [])
print("# Scraped Items ", "-"*60)
display.pprint([dict(x) for x in items], colorize=colour) | |
20,481 | [
0.033805251121520996,
0.048444487154483795,
0.07015185803174973,
-0.04389123618602753,
0.008345423266291618,
0.0013252744683995843,
-0.011442693881690502,
0.014586291275918484,
-0.042117584496736526,
0.01659819297492504,
0.01945721171796322,
-0.03295813500881195,
-0.03168746083974838,
-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": "opts", "annotation": null, "type_comment": null}}], "kwarg": null... | def print_results(self, opts):
colour = not opts.nocolour
if opts.verbose:
for level in xrange(1, self.max_level+1):
print('\n>>> DEPTH LEVEL: %s <<<' % level)
if not opts.noitems:
self.print_items(level, colour)
if not opt... | |
20,482 | [
0.036284592002630234,
-0.009684853255748749,
0.025156069546937943,
-0.045379120856523514,
-0.020398393273353577,
-0.04224630072712898,
0.0035624129232019186,
0.021193288266658783,
0.05980411544442177,
0.009614715352654457,
-0.004655392840504646,
-0.0472026988863945,
0.0030217678286135197,
... | 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": "response", "annotation": null, "type_comment": null}}, {"_type": ... | def run_callback(self, response, cb):
items, requests = [], []
for x in iterate_spider_output(cb(response)):
if isinstance(x, BaseItem):
items.append(x)
elif isinstance(x, Request):
requests.append(x)
return items, requests | |
20,483 | [
-0.03055466152727604,
0.0019390066154301167,
0.024492714554071426,
-0.01177691388875246,
-0.012777033261954784,
-0.02058408595621586,
0.005939483176916838,
0.008863301016390324,
0.00505927624180913,
0.05568010360002518,
-0.01705305278301239,
-0.061639998108148575,
0.029207563027739525,
-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": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def get_callback_from_rules(self, response):
if getattr(self.spider, 'rules', None):
for rule in self.spider.rules:
if rule.link_extractor.matches(response.url) and rule.callback:
return rule.callback
else:
log.msg(format='No CrawlSpider rules ... | |
20,484 | [
-0.010614322498440742,
-0.01733926124870777,
0.00017773150466382504,
-0.01925135962665081,
-0.008077532052993774,
-0.02185876853764057,
0.00384321017190814,
0.019360002130270004,
0.03680790588259697,
0.02796444669365883,
-0.004769382998347282,
-0.052756547927856445,
0.023292841389775276,
-... | 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": "url", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def set_spider(self, url, opts):
if opts.spider:
try:
self.spider = self.pcrawler.spiders.create(opts.spider, **opts.spargs)
except KeyError:
log.msg(format='Unable to find spider: %(spider)s',
level=log.ERROR, spider=opts.spider)
... | |
20,485 | [
-0.010344439186155796,
0.008754190988838673,
0.02471403405070305,
-0.017477096989750862,
0.0024179606698453426,
-0.015589654445648193,
-0.006798966322094202,
0.06619606912136078,
0.014192321337759495,
0.032430652529001236,
0.010438290424644947,
-0.05585163086652756,
-0.007544558495283127,
... | 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": "url", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def start_parsing(self, url, opts):
request = Request(url, opts.callback)
request = self.prepare_request(request, opts)
self.pcrawler.crawl(self.spider, [request])
self.crawler_process.start()
if not self.first_response:
log.msg(format='No response downloaded for: %... | |
20,486 | [
0.029562806710600853,
-0.009825858287513256,
0.009125751443207264,
-0.029367994517087936,
-0.003512714058160782,
-0.036113377660512924,
-0.0058930800296366215,
0.045561786741018295,
0.017301790416240692,
0.02296353131532669,
0.013295957818627357,
-0.06175558269023895,
0.023779308423399925,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def prepare_request(self, request, opts):
def callback(response):
# memorize first request
if not self.first_response:
self.first_response = response
# determine real callback
cb = response.meta['_callback']
if not cb:
... | |
20,487 | [
0.009677965193986893,
-0.011834069155156612,
0.0004528889840003103,
-0.03373812139034271,
-0.00630292808637023,
-0.0343751534819603,
-0.0007530284347012639,
0.025897745043039322,
0.027514822781085968,
0.029131900519132614,
0.0033934132661670446,
-0.058116793632507324,
0.026167258620262146,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def callback(response):
# memorize first request
if not self.first_response:
self.first_response = response
# determine real callback
cb = response.meta['_callback']
if not cb:
if opts.rules and self.first_response == response:... | |
20,488 | [
-0.0009533443371765316,
0.006200931500643492,
0.020699594169855118,
-0.048265501856803894,
-0.0011609273497015238,
-0.021750787273049355,
-0.01798214204609394,
0.038513991981744766,
0.0069390046410262585,
0.049965307116508484,
0.004892529454082251,
-0.04531320929527283,
-0.003897249232977628... | 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": "args", "annotation": null, "type_comment": null}}, {"_type": "arg... | def run(self, args, opts):
# parse arguments
if not len(args) == 1 or not is_url(args[0]):
raise UsageError()
else:
url = args[0]
# prepare spider
self.pcrawler = self.crawler_process.create_crawler()
self.set_spider(url, opts)
if self.sp... | |
20,489 | [
-0.0013140103546902537,
0.014406652189791203,
0.022087307646870613,
0.007593867834657431,
-0.010875503532588482,
-0.006682603619992733,
-0.03226308897137642,
0.00948691088706255,
0.07094842195510864,
-0.008223073557019234,
-0.0027514209505170584,
-0.003056531772017479,
-0.02206560969352722,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "k", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def name2cp(k):
if k == 'apos': return ord("'")
if hasattr(htmlentitydefs, "name2codepoint"): # requires Python 2.3
return htmlentitydefs.name2codepoint[k]
else:
k = htmlentitydefs.entitydefs[k]
if k.startswith("&#") and k.endswith(";"): return int(k[2:-1]) # not in latin-1
r... | |
20,490 | [
-0.0353725366294384,
-0.0012972794938832521,
0.03323880210518837,
0.0022537545301020145,
-0.024123026058077812,
-0.031555525958538055,
0.0006390082999132574,
-0.030133036896586418,
0.012014096602797508,
0.037364017218351364,
0.02871054969727993,
0.001751438365317881,
-0.03546736761927605,
... | 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": "out", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def __init__(self, out=None, baseurl=''):
HTMLParser.HTMLParser.__init__(self)
# Config options
self.unicode_snob = UNICODE_SNOB
self.escape_snob = ESCAPE_SNOB
self.links_each_paragraph = LINKS_EACH_PARAGRAPH
self.body_width = BODY_WIDTH
self.skip_internal_links ... | |
20,491 | [
0.03883396461606026,
0.015660399571061134,
0.040221747010946274,
-0.009756345301866531,
-0.01773010939359665,
-0.00982812698930502,
0.0051054819487035275,
0.021056000143289566,
0.03792472928762436,
0.022072909399867058,
0.05551127344369888,
-0.01605520024895668,
-0.031727563589811325,
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 close(self):
HTMLParser.HTMLParser.close(self)
self.pbr()
self.o('', 0, 'end')
self.outtext = self.outtext.join(self.outtextlist)
if self.unicode_snob:
nbsp = unichr(name2cp('nbsp'))
else:
nbsp = u' '
self.outtext = self.outtext.repla... | |
20,492 | [
0.004901060834527016,
0.035587579011917114,
0.02818363346159458,
-0.008207841776311398,
-0.010626283474266529,
-0.005664424039423466,
-0.02488698624074459,
-0.03304754197597504,
0.002827145392075181,
0.00647845258936286,
0.03083175979554653,
-0.0022512455470860004,
0.0011745995143428445,
-... | 16 | {"_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_tag(self, tag, attrs, start):
#attrs = fixattrs(attrs)
if attrs is None:
attrs = {}
else:
attrs = dict(attrs)
if self.google_doc:
# the attrs parameter is empty for a closing tag. in addition, we
# need the attributes of the par... | |
20,493 | [
0.047602929174900055,
0.045575059950351715,
-0.00577812734991312,
-0.017756855115294456,
0.011224775575101376,
0.011257274076342583,
-0.03509773686528206,
0.0006475207046605647,
0.0024032199289649725,
0.002109113847836852,
0.028390169143676758,
0.0002052445779554546,
-0.006314342841506004,
... | 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": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def handle_data(self, data):
if r'\/script>' in data: self.quiet -= 1
if self.style:
self.style_def.update(dumb_css_parser(data))
if not self.maybe_automatic_link is None:
href = self.maybe_automatic_link
if href == data and self.absolute_url_matcher.match(h... | |
20,494 | [
0.01671137660741806,
0.030499953776597977,
0.03474883735179901,
-0.008721038699150085,
-0.011616774834692478,
0.010432770475745201,
-0.034721776843070984,
-0.004959287121891975,
-0.006221097428351641,
0.03128477931022644,
0.04503276199102402,
0.020121309906244278,
0.009749431163072586,
-0.... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg... | def o(self, data, puredata=0, force=0):
if self.abbr_data is not None:
self.abbr_data += data
if not self.quiet:
if self.google_doc:
# prevent white space immediately after 'begin emphasis' marks ('**' and '_')
lstripped_data = data.lstrip()
... | |
20,495 | [
0.02259068191051483,
0.002530881203711033,
-0.01285373605787754,
0.04088067635893822,
-0.03211017698049545,
0.011875208467245102,
-0.022059137001633644,
0.03457461670041084,
0.0602579265832901,
0.029814867302775383,
-0.015185287222266197,
-0.019485972821712494,
0.0008713117567822337,
0.036... | 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": "c", "annotation": null, "type_comment": null}}], "kwarg": null, "... | def entityref(self, c):
if not self.unicode_snob and c in unifiable.keys():
return unifiable[c]
else:
try: name2cp(c)
except KeyError: return "&" + c + ';'
else:
try:
return unichr(name2cp(c))
except Name... | |
20,496 | [
0.04243093356490135,
-0.002040861640125513,
-0.013396120630204678,
0.010097518563270569,
0.010993361473083496,
0.0024665354285389185,
-0.036213427782058716,
0.04100707918405533,
0.02197485789656639,
-0.003841447178274393,
0.0011642996687442064,
0.022224033251404762,
-0.043522559106349945,
... | 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": "name", "annotation": null, "type_comment": null}}], "kwarg": null... | def charref(self, name):
if name[0] in ['x','X']:
c = int(name[1:], 16)
else:
c = int(name)
if not self.unicode_snob and c in unifiable_n.keys():
return unifiable_n[c]
else:
try:
return unichr(c)
except NameErro... | |
20,497 | [
0.012278443202376366,
0.04177315905690193,
-0.032977648079395294,
-0.019927669316530228,
-0.004731168504804373,
0.028701135888695717,
-0.004414287395775318,
-0.030883479863405228,
0.037981610745191574,
0.04686529561877251,
-0.015133125707507133,
0.020930666476488113,
0.03474115952849388,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "para", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def skipwrap(para):
# If the text begins with four spaces or one tab, it's a code block; don't wrap
if para[0:4] == ' ' or para[0] == '\t':
return True
# If the text begins with only two "--", possibly preceded by whitespace, that's
# an emdash; so wrap.
stripped = para.lstrip()
if st... | |
20,498 | [
-0.02064497023820877,
-0.01626284047961235,
0.04711686074733734,
-0.03522421419620514,
0.053493041545152664,
0.0003832125512417406,
0.006674689706414938,
-0.035319734364748,
-0.015009096823632717,
-0.050770629197359085,
0.01603597216308117,
-0.028203250840306282,
-0.015880746766924858,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class ScaldingTest(unittest.TestCase):
def setUp(self):
self.scalding_home = os.path.join(tempfile.gettempdir(), 'scalding-%09d' % random.randint(0, 999999999))
os.mkdir(self.scalding_home)
self.lib_dir = os.path.join(self.scalding_home, 'lib')
os.mkdir(self.lib_dir)
os.mkdir... | |
20,499 | [
0.012202233076095581,
0.025599412620067596,
-0.010599397122859955,
-0.01645348221063614,
-0.05294528231024742,
0.0024889912456274033,
0.003757184837013483,
-0.0051905447617173195,
0.03968598321080208,
-0.0400996170938015,
-0.00388070079497993,
-0.017648426815867424,
0.03093070723116398,
-0... | 20 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "payload", "annotation": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Tuple", "_fields": {"ctx": {"_typ... | def get_body_function_based_on_type(payload: Dict[str, Any]) -> Any:
action = get_action_with_primary_id(payload)
event = "{}_{}".format(action["entity_type"], action["action"])
changes = action.get("changes")
if changes is not None:
if changes.get("description") is not None:
event ... | |
20,500 | [
0.011181937530636787,
-0.015221693553030491,
0.062154147773981094,
-0.02994171902537346,
0.022891947999596596,
0.0035809925757348537,
0.022561902180314064,
-0.042087387293577194,
-0.04631197080016136,
-0.051698312163352966,
0.04290590062737465,
-0.03865491598844528,
-0.012178675271570683,
... | 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.scalding_home = os.path.join(tempfile.gettempdir(), 'scalding-%09d' % random.randint(0, 999999999))
os.mkdir(self.scalding_home)
self.lib_dir = os.path.join(self.scalding_home, 'lib')
os.mkdir(self.lib_dir)
os.mkdir(os.path.join(self.scalding_home, 'provided... |