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 |
|---|---|---|---|---|---|
19,701 | [
0.01933209039270878,
0.02767142467200756,
0.023418838158249855,
-0.018159372732043266,
-0.009547589346766472,
-0.004987015854567289,
0.010228713043034077,
-0.029827332124114037,
-0.026842229068279266,
0.008522940799593925,
0.03212538734078407,
0.007616749033331871,
-0.03676887974143028,
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_project_wiki_edit_post_with_non_ascii_title(self):
# regression test for https://github.com/CenterForOpenScience/openscienceframework.org/issues/1040
# wname doesn't exist in the db, so it will be created
new_wname = u'øˆ∆´ƒøßå√ß'
url = self.project.web_url_for('project_wiki_edi... | |
19,702 | [
0.02770111709833145,
-0.025637764483690262,
0.025068562477827072,
-0.05877000838518143,
-0.008798900060355663,
-0.017882399260997772,
-0.00044580004760064185,
-0.01951885223388672,
-0.021214596927165985,
0.05682523921132088,
0.025708913803100586,
0.00724545493721962,
-0.03510073199868202,
... | 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_project_wiki_view_scope(self):
self.project.update_node_wiki('home', 'Version 1', Auth(self.user))
self.project.update_node_wiki('home', 'Version 2', Auth(self.user))
self.project.save()
url = self.project.web_url_for('project_wiki_view', wname='home', view=2)
res = self... | |
19,703 | [
0.02239399589598179,
-0.03789753094315529,
0.015597925521433353,
-0.0567283108830452,
0.009757552295923233,
0.006129442248493433,
0.015173171646893024,
-0.018252640962600708,
-0.001353904721327126,
0.04861078038811684,
0.017025573179125786,
-0.00046936835860833526,
-0.047383714467287064,
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_project_wiki_compare_scope(self):
self.project.update_node_wiki('home', 'Version 1', Auth(self.user))
self.project.update_node_wiki('home', 'Version 2', Auth(self.user))
self.project.save()
url = self.project.web_url_for('project_wiki_view', wname='home', compare=2)
res ... | |
19,704 | [
0.04329425469040871,
0.027640851214528084,
0.01883581094443798,
-0.019004490226507187,
-0.026853682473301888,
0.011841259896755219,
0.02482953481376171,
-0.03211646527051926,
-0.004610556643456221,
0.01380917988717556,
0.019274376332759857,
0.03486030921339989,
-0.05546162649989128,
0.0248... | 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_wiki_validate_name_collision_doesnt_clear(self):
self.project.update_node_wiki('oldpage', 'some text', self.consolidate_auth)
url = self.project.api_url_for('project_wiki_validate_name', wname='oldpage', auth=self.consolidate_auth)
res = self.app.get(url, auth=self.user.auth, expect_err... | |
19,705 | [
0.04187425598502159,
0.015390481799840927,
0.015425513498485088,
-0.023809706792235374,
-0.016371361911296844,
0.0020230659283697605,
0.020399978384375572,
-0.013276917859911919,
0.00032659524003975093,
0.042901843786239624,
0.03043065033853054,
0.0013603877741843462,
-0.02851559780538082,
... | 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_wiki_page_creation_strips_whitespace(self):
# Regression test for:
# https://github.com/CenterForOpenScience/openscienceframework.org/issues/1080
# wname has a trailing space
url = self.project.web_url_for('project_wiki_view', wname='cupcake ')
res = self.app.post(url, {... | |
19,706 | [
0.016370870172977448,
0.016018416732549667,
0.026567723602056503,
-0.0173188503831625,
-0.004888777155429125,
0.0023046224378049374,
0.00012970148236490786,
-0.02608158066868782,
-0.02160906419157982,
0.0017242890316992998,
0.02831783890724182,
0.007711445912718773,
-0.03599889948964119,
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_project_wiki_validate_name_conflict_different_casing(self):
url = self.project.api_url_for('project_wiki_validate_name', wname='CAPSLOCK')
res = self.app.get(url, auth=self.user.auth)
assert_equal(res.status_code, 200)
self.project.update_node_wiki('CaPsLoCk', 'hello', self.cons... | |
19,707 | [
0.02721525728702545,
0.005663892719894648,
0.020405489951372147,
0.01270283479243517,
-0.007053823210299015,
-0.019429264590144157,
-0.004303724970668554,
-0.024858031421899796,
-0.002526876050978899,
0.025500910356640816,
-0.002489672275260091,
0.01578627899289131,
-0.04154910147190094,
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_project_dashboard_wiki_wname_get_shows_non_ascii_characters(self):
# Regression test for:
# https://github.com/CenterForOpenScience/openscienceframework.org/issues/1104
text = u'你好'
self.project.update_node_wiki('home', text, Auth(self.user))
# can view wiki preview fro... | |
19,708 | [
-0.0071062506176531315,
-0.02614085003733635,
-0.0011817313497886062,
-0.017800234258174896,
0.0002584812173154205,
0.013912562280893326,
0.007452334277331829,
-0.01156496163457632,
-0.009280809201300144,
0.046905867755413055,
0.011599569581449032,
0.016277465969324112,
-0.03829992190003395,... | 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_wiki_id_url_get_returns_302_and_resolves(self):
name = 'page by id'
self.project.update_node_wiki(name, 'some content', Auth(self.project.creator))
page = self.project.get_wiki_page(name)
page_url = self.project.web_url_for('project_wiki_view', wname=page.page_name, _guid=True)
... | |
19,709 | [
0.026981785893440247,
0.032444067299366,
-0.03778862580657005,
-0.030230900272727013,
0.00750475050881505,
-0.007734307553619146,
0.009576650336384773,
-0.04355698451399803,
0.006427598185837269,
0.025451404973864555,
0.01857646554708481,
0.007151585537940264,
-0.03821242228150368,
0.04930... | 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": "mock_rendered_before_update", "annotation": null, "type_comment":... | def test_wiki_widget_rendered_before_update(self, mock_rendered_before_update):
# New pages use js renderer
mock_rendered_before_update.return_value = False
self.project.update_node_wiki('home', 'updated content', Auth(self.user))
res = serialize_wiki_widget(self.project)
assert_... | |
19,710 | [
0.024744154885411263,
0.006064174696803093,
-0.011785970069468021,
-0.0013949052663519979,
-0.009923194535076618,
0.004053422249853611,
0.007189963944256306,
0.015830688178539276,
0.008623314090073109,
0.04213005676865578,
0.01476292870938778,
0.010486089624464512,
0.002303806133568287,
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_wiki_widget_not_show_in_registration_for_contributor(self):
registration = RegistrationFactory(project=self.project)
res = self.app.get(
registration.web_url_for('view_project'),
auth=self.user.auth
)
assert_equal(res.status_code, 200)
assert_not_... | |
19,711 | [
0.04628724977374077,
0.038726385682821274,
0.011952160857617855,
-0.0020112362690269947,
0.037228040397167206,
0.019236410036683083,
-0.0337933786213398,
-0.010540260933339596,
-0.019962528720498085,
-0.0005172162200324237,
0.023570075631141663,
-0.015813274309039116,
0.037412453442811966,
... | 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_read_only_users_cannot_view_edit_pane(self):
url = self.project.web_url_for('project_wiki_view', wname='home')
# No write permissions
res = self.app.get(url)
assert_equal(res.status_code, 200)
assert_not_in('data-osf-panel="Edit"', res.text)
# Write permissions
... | |
19,712 | [
-0.006907938048243523,
-0.0300960224121809,
0.04937664046883583,
-0.030643636360764503,
-0.0459996797144413,
-0.010450324043631554,
-0.0006028758944012225,
-0.041413404047489166,
0.01071842759847641,
0.0011487085139378905,
0.007803517393767834,
-0.029092060402035713,
-0.003319917479529977,
... | 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 TestViewHelpers(OsfTestCase):
def setUp(self):
super(TestViewHelpers, self).setUp()
self.project = ProjectFactory()
self.wname = 'New page'
self.project.update_node_wiki(self.wname, 'some content', Auth(self.project.creator))
def test_get_wiki_web_urls(self):
urls... | |
19,713 | [
0.02367256209254265,
-0.00005243299528956413,
0.02246375009417534,
-0.04109959676861763,
-0.021355673670768738,
0.04973756521940231,
0.0093745868653059,
-0.003406078787520528,
0.003535144729539752,
0.0214815903455019,
0.02624128758907318,
-0.026694592088460922,
-0.036768022924661636,
0.019... | 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 TestWikiDelete(OsfTestCase):
def setUp(self):
super(TestWikiDelete, self).setUp()
creator = AuthUserFactory()
self.project = ProjectFactory(is_public=True, creator=creator)
self.consolidate_auth = Auth(user=self.project.creator)
self.auth = creator.auth
self.... | |
19,714 | [
0.05389712378382683,
-0.028685621917247772,
0.012249894440174103,
-0.02370363660156727,
-0.029047509655356407,
0.010169041343033314,
0.03119470924139023,
0.042413223534822464,
-0.035127222537994385,
0.0185889583081007,
0.020133012905716896,
0.006845706608146429,
-0.02608003094792366,
-0.03... | 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):
super(TestWikiDelete, self).setUp()
creator = AuthUserFactory()
self.project = ProjectFactory(is_public=True, creator=creator)
self.consolidate_auth = Auth(user=self.project.creator)
self.auth = creator.auth
self.project.update_node_wiki('Elephants', 'H... | |
19,715 | [
0.04654458537697792,
0.0018227328546345234,
-0.010863036848604679,
-0.010693742893636227,
-0.010304366238415241,
0.053135767579078674,
0.0014601614093407989,
0.007798813749104738,
-0.008871009573340416,
0.026477593928575516,
0.031420979648828506,
-0.038305606693029404,
-0.042639534920454025,... | 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": "mock_shrejs", "annotation": null, "type_comment": null}}], "kwarg... | def test_project_wiki_delete(self, mock_shrejs):
page = self.elephant_wiki
assert_equal(page.page_name.lower(), 'elephants')
assert_equal(page.deleted, None)
url = self.project.api_url_for(
'project_wiki_delete',
wname='Elephants'
)
mock_now = date... | |
19,716 | [
0.02543754316866398,
0.012454754672944546,
0.01041722483932972,
-0.0077827866189181805,
-0.03785786032676697,
0.003986095078289509,
-0.00163145805709064,
0.012592502869665623,
0.015163807198405266,
0.03877618536353111,
0.036021213978528976,
-0.012994268909096718,
-0.07286892086267471,
0.00... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_project_wiki_delete_w_valid_special_characters(self, mock_sharejs):
# TODO: Need to understand why calling update_node_wiki with failure causes transaction rollback issue later
# with assert_raises(NameInvalidError):
# self.project.update_node_wiki(SPECIAL_CHARACTERS_ALL, 'Hello Spe... | |
19,717 | [
0.021950261667370796,
0.017215648666024208,
0.005840802565217018,
-0.06469812244176865,
-0.004976301919668913,
0.03886844962835312,
0.01856662519276142,
-0.01473679393529892,
0.00021476956317201257,
0.02592882513999939,
0.04484248906373978,
-0.01970689930021763,
-0.022743497043848038,
0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_wiki_versions_do_not_reappear_after_delete(self, mock_sharejs):
# Creates a wiki page
self.project.update_node_wiki('Hippos', 'Hello hippos', self.consolidate_auth)
# Edits it two times
wiki_page = self.project.get_wiki_page('Hippos')
assert_equal(wiki_page.deleted, None... | |
19,718 | [
0.018815280869603157,
0.013140295632183552,
0.00001791246722859796,
-0.041278768330812454,
-0.007121882401406765,
0.01692361943423748,
-0.0024813988711684942,
-0.056930020451545715,
0.014547782018780708,
0.0331941656768322,
0.019682293757796288,
0.003580646123737097,
-0.029050525277853012,
... | 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 TestWikiRename(OsfTestCase):
def setUp(self):
super(TestWikiRename, self).setUp()
creator = AuthUserFactory()
self.project = ProjectFactory(is_public=True, creator=creator)
self.consolidate_auth = Auth(user=self.project.creator)
self.auth = creator.auth
self.... | |
19,719 | [
0.039117470383644104,
-0.006042211316525936,
-0.003309237537905574,
-0.03647008165717125,
-0.01891971006989479,
-0.008358677849173546,
0.01909087784588337,
0.004053816199302673,
-0.03370857983827591,
0.020494451746344566,
0.0075085461139678955,
0.058425161987543106,
-0.02809428609907627,
-... | 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):
super(TestWikiRename, self).setUp()
creator = AuthUserFactory()
self.project = ProjectFactory(is_public=True, creator=creator)
self.consolidate_auth = Auth(user=self.project.creator)
self.auth = creator.auth
self.project.update_node_wiki('home', 'Hello ... | |
19,720 | [
0.07782529294490814,
0.03572308272123337,
-0.022150952368974686,
-0.022392917424440384,
-0.005999674554914236,
0.021831994876265526,
-0.007242503110319376,
-0.05059303715825081,
0.008782291784882545,
0.018708424642682076,
0.004162927158176899,
-0.0016690202755853534,
-0.026066413149237633,
... | 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": "new_name", "annotation": null, "type_comment": null}}], "kwarg": ... | def test_rename_wiki_page_invalid(self, new_name=u'invalid/name'):
res = self.app.put_json(
self.url,
{'value': new_name},
auth=self.auth,
expect_errors=True,
)
assert_equal(http.BAD_REQUEST, res.status_code)
assert_equal(res.json['message_... | |
19,721 | [
0.047351937741041183,
0.013332325033843517,
-0.013670886866748333,
-0.0059248292818665504,
0.002226918702945113,
0.01995178870856762,
0.01427796296775341,
-0.0764915868639946,
0.002051800489425659,
0.022788703441619873,
0.046628113836050034,
-0.012094823643565178,
-0.011271769180893898,
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": "mock_sharejs", "annotation": null, "type_comment": null}}, {"_typ... | def test_rename_wiki_page_valid(self, mock_sharejs, new_name=u'away'):
self.app.put_json(
self.url,
{'value': new_name},
auth=self.auth
)
self.project.reload()
old_wiki = self.project.get_wiki_version(self.page_name)
assert_false(old_wiki)
... | |
19,722 | [
0.05167267471551895,
0.004269931465387344,
0.0007640359690412879,
-0.001762430532835424,
0.020981187000870705,
-0.0045977625995874405,
0.017415685579180717,
-0.006632482632994652,
0.016429483890533447,
0.00970488227903843,
-0.0054322415962815285,
0.010658573359251022,
-0.019799910485744476,
... | 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_cannot_rename_wiki_page_to_home(self):
user = AuthUserFactory()
# A fresh project where the 'home' wiki page has no content
project = ProjectFactory(creator=user)
project.update_node_wiki('Hello', 'hello world', Auth(user=user))
url = project.api_url_for('project_wiki_re... | |
19,723 | [
0.06276126205921173,
-0.00648128055036068,
-0.008166070096194744,
-0.020446693524718285,
-0.001958424225449562,
0.023907961323857307,
0.02108851820230484,
-0.029019633308053017,
-0.012068592011928558,
0.019885096698999405,
0.008876660838723183,
0.021501118317246437,
-0.038394853472709656,
... | 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_rename_wiki_page_duplicate(self):
self.project.update_node_wiki('away', 'Hello world', self.consolidate_auth)
new_name = 'away'
res = self.app.put_json(
self.url,
{'value': new_name},
auth=self.auth,
expect_errors=True,
)
a... | |
19,724 | [
0.05989338085055351,
-0.007462999317795038,
-0.0238508228212595,
-0.02980465069413185,
-0.0023688068613409996,
0.0464232861995697,
0.005740768741816282,
-0.03773519769310951,
0.012144388630986214,
0.02502264827489853,
0.02115206979215145,
0.0005252507398836315,
-0.024596530944108963,
0.038... | 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_rename_wiki_page_duplicate_different_casing(self):
# attempt to rename 'page2' from setup to different case of 'away'.
old_name = 'away'
new_name = 'AwAy'
self.project.update_node_wiki(old_name, 'Hello world', self.consolidate_auth)
res = self.app.put_json(
s... | |
19,725 | [
0.019346686080098152,
-0.015873312950134277,
-0.017702622339129448,
-0.007467751391232014,
-0.0032302364706993103,
0.021662266924977303,
0.008683431893587112,
-0.043370846658945084,
0.005600813310593367,
0.016116449609398842,
0.028921617195010185,
-0.026073450222611427,
-0.015340729616582394... | 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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_rename_wiki_page_same_name_different_casing(self, mock_sharejs):
old_name = 'away'
new_name = 'AWAY'
self.project.update_node_wiki(old_name, 'Hello world', self.consolidate_auth)
url = self.project.api_url_for('project_wiki_rename', wname=old_name)
res = self.app.put_jso... | |
19,726 | [
0.04761821776628494,
0.04155277833342552,
-0.029195580631494522,
-0.02220221981406212,
0.00874170009046793,
0.04071538895368576,
0.0218287892639637,
-0.016215994954109192,
0.01752866432070732,
0.009567776694893837,
0.0502435564994812,
0.017087336629629135,
-0.02799607254564762,
0.017709722... | 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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_can_rename_to_a_deleted_page(self, mock_sharejs):
self.project.delete_node_wiki(self.page_name, self.consolidate_auth)
self.project.save()
# Creates a new page
self.project.update_node_wiki('page3', 'moarcontent', self.consolidate_auth)
self.project.save()
# Re... | |
19,727 | [
-0.025837259367108345,
-0.01859571598470211,
0.031028416007757187,
-0.032261017709970474,
-0.018050525337457657,
-0.0019733502995222807,
-0.013890489935874939,
-0.0405573844909668,
-0.002792616607621312,
0.03361213952302933,
0.029440253973007202,
-0.016829773783683777,
0.0131912250071764,
... | 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 TestWikiLinks(OsfTestCase):
def test_links(self):
user = AuthUserFactory()
project = ProjectFactory(creator=user)
wiki_page = WikiFactory(
user=user,
node=project,
)
wiki = WikiVersionFactory(
content='[[wiki2]]',
wiki_pa... | |
19,728 | [
-0.01881014183163643,
-0.011051598936319351,
-0.011993386782705784,
-0.013761642388999462,
0.010007302276790142,
-0.05637916922569275,
0.0035781553015112877,
-0.03749214857816696,
0.004519943613559008,
0.04361697658896446,
0.028240839019417763,
-0.01875888742506504,
-0.02115500159561634,
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_bad_links(self):
content = u'<span></span><iframe src="http://httpbin.org/"></iframe>'
user = AuthUserFactory()
node = ProjectFactory()
wiki_page = WikiFactory(
user=user,
node=node,
)
wiki = WikiVersionFactory(
content=content... | |
19,729 | [
0.0005175683763809502,
-0.027627969160676003,
0.027214521542191505,
-0.0337810292840004,
-0.0001795529096852988,
-0.046500593423843384,
-0.004514473024755716,
0.006341543048620224,
-0.005478168837726116,
0.04200132191181183,
0.03606714680790901,
-0.0015960258897393942,
-0.007320438977330923,... | 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_links(self):
user = AuthUserFactory()
project = ProjectFactory(creator=user)
wiki_page = WikiFactory(
user=user,
node=project,
)
wiki = WikiVersionFactory(
content='[[wiki2]]',
wiki_page=wiki_page,
)
assert_... | |
19,730 | [
0.04639686271548271,
-0.04707809537649155,
0.03525383025407791,
-0.0035004448145627975,
-0.008965518325567245,
-0.019986901432275772,
0.01825948804616928,
-0.0281008780002594,
-0.011039630509912968,
0.012955599464476109,
0.032480236142873764,
0.010473963804543018,
0.004440181888639927,
-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_uuid_generated_once(self):
assert_is_none(self.project.wiki_private_uuids.get(self.wkey))
url = self.project.web_url_for('project_wiki_view', wname=self.wname)
res = self.app.get(url, auth=self.user.auth)
assert_equal(res.status_code, 200)
self.project.reload()
... | |
19,731 | [
0.027852462604641914,
-0.022394197061657906,
0.03940664604306221,
-0.015762658789753914,
-0.005206395871937275,
0.001178054604679346,
0.012625429779291153,
-0.037366170436143875,
-0.00021839443070348352,
-0.00771554047241807,
0.047568537294864655,
-0.007275563199073076,
-0.00227002683095634,... | 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 TestWikiUuid(OsfTestCase):
def setUp(self):
super(TestWikiUuid, self).setUp()
self.user = AuthUserFactory()
self.project = ProjectFactory(is_public=True, creator=self.user)
self.wname = 'foo.bar'
self.wkey = to_mongo_key(self.wname)
def test_uuid_generated_once(se... | |
19,732 | [
0.05306166410446167,
0.0028570331633090973,
0.036144793033599854,
-0.0247513260692358,
-0.008244664408266544,
-0.014721376821398735,
0.004723204765468836,
-0.010642376728355885,
-0.027478361502289772,
-0.007886451669037342,
0.031707581132650375,
0.03383374586701393,
-0.03461949899792671,
-... | 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_uuid_not_visible_without_write_permission(self):
self.project.update_node_wiki(self.wname, 'some content', Auth(self.user))
self.project.save()
assert_is_none(self.project.wiki_private_uuids.get(self.wkey))
url = self.project.web_url_for('project_wiki_view', wname=self.wname)
... | |
19,733 | [
0.048608358949422836,
-0.0027421112172305584,
0.04770653322339058,
-0.03205987438559532,
-0.02166634239256382,
-0.02937694452702999,
0.02061796933412552,
-0.00007952615123940632,
-0.029782764613628387,
-0.005946407560259104,
0.022804895415902138,
0.03701990842819214,
-0.04556469991803169,
... | 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_uuid_not_generated_without_write_permission(self):
self.project.update_node_wiki(self.wname, 'some content', Auth(self.user))
self.project.save()
assert_is_none(self.project.wiki_private_uuids.get(self.wkey))
url = self.project.web_url_for('project_wiki_view', wname=self.wname)... | |
19,734 | [
0.008291928097605705,
-0.025926703587174416,
0.03593776375055313,
-0.03161259740591049,
0.01027834601700306,
0.003386629978194833,
0.02412860095500946,
-0.04351895675063133,
0.01693618670105934,
0.010746096260845661,
0.024772515520453453,
-0.02243984118103981,
-0.018867934122681618,
0.0198... | 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_uuids_differ_between_pages(self):
wname1 = 'foo.bar'
url1 = self.project.web_url_for('project_wiki_view', wname=wname1)
res1 = self.app.get(url1, auth=self.user.auth)
assert_equal(res1.status_code, 200)
wname2 = 'bar.baz'
url2 = self.project.web_url_for('project... | |
19,735 | [
-0.004465658683329821,
-0.029795164242386818,
0.035050299018621445,
-0.047537267208099365,
0.0084371417760849,
-0.01839296892285347,
0.016717594116926193,
-0.03338697552680969,
0.01606672815978527,
0.026781899854540825,
0.02548016794025898,
-0.032278094440698624,
-0.01694660261273384,
-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_uuids_differ_between_forks(self):
url = self.project.web_url_for('project_wiki_view', wname=self.wname)
project_res = self.app.get(url, auth=self.user.auth)
assert_equal(project_res.status_code, 200)
self.project.reload()
fork = self.project.fork_node(Auth(self.user))
... | |
19,736 | [
0.04712254926562309,
-0.023514339700341225,
0.06354972720146179,
-0.015335949137806892,
-0.014819665811955929,
-0.030484158545732498,
0.01857445016503334,
-0.037266239523887634,
-0.01223825104534626,
-0.02532132901251316,
0.027597667649388313,
-0.010090983472764492,
-0.02802008017897606,
-... | 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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_migration_does_not_affect_forks(self, mock_sharejs):
original_uuid = generate_private_uuid(self.project, self.wname)
self.project.update_node_wiki(self.wname, 'Hello world', Auth(self.user))
fork = self.project.fork_node(Auth(self.user))
assert_equal(fork.wiki_private_uuids.get(... | |
19,737 | [
0.05363616719841957,
-0.006911375559866428,
0.028935300186276436,
-0.0003842399164568633,
-0.026161016896367073,
-0.0008981442078948021,
0.03292637690901756,
-0.008578379638493061,
0.01305617205798626,
0.0120279835537076,
0.061277616769075394,
-0.01804501749575138,
-0.001328584155999124,
-... | 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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_uuid_persists_after_delete(self, mock_sharejs):
assert_is_none(self.project.wiki_private_uuids.get(self.wkey))
# Create wiki page
self.project.update_node_wiki(self.wname, 'Hello world', Auth(self.user))
# Visit wiki edit page
edit_url = self.project.web_url_for('proje... | |
19,738 | [
0.04925835132598877,
-0.010126408189535141,
0.019012847915291786,
-0.004829190671443939,
-0.029978059232234955,
0.009840729646384716,
0.04176991432905197,
-0.028567899018526077,
-0.00953681580722332,
-0.013955722562968731,
0.050571259111166,
0.018392864614725113,
0.008059794083237648,
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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_uuid_persists_after_rename(self, mock_sharejs):
new_wname = 'barbaz'
new_wkey = to_mongo_key(new_wname)
assert_is_none(self.project.wiki_private_uuids.get(self.wkey))
assert_is_none(self.project.wiki_private_uuids.get(new_wkey))
# Create wiki page
self.project.u... | |
19,739 | [
0.029496930539608,
-0.027496350929141045,
0.030753109604120255,
-0.028659477829933167,
-0.008170975372195244,
0.0269613116979599,
0.038127340376377106,
0.012038377113640308,
-0.02717067487537861,
-0.008455941453576088,
0.030078494921326637,
-0.025565557181835175,
0.016551313921809196,
0.02... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs"... | class TestWikiShareJSMongo(OsfTestCase):
@classmethod
def setUpClass(cls):
super(TestWikiShareJSMongo, cls).setUpClass()
cls._original_sharejs_db_name = settings.SHAREJS_DB_NAME
settings.SHAREJS_DB_NAME = 'sharejs_test'
def setUp(self):
super(TestWikiShareJSMongo, self).set... | |
19,740 | [
0.018795322626829147,
-0.06048697978258133,
0.03248460218310356,
0.0021660253405570984,
-0.012834422290325165,
-0.01621919684112072,
0.05928555503487587,
0.030797991901636124,
-0.0400628037750721,
-0.020481934770941734,
0.03451777994632721,
0.01535278744995594,
-0.0009263367974199355,
-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 setUp(self):
super(TestWikiShareJSMongo, self).setUp()
self.user = AuthUserFactory()
self.project = ProjectFactory(is_public=True, creator=self.user)
self.wname = 'foo.bar'
self.wkey = to_mongo_key(self.wname)
self.private_uuid = generate_private_uuid(self.project, se... | |
19,741 | [
0.021742483600974083,
-0.011040488258004189,
0.049510128796100616,
0.01875246874988079,
-0.022814376279711723,
-0.022893358021974564,
0.034797001630067825,
-0.013471990823745728,
-0.0061549171805381775,
-0.023717021569609642,
0.03847528249025345,
-0.0035372436977922916,
0.0076555656269192696... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_migrate_uuid(self, mock_sharejs):
migrate_uuid(self.project, self.wname)
assert_is_none(self.db.docs.find_one({'_id': self.sharejs_uuid}))
assert_is_none(self.db.docs_ops.find_one({'name': self.sharejs_uuid}))
new_sharejs_uuid = get_sharejs_uuid(self.project, self.wname)
... | |
19,742 | [
0.0301984716206789,
-0.0404839888215065,
0.048795271664857864,
-0.0014166958862915635,
-0.014160864986479282,
-0.000560204207431525,
0.020181061699986458,
0.0019940375350415707,
-0.0030512276571244,
-0.012143977917730808,
0.05834959074854851,
0.004375000484287739,
-0.009414172731339931,
-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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_manage_contributors_updates_uuid(self, mock_sharejs):
user = UserFactory()
self.project.add_contributor(
contributor=user,
permissions=['read', 'write', 'admin'],
auth=Auth(user=self.user),
)
self.project.save()
assert_equal(self.priva... | |
19,743 | [
0.04813588410615921,
-0.010055000893771648,
0.025188978761434555,
0.010718470439314842,
-0.018256861716508865,
-0.013921428471803665,
0.024022186174988747,
0.015053903684020042,
-0.02370189130306244,
-0.016094865277409554,
0.041684214025735855,
-0.011147438548505306,
0.017456121742725372,
... | 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": "mock_sharejs", "annotation": null, "type_comment": null}}], "kwar... | def test_migrate_uuid_no_mongo(self, mock_sharejs):
# Case where no edits have been made to the wiki
wname = 'bar.baz'
wkey = to_mongo_key(wname)
share_uuid = generate_private_uuid(self.project, wname)
sharejs_uuid = get_sharejs_uuid(self.project, wname)
self.project.upd... | |
19,744 | [
-0.0004690320056397468,
-0.05078811198472977,
0.041034772992134094,
-0.04363734647631645,
-0.018268559128046036,
-0.007738238200545311,
-0.003133196849375963,
-0.03961978107690811,
-0.0008038292289711535,
0.008995307609438896,
0.017839008942246437,
-0.020378414541482925,
-0.01265912596136331... | 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 TestWikiUtils(OsfTestCase):
def setUp(self):
super(TestWikiUtils, self).setUp()
self.project = ProjectFactory()
def test_get_sharejs_uuid(self):
wname = 'foo.bar'
wname2 = 'bar.baz'
private_uuid = generate_private_uuid(self.project, wname)
sharejs_uuid = g... | |
19,745 | [
0.05273155868053436,
0.009697142988443375,
0.00923989899456501,
-0.04408548027276993,
-0.0021986328065395355,
0.014881225302815437,
0.014833719469606876,
0.006110447458922863,
-0.002219416666775942,
0.0077850306406617165,
0.04605697840452194,
0.0022372312378138304,
-0.042612798511981964,
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_get_draft(self):
# draft is current with latest wiki save
current_content = self.wiki_page.get_draft(self.project)
assert_equals(current_content, self.wiki_page.content)
# modify the sharejs wiki page contents and ensure we
# return the draft contents
new_conten... | |
19,746 | [
0.014746519736945629,
-0.07321242243051529,
0.05201807618141174,
-0.007651496212929487,
-0.003986036404967308,
-0.021279022097587585,
0.022912148386240005,
-0.038686931133270264,
0.029347874224185944,
-0.03638846054673195,
0.023698467761278152,
0.012206102721393108,
-0.0011189935030415654,
... | 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_get_sharejs_uuid(self):
wname = 'foo.bar'
wname2 = 'bar.baz'
private_uuid = generate_private_uuid(self.project, wname)
sharejs_uuid = get_sharejs_uuid(self.project, wname)
# Provides consistent results
assert_equal(sharejs_uuid, get_sharejs_uuid(self.project, wn... | |
19,747 | [
0.04761449620127678,
-0.05396013706922531,
0.050676379352808,
0.004129658918827772,
-0.03381383419036865,
-0.022808806970715523,
0.03627665340900421,
0.010589011013507843,
-0.009512914344668388,
-0.04588386416435242,
0.019280986860394478,
0.0062735313549637794,
0.0069890799932181835,
-0.04... | 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_generate_share_uuid(self):
wname = 'bar.baz'
wkey = to_mongo_key(wname)
assert_is_none(self.project.wiki_private_uuids.get(wkey))
share_uuid = generate_private_uuid(self.project, wname)
self.project.reload()
assert_equal(self.project.wiki_private_uuids[wkey], sha... | |
19,748 | [
0.005156570579856634,
-0.0223768949508667,
-0.013945367187261581,
-0.0585443414747715,
-0.003048688406124711,
-0.01405254751443863,
0.0006334066856652498,
-0.03213031589984894,
0.00999159924685955,
0.06407009065151215,
0.01645815372467041,
-0.007228725589811802,
-0.030558336526155472,
0.04... | 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_format_wiki_version(self):
assert_is_none(format_wiki_version(None, 5, False))
assert_is_none(format_wiki_version('', 5, False))
assert_equal(format_wiki_version('3', 5, False), 3)
assert_equal(format_wiki_version('4', 5, False), 'previous')
assert_equal(format_wiki_vers... | |
19,749 | [
0.02915276773273945,
-0.006148823536932468,
0.008518584072589874,
-0.042134664952754974,
0.008857570588588715,
0.025511810556054115,
-0.01325810607522726,
-0.02860034629702568,
0.01652241311967373,
0.017903465777635574,
0.015643561258912086,
-0.02089156210422516,
0.002302277833223343,
-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 TestPublicWiki(OsfTestCase):
def setUp(self):
super(TestPublicWiki, self).setUp()
self.project = ProjectFactory()
self.consolidate_auth = Auth(user=self.project.creator)
self.user = AuthUserFactory()
def test_addon_on_children(self):
parent = ProjectFactory()
... | |
19,750 | [
-0.0032022083178162575,
0.023283345624804497,
0.006003392394632101,
-0.029184985905885696,
-0.002558773849159479,
0.017345793545246124,
0.0016654476057738066,
-0.00033462329884059727,
0.020446250215172768,
0.01583746448159218,
0.011593789793550968,
-0.026120442897081375,
-0.03600838407874107... | 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_check_user_has_addon_excludes_deleted_components(self):
parent = ProjectFactory()
parent.delete_addon('wiki', self.consolidate_auth)
node = NodeFactory(parent=parent, category='project')
mock_now = datetime.datetime(2017, 3, 16, 11, 00, tzinfo=pytz.utc)
with mock.patch.o... | |
19,751 | [
0.018540391698479652,
0.02533775381743908,
0.028853630647063255,
-0.015258905477821827,
-0.010178463533520699,
0.003310783999040723,
-0.0006727777072228491,
0.0013975610490888357,
-0.001995260128751397,
0.009651082567870617,
-0.007260285783559084,
-0.008332628756761551,
-0.015153429470956326... | 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_addon_on_children(self):
parent = ProjectFactory()
node = NodeFactory(parent=parent, category='project')
sub_component = NodeFactory(parent=node)
parent.delete_addon('wiki', self.consolidate_auth)
node.delete_addon('wiki', self.consolidate_auth)
sub_component.d... | |
19,752 | [
0.034672174602746964,
0.006133743096143007,
0.02465740218758583,
-0.03873685002326965,
0.01346729975193739,
0.011251316405832767,
0.003902456257492304,
0.01519356295466423,
-0.014838515780866146,
-0.009849493391811848,
0.05088190734386444,
0.002477677073329687,
-0.004031007643789053,
0.003... | 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_set_editing(self):
parent = ProjectFactory()
node = NodeFactory(parent=parent, category='project', is_public=True)
wiki = node.get_addon('wiki')
# Set as publicly editable
wiki.set_editing(permissions=True, auth=self.consolidate_auth, log=True)
assert_true(wiki.i... | |
19,753 | [
0.033412519842386246,
-0.004846497438848019,
-0.01698656566441059,
-0.0280306376516819,
0.008454040624201298,
-0.013151975348591805,
0.026102129369974136,
-0.037942271679639816,
-0.0005024491692893207,
0.01994660124182701,
0.004958619829267263,
0.020966917276382446,
-0.019554173573851585,
... | 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_serialize_wiki_settings(self):
node = NodeFactory(parent=self.project, creator=self.user, is_public=True)
node.get_addon('wiki').set_editing(
permissions=True, auth=self.consolidate_auth, log=True)
data = serialize_wiki_settings(self.user, [node])
expected = [{
... | |
19,754 | [
0.034031081944704056,
-0.004928835202008486,
-0.011485490016639233,
-0.026362745091319084,
0.004287916235625744,
-0.012171783484518528,
0.025999747216701508,
-0.030741412192583084,
-0.001969548873603344,
0.017015540972352028,
0.010447542183101177,
0.022834856063127518,
-0.02087239734828472,
... | 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_serialize_wiki_settings(self):
node = NodeFactory(parent=self.project, creator=self.user, is_public=True)
node.get_addon('wiki').set_editing(
permissions=True, auth=self.consolidate_auth, log=True)
node.add_pointer(self.project, Auth(self.user))
node.save()
d... | |
19,755 | [
0.046792205423116684,
0.007281206548213959,
-0.01856106147170067,
-0.02859778329730034,
0.018011104315519333,
0.002032264368608594,
0.025573017075657845,
-0.04122388735413551,
-0.005628469865769148,
0.005662842188030481,
-0.00529906852170825,
0.022193070501089096,
-0.027589527890086174,
-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_serialize_wiki_settings_disabled_wiki(self):
node = NodeFactory(parent=self.project, creator=self.user)
node.delete_addon('wiki', self.consolidate_auth)
data = serialize_wiki_settings(self.user, [node])
expected = [{'node':
{'url': node.url,
... | |
19,756 | [
-0.008300604298710823,
-0.00809201505035162,
0.02218402363359928,
-0.03143554553389549,
0.004355823155492544,
-0.005441711749881506,
-0.008288334123790264,
-0.03931283950805664,
-0.014134952798485756,
0.04549688100814819,
0.034331247210502625,
0.0011035263305529952,
-0.0004141099634580314,
... | 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 TestWikiMenu(OsfTestCase):
def setUp(self):
super(TestWikiMenu, self).setUp()
self.user = UserFactory()
self.project = ProjectFactory(creator=self.user, is_public=True)
self.component = NodeFactory(creator=self.user, parent=self.project, is_public=True)
self.consolidat... | |
19,757 | [
0.02844257466495037,
-0.01147362682968378,
-0.014156889170408249,
-0.02453574538230896,
-0.0031635656487196684,
-0.030503319576382637,
0.007963920943439007,
-0.05018772929906845,
-0.008886963129043579,
0.04756886512041092,
0.032993387430906296,
0.009611443616449833,
0.012868923135101795,
-... | 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_format_home_wiki_page_no_content(self):
data = views.format_home_wiki_page(self.project)
expected = {
'page': {
'url': self.project.web_url_for('project_wiki_home'),
'name': 'Home',
'id': 'None',
}
}
assert_... | |
19,758 | [
0.050908010452985764,
-0.015039967373013496,
0.010983733460307121,
-0.02556794509291649,
-0.019415229558944702,
-0.007445923052728176,
0.016692085191607475,
-0.015199482440948486,
-0.03222199156880379,
0.05008764937520027,
0.03466028720140457,
0.04181566834449768,
-0.030740780755877495,
-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_format_project_wiki_pages_contributor(self):
self.project.update_node_wiki('home', 'content here', self.consolidate_auth)
self.project.update_node_wiki('zoo', 'koala', self.consolidate_auth)
home_page = self.project.get_wiki_page(name='home')
zoo_page = self.project.get_wiki_pag... | |
19,759 | [
0.06839848309755325,
-0.00623102393001318,
0.004274905193597078,
-0.02736853063106537,
-0.01230213139206171,
-0.023107903078198433,
0.010817194357514381,
-0.015740331262350082,
-0.02389606274664402,
0.04607873409986496,
0.03566133230924606,
0.03751179203391075,
-0.024033132940530777,
-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 test_format_project_wiki_pages_no_content_non_contributor(self):
self.project.update_node_wiki('home', 'content here', self.consolidate_auth)
self.project.update_node_wiki('zoo', '', self.consolidate_auth)
home_page = self.project.get_wiki_version(name='home')
data = views.format_pro... | |
19,760 | [
0.031310681253671646,
-0.004410323221236467,
-0.007699918933212757,
-0.00385866966098547,
-0.012728674337267876,
-0.01529531367123127,
0.007461837027221918,
-0.0050171418115496635,
-0.034097980707883835,
0.05240125581622124,
0.025062480941414833,
0.0167702604085207,
-0.02357592061161995,
-... | 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 test_format_component_wiki_pages_contributor(self):
self.component.update_node_wiki('home', 'home content', self.consolidate_auth)
self.component.update_node_wiki('zoo', 'koala', self.consolidate_auth)
zoo_page = self.component.get_wiki_page(name='zoo')
expected = [
{
... | |
19,761 | [
0.009881501086056232,
-0.012917653657495975,
0.00885077752172947,
-0.01008316408842802,
-0.01949411816895008,
-0.011354763060808182,
-0.007489550393074751,
-0.027403799816966057,
-0.037957511842250824,
0.03721807897090912,
0.006778127048164606,
0.02520791068673134,
-0.024647735059261322,
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_project_wiki_grid_data(self):
self.project.update_node_wiki('home', 'project content', self.consolidate_auth)
self.component.update_node_wiki('home', 'component content', self.consolidate_auth)
data = views.project_wiki_grid_data(auth=self.consolidate_auth, wname='home', node=self.proje... | |
19,762 | [
-0.017401710152626038,
0.00794263742864132,
-0.012597594410181046,
-0.06378969550132751,
-0.013933797366917133,
0.011988534592092037,
0.027668718248605728,
-0.06602706015110016,
0.0052142976783216,
0.04837675020098686,
0.03838319703936577,
0.009769816882908344,
-0.035748083144426346,
-0.04... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "s", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "v", "annotation": null, "type_comment": null}}, {"_type": "arg", "_f... | def timer(s, v='', nloop=500, nrep=3):
units = ["s", "ms", "µs", "ns"]
scaling = [1, 1e3, 1e6, 1e9]
print("%s : %-50s : " % (v, s), end=' ')
varnames = ["%ss,nm%ss,%sl,nm%sl" % tuple(x*4) for x in 'xyz']
setup = 'from __main__ import numpy, ma, %s' % ','.join(varnames)
Timer = timeit.Timer(stmt=... | |
19,763 | [
0.024655021727085114,
0.00381798529997468,
0.006377562414854765,
-0.06724540889263153,
0.039389390498399734,
0.012132029980421066,
-0.003298739204183221,
-0.0749669000506401,
0.05175355449318886,
0.041246458888053894,
0.03340278938412666,
-0.03501550480723381,
-0.03352496400475502,
-0.0026... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "nloop", "annotation": null, "type_comment": null}}, {"_type": "ar... | def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print("%s on small arrays" % funcname)
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
... | |
19,764 | [
0.010344406589865685,
0.00014617347915191203,
-0.0007315436378121376,
-0.07548386603593826,
0.03336426615715027,
0.027824165299534798,
-0.005873990245163441,
-0.07306007295846939,
0.05421384051442146,
0.05619244650006294,
0.0397452749311924,
-0.04026465862989426,
-0.022803448140621185,
0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "nloop", "annotation": null, "type_comment": null}}, {"_type": "ar... | def compare_functions_2v(func, nloop=500, test=True,
xs=xs, nmxs=nmxs,
ys=ys, nmys=nmys,
xl=xl, nmxl=nmxl,
yl=yl, nmyl=nmyl):
funcname = func.__name__
print("-"*50)
print("%s on small arrays" % funcname)
module, ... | |
19,765 | [
0.01832810416817665,
-0.005603714846074581,
0.01644670031964779,
-0.059307798743247986,
-0.004980733618140221,
0.03099953942000866,
-0.012920627370476723,
-0.06145085394382477,
0.026663590222597122,
0.04141578450798988,
0.034438394010066986,
-0.031099215149879456,
-0.017331333830952644,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "methodname", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, {"_type"... | def compare_methods(methodname, args, vars='x', nloop=500, test=True,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
print("-"*50)
print("%s on small arrays" % methodname)
data, ver = "nm%ss" % vars, 'numpy.ma'
timer("%(data)s.%(methodname)s(%(args)s)" % locals(), v=ver, nloop=nloop)
prin... | |
19,766 | [
-0.03070013038814068,
-0.0215450469404459,
0.014338385313749313,
-0.02526703290641308,
-0.0024495781399309635,
0.012770905159413815,
-0.044239163398742676,
0.0035190244670957327,
0.013601481914520264,
0.05020932853221893,
0.0038718634750694036,
-0.05220770835876465,
0.01743587665259838,
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 NetworksTest(utils.TestCase):
def test_list_networks(self):
fl = cs.networks.list()
cs.assert_called('GET', '/os-networks')
[self.assertTrue(isinstance(f, networks.Network)) for f in fl]
def test_get_network(self):
f = cs.networks.get(1)
cs.assert_called('GET', '/... | |
19,767 | [
-0.011887998320162296,
-0.00944566261023283,
0.002218700712546706,
-0.03338055685162544,
-0.0289313867688179,
-0.04564520716667175,
-0.0009747276199050248,
0.011988046579062939,
0.011611396446824074,
0.04995313659310341,
0.012641297653317451,
-0.03542859107255936,
0.012429432012140751,
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_create_allparams(self):
params = {
'label': 'bar',
'bridge': 'br0',
'bridge_interface': 'int0',
'cidr': '192.0.2.0/24',
'cidr_v6': '2001:DB8::/32',
'dns1': '1.1.1.1',
'dns2': '1.1.1.2',
'fixed_cidr': '198.51... | |
19,768 | [
0.037595804780721664,
-0.004576651845127344,
-0.002004661364480853,
-0.010831897146999836,
-0.03310396149754524,
0.03399297222495079,
-0.0048281485214829445,
0.023944808170199394,
0.05165621638298035,
-0.015499204397201538,
0.048146963119506836,
-0.05801966413855553,
0.016914604231715202,
... | 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": "experiment", "annotation": null, "type_comment": null}}, {"_type"... | def remove_participant(self, experiment, alternative_name, participant_identifier):
counter_key = PARTICIPANT_KEY % (experiment.name, alternative_name)
self.counters.clear(counter_key, participant_identifier)
logger.info(json.dumps({'type':'participant_remove', 'experiment': experiment.name, 'al... | |
19,769 | [
0.011025053448975086,
-0.016939403489232063,
0.021309243515133858,
-0.018421130254864693,
-0.002217881614342332,
0.04811845347285271,
-0.0008546613389626145,
0.005528222769498825,
0.03495870903134346,
-0.003949178848415613,
0.05414582043886185,
-0.06539689749479294,
0.028328610584139824,
-... | 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 ExperimentCounter(object):
def __init__(self):
self.counters = counters.Counters()
def increment_participant_count(self, experiment, alternative_name, participant_identifier):
counter_key = PARTICIPANT_KEY % (experiment.name, alternative_name)
self.counters.increment(counter_key, ... | |
19,770 | [
0.022735413163900375,
0.011859727092087269,
-0.05440918728709221,
-0.00673452066257596,
0.05658227577805519,
-0.014893848448991776,
-0.020849337801337242,
0.06019042059779167,
0.00955338403582573,
0.038172535598278046,
-0.011326705105602741,
-0.0051790205761790276,
-0.014627337455749512,
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": n... | def process_request(self, request):
try:
auth = request.GET.get('auth')
except IOError:
# Django can throw an IOError when trying to read the GET
# data.
return
if auth is None or (request.user and request.user.is_authenticated()):
ret... | |
19,771 | [
0.021471481770277023,
-0.00951708946377039,
-0.031545668840408325,
0.018941329792141914,
0.07599744200706482,
0.0014188587665557861,
-0.011571387760341167,
0.030895721167325974,
0.01353283692151308,
0.0002573313540779054,
0.011095533147454262,
-0.048235394060611725,
-0.004030255135148764,
... | 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": n... | def process_request(self, request):
user = request.user
if (user.is_authenticated() and not user.is_active
and not request.session.get('in-aaq', False)):
# The user is auth'd, not active and not in AAQ. /KICK
logout(request)
res = HttpResponseRedirec... | |
19,772 | [
0.03108523041009903,
0.012914084829390049,
0.05714196711778641,
-0.005180871579796076,
-0.01752353645861149,
-0.0147680239751935,
-0.04860876500606537,
0.017587028443813324,
-0.029663030058145523,
0.01209504995495081,
0.007288775406777859,
0.02791067585349083,
-0.001403946429491043,
0.0142... | 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": "R", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def __init__(self, R, q=None):
# The calculations are based on Stata manual for makecns
R = self.R = np.atleast_2d(R)
if q is not None:
q = self.q = np.asarray(q)
k_constr, k_vars = R.shape
self.k_constr, self.k_vars = k_constr, k_vars
self.k_unconstr = k_va... | |
19,773 | [
-0.016654465347528458,
0.07784054428339005,
0.013287659734487534,
-0.0068233925849199295,
-0.004132753703743219,
0.017226822674274445,
-0.0002174395340261981,
-0.0008809808059595525,
-0.017103372141718864,
0.01131246704608202,
0.04511519521474838,
-0.02093030884861946,
-0.005218548700213432,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "task_vars", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "openshift_is_containerized", "annotation": null, "type_comme... | def test_all_images_available_locally(task_vars, openshift_is_containerized, openshift_is_atomic):
def execute_module(module_name, module_args, *_):
if module_name == "yum":
return {}
assert module_name == "docker_image_facts"
assert 'name' in module_args
assert module_a... | |
19,774 | [
-0.014928024262189865,
0.06046954169869423,
-0.010535881854593754,
-0.028467394411563873,
-0.022912781685590744,
0.01351833064109087,
-0.009231389500200748,
0.02004079334437847,
-0.0026655306573957205,
0.02232365496456623,
0.032991036772727966,
-0.0073535507544875145,
-0.014107456430792809,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "task_vars", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs... | def test_all_images_unavailable(task_vars):
def execute_module(module_name=None, *args):
if module_name == "wait_for":
return {}
elif module_name == "command":
return {'failed': True}
return {} # docker_image_facts failure
task_vars['openshift_docker_additional... | |
19,775 | [
-0.019233234226703644,
0.043974317610263824,
0.014035061933100224,
-0.028379803523421288,
-0.011789894662797451,
0.024530943483114243,
0.00821753405034542,
0.02112448215484619,
-0.026588093489408493,
0.021201903000473976,
0.01437791995704174,
-0.00028289249166846275,
0.00027183257043361664,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "task_vars", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "available_locally", "annotation": null, "type_comment": null... | def test_all_images_available_remotely(task_vars, available_locally):
def execute_module(module_name, *_):
if module_name == 'docker_image_facts':
return {'images': [], 'failed': available_locally}
return {}
task_vars['openshift_docker_additional_registries'] = ["docker.io", "regist... | |
19,776 | [
-0.018109261989593506,
0.06778351962566376,
0.02200549840927124,
-0.001348591293208301,
-0.017066607251763344,
0.05566677451133728,
-0.0022225005086511374,
0.020820165053009987,
-0.0009644554229453206,
-0.008857076056301594,
0.0019357703858986497,
-0.029677240177989006,
-0.04304516687989235,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "task_vars", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "message", "annotation": null, "type_comment": null}}, {"_typ... | def test_skopeo_update_failure(task_vars, message, extra_words):
def execute_module(module_name=None, *_):
if module_name == "yum":
return {
"failed": True,
"msg": message,
}
return {}
task_vars['openshift_docker_additional_registries'] =... | |
19,777 | [
-0.010603022761642933,
0.04770508408546448,
-0.0038448027335107327,
-0.04318445920944214,
-0.03898186981678009,
0.027668949216604233,
0.03012235276401043,
0.005508801434189081,
0.0037368983030319214,
0.0032484889961779118,
0.03348442539572716,
-0.019763534888625145,
0.01138674933463335,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "image", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "registries", "annotation": null, "type_comment": null}}, {"_type... | def test_registry_availability(image, registries, connection_test_failed, skopeo_failed,
expect_success, expect_registries_reached):
def execute_module(module_name=None, *_):
if module_name == "wait_for":
return dict(msg="msg", failed=connection_test_failed)
... | |
19,778 | [
0.013762292452156544,
0.04150279983878136,
0.00686409929767251,
0.006886828225106001,
0.009114251472055912,
-0.003224649466574192,
0.014080495573580265,
-0.0173307154327631,
-0.012603122740983963,
0.01335317362099886,
0.0417073592543602,
-0.0008828720892779529,
-0.0001963910908671096,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "deployment_type", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "openshift_is_containerized", "annotation": null, "type... | def test_required_images(deployment_type, openshift_is_containerized, groups, oreg_url, expected):
task_vars = dict(
openshift_is_containerized=openshift_is_containerized,
openshift_is_atomic=False,
openshift_deployment_type=deployment_type,
group_names=groups,
oreg_url=oreg_... | |
19,779 | [
-0.012327606789767742,
-0.0003818748227786273,
-0.05677155777812004,
-0.05514541268348694,
0.03539254516363144,
0.012094446457922459,
0.01567555032670498,
0.005234151147305965,
0.015591851435601711,
0.02166597731411457,
0.04887997731566429,
-0.03462730348110199,
0.019250676035881042,
-0.05... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "https?://(?:www\\.)?pornhub\\.com/(?:view_video\\.php\\?viewkey=|embed/)(?P<id>[0-9a-z]+)"}}, "targets": [{"_type": "Name", "_fields": {"... | class PornHubIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornhub\.com/(?:view_video\.php\?viewkey=|embed/)(?P<id>[0-9a-z]+)'
_TESTS = [{
'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
'md5': '882f488fa1f0026f023f33576004a2ed',
'info_dict': {
'id': ... | |
19,780 | [
-0.009165259078145027,
-0.04585425555706024,
-0.06146707385778427,
-0.039076775312423706,
0.039591237902641296,
-0.028205959126353264,
-0.010535295121371746,
-0.0032209819182753563,
0.015456239692866802,
0.02563364803791046,
0.06804324686527252,
-0.024716563522815704,
0.037913642823696136,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "https?://(?:www\\.)?pornhub\\.com/playlist/(?P<id>\\d+)"}}, "targets": [{"_type": "Name", "_fields": {"id": "_VALID_URL", "ctx": {"_type"... | class PornHubPlaylistIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornhub\.com/playlist/(?P<id>\d+)'
_TESTS = [{
'url': 'http://www.pornhub.com/playlist/6201671',
'info_dict': {
'id': '6201671',
'title': 'P0p4',
},
'playlist_mincount': 35,
}]
... | |
19,781 | [
-0.008998028002679348,
-0.02178143337368965,
-0.04974358156323433,
-0.04726136475801468,
0.03271558880805969,
-0.021074002608656883,
-0.01219387911260128,
0.0017034197226166725,
0.032095033675432205,
0.0075024934485554695,
0.048825159668922424,
-0.027502937242388725,
0.01029498502612114,
-... | 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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _real_extract(self, url):
video_id = self._match_id(url)
req = compat_urllib_request.Request(
'http://www.pornhub.com/view_video.php?viewkey=%s' % video_id)
req.add_header('Cookie', 'age_verified=1')
webpage = self._download_webpage(req, video_id)
error_msg = se... | |
19,782 | [
-0.004467756487429142,
-0.04271062836050987,
-0.05152250453829765,
-0.03814733400940895,
0.04426169767975807,
-0.01919730380177498,
0.013375170528888702,
-0.010514682158827782,
0.024996956810355186,
0.022692831233143806,
0.06015454977750778,
-0.03338172659277916,
0.044396575540304184,
-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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _real_extract(self, url):
playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id)
entries = [
self.url_result('http://www.pornhub.com/%s' % video_url, 'PornHub')
for video_url in set(re.findall('href="/?(view_video\.php\?viewkey=\d+[^"]*... | |
19,783 | [
0.015302659012377262,
0.04679995775222778,
0.04351005703210831,
-0.07511161267757416,
-0.014271670021116734,
-0.027269084006547928,
-0.0072227162308990955,
-0.009626426734030247,
0.005221554543823004,
0.0326441265642643,
0.025068094953894615,
-0.010889098979532719,
-0.007384893950074911,
0... | 47 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "inputline", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs... | def scaninputline(inputline):
files, funcs, skipfuncs, onlyfuncs, debug=[], [], [], [], []
f, f2, f3, f4, f5, f6, f7, f8, f9=1, 0, 0, 0, 0, 0, 0, 0, 0
verbose = 1
dolc=-1
dolatexdoc = 0
dorestdoc = 0
wrapfuncs = 1
buildpath = '.'
include_paths = []
signsfile, modulename=None, Non... | |
19,784 | [
0.02598848007619381,
0.015091556124389172,
0.027105528861284256,
-0.0496060810983181,
-0.03544919937849045,
0.025350166484713554,
-0.016026228666305542,
-0.007522981148213148,
-0.021736856549978256,
0.0494237057864666,
0.04032773897051811,
-0.048466235399246216,
-0.027812233194708824,
0.00... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "lst", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def buildmodules(lst):
cfuncs.buildcfuncs()
outmess('Building modules...\n')
modules, mnames, isusedby=[], [], {}
for i in range(len(lst)):
if '__user__' in lst[i]['name']:
cb_rules.buildcallbacks(lst[i])
else:
if 'use' in lst[i]:
for u in lst[i]['... | |
19,785 | [
-0.015620561316609383,
0.03349009156227112,
0.03921029716730118,
-0.06502456218004227,
-0.030825551599264145,
-0.027647659182548523,
-0.041508156806230545,
-0.05333969369530678,
-0.020925195887684822,
0.04835284873843193,
0.025520917028188705,
-0.018517332151532173,
0.000749019964132458,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "files", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}], "kwarg": ... | def callcrackfortran(files, options):
rules.options=options
funcs=[]
crackfortran.debug=options['debug']
crackfortran.verbose=options['verbose']
if 'module' in options:
crackfortran.f77modulename=options['module']
if 'skipfuncs' in options:
crackfortran.skipfuncs=options['skipfun... | |
19,786 | [
-0.007614437025040388,
0.0220754686743021,
-0.0007878383039496839,
-0.05430351942777634,
-0.023227233439683914,
-0.027855616062879562,
-0.04035438224673271,
0.014802294783294201,
0.0007145199924707413,
0.02046513371169567,
0.012786708772182465,
0.051573414355516434,
-0.014493024908006191,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def print_help():
print('intel_pstate_tracer.py:')
print(' Usage:')
print(' If the trace file is available, then to simply parse and plot, use (sudo not required):')
print(' ./intel_pstate_tracer.py [-c cpus] -t <trace_file> -n <test_name>')
print(' Or')
print(' ./intel_pstate_t... | |
19,787 | [
0.05344581976532936,
-0.015433668158948421,
-0.024888139218091965,
-0.01191522367298603,
-0.016728801652789116,
0.021779820322990417,
0.03507651761174202,
-0.014095364138484001,
0.020204074680805206,
0.019157174974679947,
0.005747152492403984,
-0.0037666785065084696,
0.00011087890015915036,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "d_out", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "d_in", "annotation": null, "type_comment": null}}], "kwarg": nul... | def dict_append(d_out, d_in):
for (k, v) in d_in.items():
if k not in d_out:
d_out[k] = []
if isinstance(v, list):
d_out[k] = d_out[k] + v
else:
d_out[k].append(v) | |
19,788 | [
0.031113509088754654,
-0.003944008611142635,
0.06724610924720764,
-0.026922808960080147,
0.007479911670088768,
0.04989856481552124,
-0.00809511635452509,
-0.00979454256594181,
-0.0345732718706131,
0.02432798594236374,
0.024498537182807922,
0.019674360752105713,
0.012584281153976917,
0.0122... | 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 TestReorganizedValues(unittest.TestCase):
def setUp(self):
self.path = os.path.join(os.path.dirname(__file__), 'reg_samples', 'REORGANIZED_VALUES_TESTS')
def test_access_bits(self):
root = Registry.Registry(self.path).root()
for key in root.subkeys():
assert(key._nkrec... | |
19,789 | [
0.04077101871371269,
0.037602417171001434,
0.008329962380230427,
0.07094702124595642,
-0.0062010567635297775,
-0.004588905721902847,
-0.021152906119823456,
-0.0063557736575603485,
0.018070943653583527,
0.015026113949716091,
0.04275139793753624,
-0.02438339777290821,
0.015805887058377266,
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": {"_type": "arg", "_fields": {"arg": "kw", "annotation": null, "type_comment": null}}, "varar... | def __call__(self, *args, **kw):
self.safeIn()
args = list(map(unwrap, args))
for k in list(kw.keys()):
kw[k] = unwrap(kw[k])
r = self._ref(*args, **kw)
self.safeOut()
if r is not None:
return SafeMembrane(r) | |
19,790 | [
0.04844686761498451,
0.06361481547355652,
-0.03975359722971916,
-0.008642332628369331,
-0.017013000324368477,
0.029883114621043205,
-0.017431817948818207,
-0.06239232420921326,
0.005504039581865072,
-0.05650625377893448,
0.032079070806503296,
-0.015699954703450203,
0.04754132032394409,
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": "attr", "annotation": null, "type_comment": null}}, {"_type": "arg... | def __setattr__(self, attr, val, osa=object.__setattr__):
if (attr == '_ref'
or hasattr(type(self), attr) and not attr.startswith('__')):
osa(self, attr, val)
else:
self.safeIn()
val = unwrap(val)
setattr(self._ref, attr, val)
s... | |
19,791 | [
0.005873159971088171,
0.015017981640994549,
0.005126482341438532,
0.020664235576987267,
-0.02729198895394802,
-0.01784638501703739,
0.008812378160655499,
-0.01800469122827053,
-0.0039154402911663055,
0.06032521650195122,
-0.01946110837161541,
-0.020495375618338585,
-0.005435179453343153,
-... | 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": "app", "annotation": null, "type_comment": null}}], "kwarg": {"_ty... | def __init__(self, app=None, *args, **kwargs):
if app is None:
app = App()
EventLoop.safe = Event()
self.safe = EventLoop.safe
self.safe.set()
EventLoop.confirmed = Event()
self.confirmed = EventLoop.confirmed
self.app = app
def startApp(app=a... | |
19,792 | [
-0.0029854674357920885,
0.01017573568969965,
0.023065002635121346,
-0.07841164618730545,
-0.019649697467684746,
0.018725693225860596,
0.004391941241919994,
-0.021778414025902748,
0.02772010862827301,
0.0360010527074337,
0.02141583152115345,
0.0005336413159966469,
-0.0192871131002903,
-0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}, {"_type": "a... | def format_output(module, path, st):
mode = st.st_mode
# back to ansible
output = dict(
exists=True,
path=path,
mode="%04o" % stat.S_IMODE(mode),
isdir=stat.S_ISDIR(mode),
ischr=stat.S_ISCHR(mode),
isblk=stat.S_ISBLK(mode),
isreg=stat.S_ISREG(mode),
... | |
19,793 | [
-0.002280120737850666,
0.023186802864074707,
0.029343606904149055,
-0.051089998334646225,
-0.026386301964521408,
0.039184294641017914,
-0.0035787217784672976,
-0.021376729011535645,
0.011032532900571823,
0.05073308199644089,
0.01824096590280533,
-0.05527101457118988,
-0.005583188496530056,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
module = AnsibleModule(
argument_spec=dict(
path=dict(type='path', required=True),
follow=dict(type='bool', default=False),
get_md5=dict(type='bool', default=False),
get_checksum=dict(type='bool', default=True),
get_mime=dict(type='bool... | |
19,794 | [
0.024480758234858513,
0.02619721181690693,
-0.01179604884237051,
-0.04964322969317436,
-0.02977619878947735,
-0.001638847403228283,
-0.020207885652780533,
0.01135780569165945,
-0.03277086094021797,
-0.0034968163818120956,
0.029800545424222946,
-0.03179698809981346,
0.04521210119128227,
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_stealth_table_name_filter_option(self):
out = StringIO()
# Lets limit the introspection to tables created for models of this
# application
call_command('inspectdb',
table_name_filter=lambda tn:tn.startswith('inspectdb_'),
stdout=out)
... | |
19,795 | [
0.011026127263903618,
0.003118967404589057,
0.005030779168009758,
-0.016715355217456818,
-0.009645695798099041,
0.0010295481188222766,
-0.014751560986042023,
-0.005978020839393139,
0.03211381286382675,
-0.043988991528749466,
0.016934838145971298,
-0.03992278501391411,
0.03216002136468887,
... | 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_attribute_name_not_python_keyword(self):
out = StringIO()
# Lets limit the introspection to tables created for models of this
# application
call_command('inspectdb',
table_name_filter=lambda tn:tn.startswith('inspectdb_'),
stdout=out)
... | |
19,796 | [
0.026764199137687683,
0.036622609943151474,
0.027100730687379837,
-0.04315529018640518,
0.014490676112473011,
0.016707828268408775,
0.027575835585594177,
-0.0398295633494854,
0.02296336553990841,
0.02666521817445755,
-0.0031054983846843243,
-0.004426881670951843,
-0.0252201110124588,
-0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pom", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def maven_version(pom):
dom = xml.dom.minidom.parse(pom)
project = dom.childNodes[0]
version = child_node(project, 'version')
if version:
return node_text(version)
parent = child_node(project, 'parent')
version = child_node(parent, 'version')
return node_text(version) | |
19,797 | [
0.02999277412891388,
-0.03768112137913704,
0.011429734528064728,
-0.03418641537427902,
0.046335648745298386,
-0.006131147965788841,
0.00043587424443103373,
0.03700273483991623,
-0.0005479745450429618,
-0.022674454376101494,
0.026950325816869736,
-0.052420541644096375,
0.03891454637050629,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "dropbox"}}, "targets": [{"_type": "Name", "_fields": {"id": "id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"... | class DropboxProvider(OAuthProvider):
id = 'dropbox'
name = 'Dropbox'
package = 'allauth.socialaccount.providers.dropbox'
account_class = DropboxAccount
def extract_uid(self, data):
return data['uid']
def extract_common_fields(self, data):
return dict(username=data.get('display... | |
19,798 | [
0.029563745483756065,
0.01044504251331091,
-0.04116934537887573,
0.011239109560847282,
-0.016298744827508926,
-0.011849930509924889,
-0.0022803989704698324,
-0.015820268541574478,
-0.02797560952603817,
0.008897628635168076,
-0.0015817723469808698,
-0.02958410605788231,
0.009615343064069748,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "Question", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}], "t... | class QuestionUpdateView(LoginRequiredMixin, UpdateView):
model = Question
fields = ('title', 'body_md', 'tags')
template_name = "questions/question_form.html"
def get_object(self, *args, **kwargs):
obj = super(QuestionUpdateView, self).get_object(*args, **kwargs)
if obj.user != self.re... | |
19,799 | [
-0.01907625049352646,
-0.007955379784107208,
-0.02549053728580475,
0.020763125270605087,
-0.008356272242963314,
-0.028093736618757248,
-0.011120871640741825,
0.003743401961401105,
-0.01741020381450653,
0.05547940358519554,
0.0058259619399905205,
-0.01803497038781643,
-0.00010347720672143623,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "Question", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "model", "ctx": {"_type": "Store", "_fields": {}}}}], "t... | class QuestionDetailView(DetailView):
model = Question
def get_context_data(self, **kwargs):
context = super(QuestionDetailView, self).get_context_data(**kwargs)
slug = self.kwargs['slug']
context['responses'] = Response.objects.filter(question__slug=slug)\
.order_by('create... | |
19,800 | [
-0.020130569115281105,
-0.013660029508173466,
-0.0067047434858977795,
0.014063077047467232,
-0.0031944208312779665,
-0.020871305838227272,
-0.007538070436567068,
0.018638206645846367,
-0.024596767500042915,
0.05912810191512108,
0.007331100292503834,
0.00022024619102012366,
-0.008736318908631... | 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):
context = super(QuestionDetailView, self).get_context_data(**kwargs)
slug = self.kwargs['slug']
context['responses'] = Response.objects.filter(question__slug=slug)\
.order_by('created')
context['is_question'] = True
return contex... |