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,701 | [
0.030444812029600143,
0.0043717240914702415,
-0.003171858610585332,
0.004670510999858379,
0.020166542381048203,
-0.01921042427420616,
0.009856821969151497,
0.04561689496040344,
0.002835330320522189,
0.03842084854841232,
0.07497978210449219,
-0.05198262631893158,
-0.04780590161681175,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_new_purified_field(self):
# This is not a full test of the html sanitizing. We expect the
# underlying bleach library to have full tests.
s = '<a id=xx href="http://xxx.com">yay</a> <i>http://yyy.com</i>'
m = FancyModel.objects.create(purified=s)
doc = pq(m.purified.lo... | |
20,702 | [
-0.002405124716460705,
0.031316544860601425,
-0.0003090834943577647,
-0.0837770476937294,
0.008075815625488758,
-0.036720000207424164,
-0.00909777358174324,
-0.028614817187190056,
-0.07625919580459595,
0.009867178276181221,
-0.016339577734470367,
-0.031175585463643074,
0.024151094257831573,
... | 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_sorting_by_field(self):
field = TranslatedModel._meta.get_field('default_locale')
TranslatedModel.get_fallback = classmethod(lambda cls: field)
translation.activate('de')
q = TranslatedModel.objects.all()
expected = [3, 1, 4]
eq_(ids(order_by_translation(q, 'na... | |
20,703 | [
0.011729791760444641,
-0.0008285059011541307,
-0.04452904686331749,
0.0027376010548323393,
-0.005484944209456444,
-0.012950833886861801,
0.005942835006862879,
0.004867928568273783,
-0.011690822429955006,
0.03790424391627312,
0.0505303330719471,
-0.03226667270064354,
-0.002094605704769492,
... | 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_new_linkified_field(self):
s = '<a id=xx href="http://xxx.com">yay</a> <i>http://yyy.com</i>'
m = FancyModel.objects.create(linkified=s)
doc = pq(m.linkified.localized_string_clean)
assert doc('a[href="http://xxx.com"][rel="nofollow"]')[0].text == 'yay'
assert doc('a[hr... | |
20,704 | [
0.03604244440793991,
0.007440818473696709,
-0.03669548034667969,
-0.009330849163234234,
-0.0015007220208644867,
0.005911840125918388,
0.017280280590057373,
0.02875860594213009,
-0.020281724631786346,
0.044732820242643356,
0.060380514711141586,
-0.05116268992424011,
-0.042698368430137634,
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_update_purified_field(self):
m = FancyModel.objects.get(id=1)
s = '<a id=xx href="http://xxx.com">yay</a> <i>http://yyy.com</i>'
m.purified = s
m.save()
doc = pq(m.purified.localized_string_clean)
assert doc('a[href="http://xxx.com"][rel="nofollow"]')[0].text ==... | |
20,705 | [
0.012928043492138386,
-0.004631532821804285,
-0.042808897793293,
-0.0021175770089030266,
-0.018404167145490646,
0.00931794848293066,
0.022770430892705917,
-0.005491369403898716,
-0.02447790838778019,
0.04739469662308693,
0.0450042262673378,
-0.023807113990187645,
-0.016208840534090996,
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_update_linkified_field(self):
m = FancyModel.objects.get(id=1)
s = '<a id=xx href="http://xxx.com">yay</a> <i>http://yyy.com</i>'
m.linkified = s
m.save()
doc = pq(m.linkified.localized_string_clean)
assert doc('a[href="http://xxx.com"][rel="nofollow"]')[0].text... | |
20,706 | [
0.01929803565144539,
0.013633249327540398,
-0.06097826361656189,
-0.015332684852182865,
0.014149374328553677,
0.0004287927586119622,
-0.018051782622933388,
0.028550516813993454,
-0.005101453512907028,
0.05050470679998398,
0.05538900941610336,
-0.03834430128335953,
0.0016711116768419743,
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_purified_field_str(self):
m = FancyModel.objects.get(id=1)
stringified = u'%s' % m.purified
doc = pq(stringified)
assert doc('a[href="http://yyy.com"][rel="nofollow"]')[0].text == (
'http://yyy.com')
assert doc('i')[0].text == 'x' | |
20,707 | [
-0.01790669746696949,
0.040338996797800064,
-0.02056090161204338,
-0.028352271765470505,
0.011258958838880062,
-0.005702867638319731,
0.007216497324407101,
-0.02945309318602085,
-0.05611743777990341,
0.01772322691977024,
0.009619957767426968,
-0.009607725776731968,
0.004641797859221697,
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_require_locale(self):
obj = TranslatedModel.objects.get(id=1)
eq_(unicode(obj.no_locale), 'blammo')
eq_(obj.no_locale.locale, 'en-US')
# Switch the translation to a locale we wouldn't pick up by default.
obj.no_locale.locale = 'fr'
obj.no_locale.save()
... | |
20,708 | [
-0.009345779195427895,
0.009665238671004772,
-0.06424283236265182,
-0.006909111514687538,
-0.005687645636498928,
0.004419200588017702,
-0.004807563964277506,
0.006689873989671469,
-0.009865684434771538,
0.057878684252500534,
0.02801228128373623,
-0.016411488875746727,
0.021159544587135315,
... | 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_linkified_field_str(self):
m = FancyModel.objects.get(id=1)
stringified = u'%s' % m.linkified
doc = pq(stringified)
assert doc('a[href="http://yyy.com"][rel="nofollow"]')[0].text == (
'http://yyy.com')
assert not doc('i')
assert '<i>' in string... | |
20,709 | [
-0.0022654447238892317,
-0.023201117292046547,
0.07027047872543335,
-0.036271821707487106,
-0.014182578772306442,
0.001407602452673018,
0.05737273395061493,
-0.008796163834631443,
-0.05673031508922577,
-0.01472616195678711,
-0.007233362644910812,
-0.009364455938339233,
0.007196299731731415,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "testapp/test_models.json"}}]}}, "targets": [{"_type": "Na... | class TranslationMultiDbTests(TransactionTestCase):
fixtures = ['testapp/test_models.json']
def setUp(self):
super(TranslationMultiDbTests, self).setUp()
translation.activate('en-US')
def tearDown(self):
self.cleanup_fake_connections()
super(TranslationMultiDbTests, self).t... | |
20,710 | [
0.02087598294019699,
0.017342044040560722,
0.005248249974101782,
-0.06454703956842422,
-0.022666355594992638,
0.02366100810468197,
-0.01152625773102045,
0.029722532257437706,
-0.00469826627522707,
-0.03587767109274864,
0.002391552086919546,
-0.05027086287736893,
-0.03655637428164482,
0.000... | 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": "get_fallback", "annotation": null, "type_comment": null}}], "kwar... | def test_delete_keep_other_translations(self, get_fallback):
# To make sure both translations for the name are used, set the
# fallback to the second locale, which is 'de'.
get_fallback.return_value = 'de'
obj = TranslatedModel.objects.get(id=1)
orig_name_id = obj.name.id
... | |
20,711 | [
0.016723159700632095,
-0.011001776903867722,
0.04627504199743271,
-0.04659575968980789,
0.02278244122862816,
0.02407676726579666,
0.006357091479003429,
0.02840646170079708,
-0.04865752160549164,
-0.0158182755112648,
-0.0012807247694581747,
-0.04593141749501228,
-0.023733140900731087,
0.000... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_translations_reading_from_multiple_db_using(self):
raise SkipTest('Will need a django-queryset-transform patch to work')
with patch.object(django.db.connections, 'databases', self.mocked_dbs):
# Make sure we are in a clean environnement.
reset_queries()
with... | |
20,712 | [
0.012108213268220425,
-0.0061011286452412605,
0.06197524070739746,
-0.03531366214156151,
0.028283845633268356,
0.016927987337112427,
0.00831117108464241,
0.01835040934383869,
-0.04368361085653305,
-0.008916581980884075,
-0.0008948909817263484,
-0.028283845633268356,
-0.018597275018692017,
... | 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_translations_reading_from_multiple_db(self):
with patch.object(django.db.connections, 'databases', self.mocked_dbs):
# Make sure we are in a clean environnement.
reset_queries()
with patch('multidb.get_slave', lambda: 'slave-2'):
TranslatedModel.obje... | |
20,713 | [
-0.0010229935869574547,
-0.012569957412779331,
0.033005326986312866,
-0.01559605821967125,
0.009249822236597538,
-0.019087713211774826,
-0.019443005323410034,
-0.008073686622083187,
0.032931819558143616,
-0.003142489353194833,
0.04584481567144394,
-0.019295986741781235,
-0.03944957256317139,... | 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 PurifiedTranslationTest(BaseTestCase):
def test_output(self):
assert isinstance(PurifiedTranslation().__html__(), unicode)
def test_raw_text(self):
s = u' This is some text '
x = PurifiedTranslation(localized_string=s)
eq_(x.__html__(), 'This is some text')
def t... | |
20,714 | [
0.0033172278199344873,
-0.006411152426153421,
0.06243087351322174,
-0.027172472327947617,
0.01893376000225544,
0.03133296221494675,
0.01726486347615719,
-0.01037772186100483,
-0.051900364458560944,
-0.03589304909110069,
0.00208465289324522,
-0.005482681095600128,
-0.006957657635211945,
-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_translations_reading_from_multiple_db_pinning(self):
with patch.object(django.db.connections, 'databases', self.mocked_dbs):
# Make sure we are in a clean environnement.
reset_queries()
with nested(patch('multidb.get_slave', lambda: 'slave-2'),
... | |
20,715 | [
-0.05369120091199875,
-0.012073774822056293,
0.017548568546772003,
-0.005727735813707113,
-0.0033950465731322765,
-0.008999121375381947,
-0.01005023717880249,
-0.02219146303832531,
0.019021254032850266,
0.010988933965563774,
0.05225224047899246,
0.0095331110060215,
-0.00879114679992199,
-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": "get_outgoing_url_mock", "annotation": null, "type_comment": null}... | def test_external_text_link(self, get_outgoing_url_mock):
get_outgoing_url_mock.return_value = 'http://external.url'
s = u'<b>markup</b> http://example.com'
x = PurifiedTranslation(localized_string=s)
doc = pq(x.__html__())
links = doc('a[href="http://external.url"][rel="nofollow... | |
20,716 | [
-0.052406925708055496,
-0.013716408982872963,
0.014126193709671497,
-0.012361842207610607,
-0.003138837870210409,
-0.005828050896525383,
-0.01509374100714922,
-0.01966967061161995,
0.014331085607409477,
0.005480872001498938,
0.05818944424390793,
0.0033465761225670576,
-0.005896348040550947,
... | 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": "get_outgoing_url_mock", "annotation": null, "type_comment": null}... | def test_external_link(self, get_outgoing_url_mock):
get_outgoing_url_mock.return_value = 'http://external.url'
s = u'<b>markup</b> <a href="http://example.com">bar</a>'
x = PurifiedTranslation(localized_string=s)
doc = pq(x.__html__())
links = doc('a[href="http://external.url"][... | |
20,717 | [
0.023112066090106964,
-0.024817055091261864,
0.012207244522869587,
-0.04094340652227402,
-0.030831875279545784,
-0.017440611496567726,
-0.019039038568735123,
-0.04572684317827225,
0.011052824556827545,
0.021833324804902077,
0.0008436141069978476,
-0.008412460796535015,
-0.038480643182992935,... | 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 NoLinksTranslationTest(BaseTestCase):
def test_allowed_tags(self):
s = u'<b>bold text</b> or <code>code</code>'
x = NoLinksTranslation(localized_string=s)
eq_(x.__html__(), u'<b>bold text</b> or <code>code</code>')
def test_forbidden_tags(self):
s = u'<script>some naughty... | |
20,718 | [
-0.02435905486345291,
-0.03401847183704376,
0.014483111910521984,
0.008077583275735378,
-0.0007266366155818105,
-0.0033020051196217537,
-0.016419807448983192,
-0.028701582923531532,
0.009436878375709057,
0.01708141155540943,
0.007151337340474129,
-0.016215311363339424,
-0.03543791547417641,
... | 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}}, {"_type": "arg", "_fields": {"arg": "get_outgoing_url_mock"... | class LinkifiedTranslationTest(BaseTestCase):
@patch('amo.urlresolvers.get_outgoing_url')
def test_allowed_tags(self, get_outgoing_url_mock):
get_outgoing_url_mock.return_value = 'http://external.url'
s = u'<a href="http://example.com">bar</a>'
x = LinkifiedTranslation(localized_string=... | |
20,719 | [
0.01198820024728775,
-0.014560083858668804,
0.021159859374165535,
-0.039121273905038834,
-0.03258117288351059,
-0.002030355855822563,
-0.022448785603046417,
-0.0457807220518589,
0.011546623893082142,
0.015502909198403358,
-0.010102549567818642,
-0.014488477259874344,
-0.030910341069102287,
... | 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 NoLinksNoMarkupTranslationTest(BaseTestCase):
def test_forbidden_tags(self):
s = u'<script>some naughty xss</script> <b>bold</b>'
x = NoLinksNoMarkupTranslation(localized_string=s)
eq_(x.__html__(),
'<script>some naughty xss</script> '
'<b>bol... | |
20,720 | [
0.021600982174277306,
0.012041088193655014,
0.011396463960409164,
-0.04519664868712425,
-0.007090862840414047,
-0.01499662734568119,
-0.026684997603297234,
-0.03361774608492851,
0.005655662622302771,
0.058818891644477844,
0.014753373339772224,
-0.01396279688924551,
-0.02450787089765072,
-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_links_stripped(self):
# Link with markup.
s = u'a <a href="http://example.com">link</a> with markup'
x = NoLinksTranslation(localized_string=s)
eq_(x.__html__(), u'a with markup')
# Text link.
s = u'a text http://example.com link'
x = NoLinksTranslation... | |
20,721 | [
0.01807386614382267,
0.012947143986821175,
0.009092792868614197,
-0.03922624886035919,
-0.006293578539043665,
-0.011662360280752182,
-0.02460329793393612,
-0.0419820137321949,
0.0036650472320616245,
0.05610843002796173,
0.0129099041223526,
-0.013096104376018047,
-0.020047591999173164,
-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_links_stripped(self):
# Link with markup.
s = u'a <a href="http://example.com">link</a> with markup'
x = NoLinksNoMarkupTranslation(localized_string=s)
eq_(x.__html__(), u'a with markup')
# Text link.
s = u'a text http://example.com link'
x = NoLinksNoM... | |
20,722 | [
-0.015840686857700348,
-0.0031681375112384558,
0.004124607890844345,
-0.021837128326296806,
-0.034619301557540894,
-0.027866454795002937,
0.015840686857700348,
-0.014908881857991219,
0.008375284262001514,
0.01578587479889393,
0.008523276075720787,
0.01573106274008751,
0.0009640072239562869,
... | 8 | {"_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 test_translation_bool():
def t(s):
return Translation(localized_string=s)
assert bool(t('text')) is True
assert bool(t(' ')) is False
assert bool(t('')) is False
assert bool(t(None)) is False | |
20,723 | [
0.03772704675793648,
-0.00802135095000267,
0.023506851866841316,
-0.05516274645924568,
0.02084854617714882,
0.02188168652355671,
0.0645422711968422,
0.004440183285623789,
-0.014881868846714497,
-0.04894068464636803,
0.03498748317360878,
-0.009257636964321136,
-0.00006284817936830223,
0.017... | 8 | {"_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 test_cache_key():
# Test that we are not taking the db into account when building our
# cache keys for django-cache-machine. See bug 928881.
eq_(Translation._cache_key(1, 'default'),
Translation._cache_key(1, 'slave'))
# Test that we are using the same cache no matter what Translation class... | |
20,724 | [
-0.010364559479057789,
-0.008086754009127617,
-0.0012077001156285405,
-0.011454418301582336,
0.02707209810614586,
0.00825023278594017,
-0.015083649195730686,
-0.011465317569673061,
0.0073728966526687145,
0.023867912590503693,
-0.059811465442180634,
-0.012773147784173489,
0.029382599517703056... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "A", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "B", "annotation": null, "type_comment": null}}], "kwarg": null, "var... | def _fast_dot(A, B):
if B.shape[0] != A.shape[A.ndim - 1]: # check adopted from '_dotblas.c'
raise ValueError
if A.dtype != B.dtype or any(x.dtype not in (np.float32, np.float64)
for x in [A, B]):
warnings.warn('Falling back to np.dot. '
'... | |
20,725 | [
0.006211627274751663,
0.025096794590353966,
0.043686170130968094,
-0.09620058536529541,
0.02260531671345234,
0.04227546975016594,
0.010699698701500893,
-0.023868121206760406,
-0.012775929644703865,
0.05051213502883911,
0.00838455930352211,
0.01775888353586197,
0.035426754504442215,
-0.0298... | 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": "tmp", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def run(self, tmp=None, task_vars=dict()):
# FIXME: is this necessary in v2?
#if self.runner.noop_on_check(inject):
# return ReturnData(conn=conn, comm_ok=True, result=dict(skipped=True, msg='check mode not supported for this module'))
# Parse out any hostname:port patterns
... | |
20,726 | [
0.030177041888237,
0.035955626517534256,
0.04662718251347542,
-0.013062695972621441,
0.008103299885988235,
0.0007347766659222543,
0.009038721211254597,
0.01279701478779316,
-0.0202250387519598,
-0.00006088544978410937,
-0.02769734524190426,
0.021154925227165222,
0.023402152583003044,
0.005... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "initial", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"... | class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Bar',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nam... | |
20,727 | [
0.031121887266635895,
-0.019722830504179,
0.021260473877191544,
0.009856289252638817,
-0.004612928256392479,
0.019200032576918602,
-0.032331500202417374,
0.018287697806954384,
0.009461628273129463,
0.030219804495573044,
-0.02109645865857601,
-0.04785143956542015,
-0.06175173074007034,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "digits", "annotation":... | class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
carry = 1
for i in range(len(digits) - 1, -1, -1):
if carry == 0:
break
n = digits[i]
n += carry
new_int = n % 10
carry = n // 10
digits[i] = ne... | |
20,728 | [
0.04872054606676102,
-0.02552572637796402,
0.04563552141189575,
0.008335281163454056,
-0.0032649848144501448,
0.01499093696475029,
-0.011974467895925045,
0.02047542668879032,
0.025045832619071007,
0.03912268951535225,
-0.024863017722964287,
-0.04396732151508331,
-0.049177587032318115,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "digits", "annotation": {"_type": "Subscript", "_fields": {"ctx": ... | def plusOne(self, digits: List[int]) -> List[int]:
carry = 1
for i in range(len(digits) - 1, -1, -1):
if carry == 0:
break
n = digits[i]
n += carry
new_int = n % 10
carry = n // 10
digits[i] = new_int
if ca... | |
20,729 | [
0.03074626252055168,
0.01619485765695572,
0.08897470682859421,
-0.01786113530397415,
-0.00771509762853384,
0.010602553375065327,
0.020235013216733932,
0.02442353405058384,
-0.04391670972108841,
-0.021787162870168686,
-0.044533006846904755,
0.01318186055868864,
-0.0014094889629632235,
0.010... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {... | class Migration(migrations.Migration):
dependencies = [
('money', '0007_transaction_currency'),
]
operations = [
migrations.AlterField(
model_name='dailyledger',
name='ending_balance',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=7,... | |
20,730 | [
0.012678946368396282,
0.003508142661303282,
-0.01148888561874628,
-0.047828055918216705,
-0.014551459811627865,
-0.026643836870789528,
0.016096847131848335,
0.019650110974907875,
0.012622545473277569,
0.0835186094045639,
-0.03135896101593971,
0.03693138062953949,
0.015623078681528568,
0.02... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "net", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "weight_path", "annotation": null, "type_comment": null}}], "kwarg"... | def init_params(net, weight_path=None):
if weight_path == None:
for pname, pval in zip(net.param_names(), net.param_values()):
print(pname, pval.shape)
if 'conv' in pname and len(pval.shape) > 1:
initializer.gaussian(pval, 0, pval.shape[1])
elif 'dense' in... | |
20,731 | [
-0.008539174683392048,
-0.018539251759648323,
0.019263239577412605,
-0.001507768640294671,
-0.03516510874032974,
-0.047007475048303604,
0.007033021654933691,
-0.05142896994948387,
0.019547663629055023,
0.02621869184076786,
0.02142227441072464,
-0.046180061995983124,
0.013691121712327003,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "category", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ohis", "annotation": null, "type_comment": null}}], "kwarg": ... | def add_option(category, ohis):
if ohis:
lines.append('')
display_scope = scope or 'Global'
if category:
lines.append(self._maybe_blue('{} {} options:'.format(display_scope, category)))
else:
lines.append(self._maybe_blue('{} options:'.format(display_scope)))
... | |
20,732 | [
-0.008900078013539314,
0.0010949732968583703,
0.020415185019373894,
-0.021761981770396233,
0.004158233292400837,
-0.05198633298277855,
-0.008995476178824902,
0.03959580510854721,
-0.07277188450098038,
0.006335553713142872,
-0.0013994054170325398,
-0.004834436811506748,
-0.0012794563081115484... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "depth", "annotation": null, "type_comment": null}}, {"_type": "ar... | def create_net(name, depth, use_cpu):
if use_cpu:
layer.engine = 'singacpp'
if name == 'resnet':
return create_resnet(depth)
elif name == 'wrn':
return create_wide_resnet(depth)
elif name == 'preact':
return create_preact_resnet(depth)
elif name == 'addbn':
re... | |
20,733 | [
0.034019578248262405,
0.029482098296284676,
0.007848457433283329,
-0.07172442227602005,
-0.010514514520764351,
-0.031416863203048706,
-0.0024328490253537893,
-0.00861430075019598,
-0.03825762867927551,
0.028652915731072426,
-0.026764217764139175,
0.01153371948748827,
-0.014683467335999012,
... | 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": "printer", "annotation": null, "type_comment": null}}], "kwarg": n... | def _print_contents(self, printer, *args):
if len(self.label) == 1:
return self._print_label(printer, *args)
else:
return '%s(%s)' % (
self._print_operator_name(printer, *args),
self._print_label(printer, *args)
) | |
20,734 | [
0.026262367144227028,
0.0034596072509884834,
-0.006011583376675844,
-0.04380204528570175,
-0.007927038706839085,
-0.03034081496298313,
0.010337566025555134,
-0.002506299875676632,
-0.03833268582820892,
0.021818511188030243,
-0.012494663707911968,
-0.00048070563934743404,
-0.01670277118682861... | 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": "printer", "annotation": null, "type_comment": null}}], "kwarg": n... | def _print_contents_pretty(self, printer, *args):
if len(self.label) == 1:
return self._print_label_pretty(printer, *args)
else:
pform = self._print_operator_name_pretty(printer, *args)
label_pform = self._print_label_pretty(printer, *args)
label_pform = p... | |
20,735 | [
0.0002238710439996794,
0.013130945153534412,
0.03599436953663826,
-0.06973062455654144,
-0.005882392171770334,
-0.04428165778517723,
-0.014813241548836231,
-0.009636510163545609,
-0.03342011943459511,
0.027165137231349945,
-0.03732666000723839,
0.027187718078494072,
-0.01862945780158043,
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": "printer", "annotation": null, "type_comment": null}}], "kwarg": n... | def _print_contents_latex(self, printer, *args):
if len(self.label) == 1:
return self._print_label_latex(printer, *args)
else:
return '%s(%s)' % (
self._print_operator_name_latex(printer, *args),
self._print_label_latex(printer, *args)
... | |
20,736 | [
-0.02264549769461155,
-0.000992192537523806,
-0.008673214353621006,
0.01135040633380413,
0.024448730051517487,
0.05465010181069374,
-0.02991374023258686,
0.0257320124655962,
0.0629250556230545,
0.0028071787673979998,
0.021450718864798546,
-0.013673588633537292,
-0.0029233379755169153,
0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "exp", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _eval_power(self, exp):
if isinstance(self, UnitaryOperator):
if exp == -1:
return Operator._eval_power(self, exp)
elif abs(exp) % 2 == 0:
return self*(Operator._eval_inverse(self))
else:
return self
else:
... | |
20,737 | [
0.03151772916316986,
0.0014501605182886124,
-0.004665931221097708,
-0.03357533738017082,
-0.0029941238462924957,
-0.033986859023571014,
0.02200431376695633,
0.0022149556316435337,
-0.023142050951719284,
0.012418275699019432,
-0.009586038067936897,
-0.009265292435884476,
-0.010415133088827133... | 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": "printer", "annotation": null, "type_comment": null}}], "kwarg": n... | def _print_contents_pretty(self, printer, *args):
pform = self._print_operator_name_pretty(printer, *args)
label_pform = self._print_label_pretty(printer, *args)
label_pform = prettyForm(
*label_pform.parens(left='(', right=')')
)
pform = prettyForm(*pform.right((labe... | |
20,738 | [
0.038705404847860336,
-0.015296882949769497,
0.04082934558391571,
-0.029125085100531578,
0.0018386762822046876,
0.06805644184350967,
0.0077840122394263744,
0.0167542677372694,
-0.01490146853029728,
0.0006870322395116091,
0.01633625663816929,
0.003050338476896286,
-0.0009511124808341265,
-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_NamedDict():
d = NamedDict()
d[toplevels.Name(('super', 'sub1', 'sub2'))] = {'sub3': 12}
d[toplevels.Name(('super', 'sub1', 'sub2'))]['sub4'] = 42
assert d[toplevels.Name(('super', 'sub1', 'sub2', 'sub3'))] == 12
assert d[toplevels.Name(('super', 'sub1', 'sub2', 'sub4'))] == 42 | |
20,739 | [
0.023339400067925453,
0.037213120609521866,
-0.008613074198365211,
-0.011605899780988693,
-0.024777812883257866,
0.03280508145689964,
0.02784023992717266,
0.021982189267873764,
-0.003088526427745819,
0.0053766462951898575,
0.054334867745637894,
-0.003741032211109996,
-0.005156244151294231,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def getregentry():
return codecs.CodecInfo(
name='cp857',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
) | |
20,740 | [
0.02673555351793766,
0.012719567865133286,
0.029939906671643257,
-0.021341968327760696,
0.0164742860943079,
-0.02016785368323326,
-0.0025897775776684284,
-0.03607954457402229,
-0.008518441580235958,
0.031529851257801056,
0.023592352867126465,
-0.040775999426841736,
0.016339752823114395,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_structure():
tokens = lexer.tokenize(open('sample.toml').read())
elements = elementsanitizer.sanitize(parser.parse_tokens(tokens))
entries_ = tuple(toplevels.identify(elements))
s = structure(entries_)
assert s['']['title'] == 'TOML Example'
assert s['owner']['name'] == 'Tom Preston-W... | |
20,741 | [
-0.02308911457657814,
-0.001371349673718214,
0.01586352102458477,
-0.014198985882103443,
-0.01533389650285244,
0.016292264685034752,
0.029482441022992134,
0.01201743632555008,
-0.013076686300337315,
0.004842282738536596,
0.0408315435051918,
0.009842192754149437,
-0.010781645774841309,
0.01... | 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_caption(self):
w1 = window.Window(400, 200, resizable=True)
w2 = window.Window(400, 200, resizable=True)
count = 1
w1.set_caption('Window caption %d' % count)
w2.set_caption(u'\u00bfHabla espa\u00f1ol?')
last_time = time.time()
while not (w1.has_exit or w... | |
20,742 | [
-0.012821860611438751,
0.005953425541520119,
0.01167223323136568,
-0.021655218675732613,
-0.013455328531563282,
0.022206570953130722,
0.03005453571677208,
-0.00027769210282713175,
0.0004864652582909912,
-0.010000581853091717,
0.04659508541226387,
0.010487413965165615,
-0.011959640309214592,
... | 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 WINDOW_CAPTION(unittest.TestCase):
def test_caption(self):
w1 = window.Window(400, 200, resizable=True)
w2 = window.Window(400, 200, resizable=True)
count = 1
w1.set_caption('Window caption %d' % count)
w2.set_caption(u'\u00bfHabla espa\u00f1ol?')
last_time = ti... | |
20,743 | [
0.02035738155245781,
0.04601776599884033,
0.011471571400761604,
0.0017119704280048609,
0.018790587782859802,
-0.020543644204735756,
-0.04213912412524223,
-0.055265143513679504,
-0.03528028726577759,
0.0183304101228714,
0.02441132813692093,
-0.005264651495963335,
-0.027764050289988518,
-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": "pos", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def _prepare_pos_var(self, pos, method_name, valid_pos, valid_sorted_pos):
if pos is None:
if self.node_order_by:
pos = 'sorted-sibling'
else:
pos = 'last-sibling'
if pos not in valid_pos:
raise InvalidPosition('Invalid relative positio... | |
20,744 | [
0.053907375782728195,
-0.021334942430257797,
0.018505213782191277,
0.005203954875469208,
0.041611284017562866,
-0.015044392086565495,
-0.0009046483901329339,
0.01938059739768505,
0.034363918006420135,
0.011512319557368755,
0.005318467505276203,
-0.01888183131814003,
0.028521236032247543,
-... | 11 | {"_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": "options", "annotation": null, "type_comment": null}}, "... | def handle(self, *args, **options):
email = options['email']
set_admin = options['set_admin']
try:
profile = UserProfile.objects.get(email=email)
except UserProfile.DoesNotExist:
raise CommandError('User with email %s not found' % email)
admin_msg = ''
... | |
20,745 | [
-0.014099949970841408,
-0.028095455840229988,
0.01571883261203766,
-0.04113007336854935,
-0.02243458665907383,
-0.022351030260324478,
0.012794398702681065,
-0.012616843916475773,
-0.0029479339718818665,
0.044660285115242004,
-0.0003733875637408346,
-0.014089505188167095,
0.04628961160778999,... | 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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def create_connect_args(self, url):
opts = url.translate_connect_args(username='user')
opts.update(url.query)
keys = opts
query = url.query
connect_args = {}
for param in ('ansi', 'unicode_results', 'autocommit'):
if param in keys:
connect_ar... | |
20,746 | [
0.012163468636572361,
-0.03020428866147995,
0.02342102862894535,
-0.015997005626559258,
0.00006658801430603489,
-0.004587539006024599,
0.022979123517870903,
0.007385357283055782,
0.008584028109908104,
0.017753582447767258,
0.01941072940826416,
-0.047063011676073074,
0.04359404742717743,
0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "pyodbc"}}, "targets": [{"_type": "Name", "_fields": {"id": "driver", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}},... | class PyODBCConnector(Connector):
driver = 'pyodbc'
supports_sane_multi_rowcount = False
if util.py2k:
# PyODBC unicode is broken on UCS-4 builds
supports_unicode = sys.maxunicode == 65535
supports_unicode_statements = supports_unicode
supports_native_decimal = True
defaul... | |
20,747 | [
0.015317377634346485,
-0.04447747766971588,
0.039554037153720856,
0.026805410161614418,
-0.0015155343571677804,
-0.017065556719899178,
0.042741190642118454,
0.007914374582469463,
-0.016387691721320152,
-0.0027248403057456017,
0.020990040153265,
-0.024569645524024963,
0.017125017940998077,
... | 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": "connection", "annotation": null, "type_comment": null}}], "kwarg"... | def initialize(self, connection):
# determine FreeTDS first. can't issue SQL easily
# without getting unicode_statements/binds set up.
pyodbc = self.dbapi
dbapi_con = connection.connection
_sql_driver_name = dbapi_con.getinfo(pyodbc.SQL_DRIVER_NAME)
self.freetds = bo... | |
20,748 | [
0.031096618622541428,
0.0011059725657105446,
0.04199805110692978,
0.00959656573832035,
0.030127601698040962,
0.047085389494895935,
0.00022005895152688026,
0.03241800516843796,
0.022882001474499702,
-0.005098347552120686,
0.030788294970989227,
-0.02953297831118107,
0.03873863443732262,
0.04... | 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": "e", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def is_disconnect(self, e, connection, cursor):
if isinstance(e, self.dbapi.ProgrammingError):
return "The cursor's connection has been closed." in str(e) or \
'Attempt to use a closed connection.' in str(e)
elif isinstance(e, self.dbapi.Error):
return '[08S01]' i... | |
20,749 | [
0.013435603119432926,
-0.014506557025015354,
0.029986709356307983,
-0.047468140721321106,
-0.002772039733827114,
0.027303915470838547,
0.014311838895082474,
0.001820080797187984,
0.01289471797645092,
0.03695331886410713,
-0.010812307707965374,
-0.03649897500872612,
0.0007464224472641945,
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": "vers", "annotation": null, "type_comment": null}}], "kwarg": null... | def _parse_dbapi_version(self, vers):
m = re.match(
r'(?:py.*-)?([\d\.]+)(?:-(\w+))?',
vers
)
if not m:
return ()
vers = tuple([int(x) for x in m.group(1).split(".")])
if m.group(2):
vers += (m.group(2),)
return vers | |
20,750 | [
0.038990218192338943,
-0.01901325210928917,
0.06019190326333046,
-0.04188135638833046,
-0.021864237263798714,
0.009586935862898827,
0.018149927258491516,
0.0023741470649838448,
-0.03551683574914932,
0.016413236036896706,
-0.036400239914655685,
-0.03744426369667053,
-0.01598157361149788,
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": "connection", "annotation": null, "type_comment": null}}], "kwarg"... | def _get_server_version_info(self, connection):
dbapi_con = connection.connection
version = []
r = re.compile('[.\-]')
for n in r.split(dbapi_con.getinfo(self.dbapi.SQL_DBMS_VER)):
try:
version.append(int(n))
except ValueError:
vers... | |
20,751 | [
0.02842344343662262,
-0.0009291685419157147,
0.009008996188640594,
-0.026668604463338852,
0.007217083126306534,
-0.03460245206952095,
0.02911549247801304,
0.02319600246846676,
-0.0010921399807557464,
0.01700463518500328,
0.02097155898809433,
-0.005582734942436218,
-0.03287233039736748,
-0.... | 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": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def render_POST(self, request):
headers = request.getAllHeaders()
origin = headers['host']
content = cgi.FieldStorage(
fp=request.content,
headers=headers,
environ={'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': headers['content-type']})
... | |
20,752 | [
-0.0023879765067249537,
-0.00810767151415348,
0.013009848073124886,
0.0051252697594463825,
0.044266361743211746,
-0.028837714344263077,
-0.0027710506692528725,
-0.03102167882025242,
0.027381738647818565,
-0.021123390644788742,
0.023248646408319473,
-0.02407056838274002,
0.002299913438037038,... | 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": "value", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, value, options=None):
Resource.__init__(self)
options = options or {}
if options.get('prettify', False):
self._data = json.dumps(value, sort_keys=True, indent=3, ensure_ascii=False)
else:
self._data = json.dumps(value, separators=(',', ':'), en... | |
20,753 | [
-0.02643437124788761,
0.05264529213309288,
0.02889234386384487,
0.021384356543421745,
0.022970866411924362,
-0.04857846722006798,
-0.008312414400279522,
-0.0018630310660228133,
0.021194422617554665,
0.01550756860524416,
-0.0053740208968520164,
-0.04207601398229599,
0.04292513057589531,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "CgiScript", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "cgiscript", "ctx": {"_type": "Store", "_fields": {}}}}... | class CgiDirectory(Resource, FilePath):
cgiscript = CgiScript
def __init__(self, pathname, filter, childNotFound=None):
Resource.__init__(self)
FilePath.__init__(self, pathname)
self.filter = filter
if childNotFound:
self.childNotFound = ... | |
20,754 | [
-0.005195124074816704,
0.03690126910805702,
0.024216456338763237,
0.0222866702824831,
0.04374965280294418,
-0.012072927318513393,
-0.027346475049853325,
0.011313957162201405,
0.04464394226670265,
0.006748366169631481,
0.003909580875188112,
-0.025110747665166855,
0.031253114342689514,
0.006... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "isLeaf", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_... | class RedirectResource(Resource):
isLeaf = True
def __init__(self, redirect_url):
Resource.__init__(self)
self._redirect_url = redirect_url
def render_GET(self, request):
request.redirect(self._redirect_url)
request.finish()
return server.NOT_DONE_YET | |
20,755 | [
-0.030503273010253906,
0.062470704317092896,
0.014316203072667122,
0.021820008754730225,
0.03971526026725769,
-0.03082864172756672,
0.01782407984137535,
-0.012780871242284775,
0.01569901779294014,
0.04270458221435547,
0.021657323464751244,
0.0003177424368914217,
0.03796640783548355,
-0.012... | 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": "pathname", "annotation": null, "type_comment": null}}, {"_type": ... | def __init__(self, pathname, filter, childNotFound=None):
Resource.__init__(self)
FilePath.__init__(self, pathname)
self.filter = filter
if childNotFound:
self.childNotFound = childNotFound
else:
self.childNotFound = NoResource(... | |
20,756 | [
0.003969487268477678,
0.047926366329193115,
0.009489326737821102,
-0.020066825672984123,
0.027684029191732407,
-0.047458335757255554,
-0.008237344212830067,
0.01317507028579712,
0.005142489913851023,
-0.00837190356105566,
-0.009109051898121834,
0.0029193428345024586,
0.015035493299365044,
... | 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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg... | def getChild(self, path, request):
fnp = self.child(path)
if not fnp.exists():
return File.childNotFound
elif fnp.isdir():
return CgiDirectory(fnp.path, self.filter, self.childNotFound)
else:
return self.cgiscript(fnp.path, ... | |
20,757 | [
0.03855178505182266,
-0.005044214427471161,
0.018849119544029236,
0.023259103298187256,
-0.04725320264697075,
0.029897786676883698,
-0.030964717268943787,
-0.03155745938420296,
0.014806635677814484,
0.044953372329473495,
-0.0003117439919151366,
-0.005939250811934471,
0.013158819638192654,
... | 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": "peer", "annotation": null, "type_comment": null}}, {"_type": "arg... | def getNotice(self, peer, redirectUrl=None, redirectAfter=0):
try:
page = self._templates.get_template('cb_lp_notice.html')
content = page.render(redirectUrl=redirectUrl,
redirectAfter=redirectAfter,
cbVersion=crossbar._... | |
20,758 | [
0.027541832998394966,
0.03759022429585457,
0.05498634651303291,
0.002130416687577963,
0.001541168661788106,
0.017663754522800446,
-0.017578599974513054,
-0.04272390529513359,
0.002504494274035096,
0.008138465695083141,
0.017967883497476578,
-0.02523045986890793,
0.014135870151221752,
0.013... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "WampLongPollResourceSession", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "protocol", "ctx": {"_type": "Store",... | class WampLongPollResource(longpoll.WampLongPollResource):
protocol = WampLongPollResourceSession
log = make_logger()
def getNotice(self, peer, redirectUrl=None, redirectAfter=0):
try:
page = self._templates.get_template('cb_lp_notice.html')
content = page.render(redirectUr... | |
20,759 | [
0.004598796833306551,
-0.02180209942162037,
0.02236991934478283,
-0.026098238304257393,
0.0022793104872107506,
-0.007033453788608313,
-0.02204851247370243,
0.026955323293805122,
-0.029419442638754845,
0.08326581120491028,
0.015770364552736282,
-0.01053678896278143,
-0.03989730775356293,
0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def get_installed_pythons():
python_core = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE,
"Software\\Python\\PythonCore")
i = 0
versions = []
while True:
try:
versions.append(winreg.EnumKey(python_core, i))
i = i + 1
ex... | |
20,760 | [
0.02032150886952877,
-0.001102849026210606,
0.024406494572758675,
-0.012907777912914753,
0.010555032640695572,
-0.018110962584614754,
-0.0020263337064534426,
0.030275428667664528,
0.040953271090984344,
0.055224861949682236,
0.02524675987660885,
0.0003005566541105509,
0.016327014192938805,
... | 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": "level", "annotation": null, "type_comment": null}}, {"_type": "ar... | def log(self, level, msg, *args, **kw):
if args:
if kw:
raise TypeError(
"You may give positional or keyword arguments, not both")
args = args or kw
rendered = None
for consumer_level, consumer in self.consumers:
if self.level_m... | |
20,761 | [
0.08158334344625473,
-0.003085833741351962,
0.016634168103337288,
0.012331831268966198,
-0.00991608016192913,
0.04109076410531998,
0.015817413106560707,
0.039710335433483124,
0.03501687943935394,
0.013965338468551636,
0.01615101657807827,
0.013988345861434937,
-0.04663548618555069,
-0.0113... | 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": "msg", "annotation": null, "type_comment": null}}], "kwarg": null,... | def end_progress(self, msg='done.'):
assert self.in_progress, (
"Tried to end_progress without start_progress")
if self.stdout_level_matches(self.NOTIFY):
if not self.in_progress_hanging:
# Some message has been printed out since start_progress
sys... | |
20,762 | [
0.029231823980808258,
0.0036058598197996616,
0.028606288135051727,
0.030940022319555283,
0.003103625727817416,
0.026729676872491837,
0.0336587019264698,
0.028678465634584427,
0.023902731016278267,
0.010940882377326488,
-0.0018390185432508588,
0.03962536156177521,
-0.03849458321928978,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg", "annotation": null, "type_comment": null}}], "kwarg": null,... | def start_progress(self, msg):
assert not self.in_progress, (
"Tried to start_progress(%r) while in_progress %r"
% (msg, self.in_progress))
if self.level_matches(self.NOTIFY, self._stdout_level()):
sys.stdout.write(msg)
sys.stdout.flush()
self.... | |
20,763 | [
0.08911418169736862,
0.004328955430537462,
-0.024555813521146774,
-0.054052866995334625,
0.009576337411999702,
-0.04739293456077576,
0.046017978340387344,
-0.023782402276992798,
-0.009189631789922714,
-0.0040174429304897785,
0.0337723009288311,
0.02764945849776268,
0.004404148552566767,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "dest", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "content", "annotation": null, "type_comment": null}}, {"_type": "... | def writefile(dest, content, overwrite=True):
if not os.path.exists(dest):
logger.info('Writing %s', dest)
f = open(dest, 'wb')
f.write(content.encode('utf-8'))
f.close()
return
else:
f = open(dest, 'rb')
c = f.read()
f.close()
if c != cont... | |
20,764 | [
0.020112786442041397,
-0.012922890484333038,
-0.05615686625242233,
-0.05960044637322426,
-0.010207759216427803,
0.003838552627712488,
0.0249375831335783,
-0.021020982414484024,
-0.013083716854453087,
0.04548554867506027,
0.05483241006731987,
-0.005534327123314142,
0.03969578817486763,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "src", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dest", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def copyfile(src, dest, symlink=True):
if not os.path.exists(src):
# Some bad symlink in the src
logger.warn('Cannot find file %s (bad symlink)', src)
return
if os.path.exists(dest):
logger.debug('File %s already exists', dest)
return
if not os.path.exists(os.path.dir... | |
20,765 | [
0.020864268764853477,
0.034587204456329346,
0.03192368149757385,
-0.005640686955302954,
-0.02806350216269493,
0.008207705803215504,
0.026075510308146477,
0.04253917559981346,
0.012835095636546612,
0.09032819420099258,
0.02650013007223606,
0.015836386010050774,
0.025747396051883698,
0.00004... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cmd", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "show_stdout", "annotation": null, "type_comment": null}}, {"_type"... | def call_subprocess(cmd, show_stdout=True,
filter_stdout=None, cwd=None,
raise_on_returncode=True, extra_env=None,
remove_from_env=None):
cmd_parts = []
for part in cmd:
if len(part) > 45:
part = part[:20]+"..."+part[-20:]
i... | |
20,766 | [
0.0048285373486578465,
0.031246831640601158,
0.03247016295790672,
-0.030604062601923943,
-0.056936826556921005,
0.0325116328895092,
0.0325116328895092,
0.02508869580924511,
-0.01307307742536068,
0.08078145235776901,
-0.004159850999712944,
0.013684744015336037,
-0.008755126036703587,
-0.018... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
parser = ConfigOptionParser(
version=virtualenv_version,
usage="%prog [OPTIONS] DEST_DIR",
formatter=UpdatingDefaultsHelpFormatter())
parser.add_option(
'-v', '--verbose',
action='count',
dest='verbose',
default=0,
help="Increase verbo... | |
20,767 | [
0.03441537171602249,
-0.024018172174692154,
0.026750905439257622,
-0.02218211628496647,
-0.048591431230306625,
0.013887840323150158,
0.055209770798683167,
0.0066877263598144054,
-0.009906161576509476,
0.05905267968773842,
-0.013855816796422005,
0.005246635992079973,
0.030871355906128883,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dst_prefix", "annotation": null, "type_comment": null}}], "kw... | def change_prefix(filename, dst_prefix):
prefixes = [sys.prefix]
if is_darwin:
prefixes.extend((
os.path.join("/Library/Python", sys.version[:3], "site-packages"),
os.path.join(sys.prefix, "Extras", "lib", "python"),
os.path.join("~", "Library", "Python", sys.version... | |
20,768 | [
-0.003814873518422246,
-0.007725538220256567,
0.030576463788747787,
-0.0374734103679657,
-0.03961912542581558,
-0.0251738540828228,
0.009080979973077774,
0.014157898724079132,
-0.0036807663273066282,
0.034752946346998215,
0.028909701853990555,
0.030423197895288467,
-0.0014596142573282123,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "project_names", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "py_executable", "annotation": null, "type_comment": null... | def install_wheel(project_names, py_executable, search_dirs=None):
if search_dirs is None:
search_dirs = file_search_dirs()
wheels = find_wheels(['setuptools', 'pip'], search_dirs)
pythonpath = os.pathsep.join(wheels)
findlinks = ' '.join(search_dirs)
cmd = [
py_executable, '-c',
... | |
20,769 | [
0.03342102840542793,
0.010992947965860367,
0.02375463955104351,
-0.008725459687411785,
0.0003338889218866825,
0.01761545240879059,
0.05495445430278778,
0.00697214063256979,
0.03687625005841255,
0.049853891134262085,
-0.01640201173722744,
-0.004905178677290678,
0.04061940312385559,
-0.03395... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "prefix_path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}, {"_ty... | def subst_path(prefix_path, prefix, home_dir):
prefix_path = os.path.normpath(prefix_path)
prefix = os.path.normpath(prefix)
home_dir = os.path.normpath(home_dir)
if not prefix_path.startswith(prefix):
logger.warn('Path not in prefix %r %r', prefix_path, prefix)
return
return prefix_... | |
20,770 | [
0.01142627652734518,
0.0446452796459198,
-0.03517306223511696,
0.01293874066323042,
-0.007816235534846783,
-0.025789162144064903,
0.0646495446562767,
0.015798069536685944,
0.027710100635886192,
0.040759239345788956,
0.0065356092527508736,
0.006607368588447571,
0.03148574009537697,
-0.01108... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "home_dir", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bin_dir", "annotation": null, "type_comment": null}}, {"_type... | def install_activate(home_dir, bin_dir, prompt=None):
home_dir = os.path.abspath(home_dir)
if is_win or is_jython and os._name == 'nt':
files = {
'activate.bat': ACTIVATE_BAT,
'deactivate.bat': DEACTIVATE_BAT,
'activate.ps1': ACTIVATE_PS,
}
# MSYS nee... | |
20,771 | [
0.010486838407814503,
0.054692286998033524,
0.05374151095747948,
-0.010379310697317123,
-0.025557778775691986,
-0.029451435431838036,
0.008517373353242874,
0.00894748605787754,
-0.010396288707852364,
0.04273967072367668,
-0.010107659734785557,
0.0050481706857681274,
-0.00046619176282547414,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "home_dir", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bin_dir", "annotation": null, "type_comment": null}}], "kwarg... | def fixup_scripts(home_dir, bin_dir):
if is_win:
new_shebang_args = (
'%s /c' % os.path.normcase(os.environ.get('COMSPEC', 'cmd.exe')),
'', '.exe')
else:
new_shebang_args = ('/usr/bin/env', sys.version[:3], '')
# This is what we expect at the top of scripts:
sheb... | |
20,772 | [
0.04525700584053993,
-0.024517491459846497,
0.04128226265311241,
0.0015348028391599655,
-0.018752142786979675,
-0.014344503171741962,
0.05623675137758255,
0.03547756001353264,
-0.030715733766555786,
0.051868464797735214,
-0.016813961789011955,
0.04895627498626709,
0.0409674309194088,
-0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "home_dir", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def install_distutils(home_dir):
distutils_path = change_prefix(distutils.__path__[0], home_dir)
mkdir(distutils_path)
## FIXME: maybe this prefix setting should only be put in place if
## there's a local distutils.cfg with a prefix setting?
home_dir = os.path.abspath(home_dir)
## FIXME: this is... | |
20,773 | [
-0.005874021910130978,
0.05496525391936302,
0.04242658242583275,
-0.023095205426216125,
-0.008340554311871529,
-0.022939307615160942,
0.065610870718956,
0.020623106509447098,
0.0218034777790308,
0.01978793740272522,
0.05082281678915024,
0.012137789279222488,
0.024498289451003075,
0.0157568... | 11 | {"_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 fixup_pth_file(filename):
lines = []
prev_lines = []
f = open(filename)
prev_lines = f.readlines()
f.close()
for line in prev_lines:
line = line.strip()
if (not line or line.startswith('#') or line.startswith('import ')
or os.path.abspath(line) != line):
... | |
20,774 | [
0.003617120673879981,
0.05215967819094658,
-0.009759940207004547,
-0.027771256864070892,
-0.031382665038108826,
-0.007074241992086172,
0.06281103938817978,
-0.02418270893394947,
-0.001874274224974215,
-0.002127129817381501,
0.0548568032681942,
0.004025689326226711,
0.0038685475010424852,
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 fixup_egg_link(filename):
f = open(filename)
link = f.readline().strip()
f.close()
if os.path.abspath(link) != link:
logger.debug('Link in %s already relative' % filename)
return
new_link = make_relative_path(filename, link)
logger.notify('Rewriting link %s in %s as %s' % (li... | |
20,775 | [
0.032316405326128006,
0.020093640312552452,
0.023633453994989395,
0.004799569025635719,
-0.01820921152830124,
-0.01122328732162714,
0.03579375147819519,
0.019698014482855797,
-0.01570010930299759,
0.010104081593453884,
0.029442910104990005,
-0.01269126869738102,
0.02230081707239151,
-0.008... | 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": "offset", "annotation": null, "type_comment": null}}, {"_type": "a... | def seek(self, offset, whence=0):
seekto = offset
if whence == os.SEEK_SET:
seekto += self._start
elif whence == os.SEEK_CUR:
seekto += self._start + self._pos
elif whence == os.SEEK_END:
seekto += self._end
else:
raise IOError("Inv... | |
20,776 | [
0.0352412648499012,
0.02860069088637829,
0.03280358389019966,
-0.025091275572776794,
-0.03784705698490143,
-0.02256953902542591,
0.018230050802230835,
-0.026331128552556038,
-0.030092718079686165,
0.023073885589838028,
0.05396515503525734,
0.013554331846535206,
0.016559401527047157,
-0.026... | 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": "fileobj", "annotation": null, "type_comment": null}}, {"_type": "... | def __init__(self, fileobj, start=0, size=maxint):
if isinstance(fileobj, fileview):
self._fileobj = fileobj._fileobj
else:
self._fileobj = fileobj
self._start = start
self._end = start + size
self._pos = 0 | |
20,777 | [
0.05921397730708122,
0.04476761072874069,
-0.004608091898262501,
-0.01696929708123207,
0.022026678547263145,
-0.009636672213673592,
-0.002599251689389348,
0.024376805871725082,
-0.0295378677546978,
0.02035624533891678,
0.04985955357551575,
-0.010460368357598782,
-0.0205866489559412,
0.0446... | 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": "size", "annotation": null, "type_comment": null}}], "kwarg": null... | def read(self, size=maxint):
assert size >= 0
here = self._start + self._pos
self._checkwindow(here, 'read')
size = min(size, self._end - here)
self._fileobj.seek(here, os.SEEK_SET)
bytes = self._fileobj.read(size)
self._pos += len(bytes)
return bytes | |
20,778 | [
0.0017357676988467574,
-0.004948128946125507,
-0.01414391491562128,
-0.025037644430994987,
0.0264273788779974,
0.003233375260606408,
-0.050792571157217026,
0.007066353689879179,
0.03030518814921379,
0.020139949396252632,
-0.006898240651935339,
-0.04391114041209221,
-0.031493186950683594,
0... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "quotes-js"}}, "targets": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}... | class QuotesJsSpider(scrapy.Spider):
name = 'quotes-js'
def __init__(self, *args, **kwargs):
# to be able to load the Lua script on Scrapy Cloud, make sure your
# project's setup.py file contains the "package_data" setting, similar
# to this project's setup.py
self.LUA_SOURCE = ... | |
20,779 | [
0.030434176325798035,
0.028869567438960075,
0.05024414882063866,
-0.013879599049687386,
0.0048578595742583275,
-0.004728527273982763,
-0.027027364820241928,
-0.021261023357510567,
-0.03303344547748566,
-0.002146606333553791,
0.056931592524051666,
-0.009002813138067722,
0.031443603336811066,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "file", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "offset", "annotation": null, "type_comment": null}}, {"_type": "a... | def do_file(file, offset=0, size=maxint):
file = fileview(file, offset, size)
# Read magic number
magic = read_data(file, BIG_ENDIAN)
if magic == FAT_MAGIC:
# Fat binaries contain nfat_arch Mach-O binaries
nfat_arch = read_data(file, BIG_ENDIAN)
for n ... | |
20,780 | [
0.021066632121801376,
-0.012797585688531399,
-0.005994271486997604,
-0.021581478416919708,
0.020835477858781815,
-0.026813989505171776,
-0.019311955198645592,
-0.027255285531282425,
0.00664045475423336,
0.01550840400159359,
-0.024628521874547005,
-0.009198920801281929,
-0.033664584159851074,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def __init__(self, *args, **kwargs):
# to be able to load the Lua script on Scrapy Cloud, make sure your
# project's setup.py file contains the "package_data" setting, similar
# to this project's setup.py
self.LUA_SOURCE = get_data(
'splash_crawlera_example', 'scripts/crawler... | |
20,781 | [
-0.01015646941959858,
0.02757462114095688,
-0.03965911641716957,
-0.03300165757536888,
0.023246174678206444,
-0.021466458216309547,
-0.03889010474085808,
0.026454059407114983,
0.02860729768872261,
-0.018379420042037964,
0.03449574112892151,
-0.03889010474085808,
-0.04207601770758629,
0.011... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def parse(self, response):
for quote in response.css('div.quote'):
yield {
'text': quote.css('span.text::text').extract_first(),
'author': quote.css('span small::text').extract_first(),
'tags': quote.css('div.tags a.tag::text').extract(),
}... | |
20,782 | [
-0.0003608845581766218,
-0.041578274220228195,
0.022659175097942352,
0.010126639157533646,
0.014632228761911392,
-0.0075676399283111095,
0.03252335265278816,
0.006895082071423531,
0.022298291325569153,
-0.0000997046081465669,
0.027820918709039688,
-0.03621968626976013,
0.02031889371573925,
... | 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": "payee", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, payee = None, amount = 0.0, min_due = 0.0, due_date = None, sched_date = None,
pmt_acct = "Other", pmt_method = "TBD", check_number = 0, pmt_freq = "Manual" ):
self.payee = payee
self.amount = amount
self.min_due = min_due
self.due_date = due_date
... | |
20,783 | [
0.00971847865730524,
-0.03115944005548954,
0.012218772433698177,
0.023847023025155067,
0.013242761604487896,
0.006172207649797201,
-0.0007499310886487365,
-0.003163059940561652,
0.034099481999874115,
-0.004736737348139286,
0.026812195777893066,
-0.049654074013233185,
0.026761937886476517,
... | 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}}, {"_type": "arg", "_fields": {"arg": "payee", "annotation": ... | class Bill:
def __init__(self, payee = None, amount = 0.0, min_due = 0.0, due_date = None, sched_date = None,
pmt_acct = "Other", pmt_method = "TBD", check_number = 0, pmt_freq = "Manual" ):
self.payee = payee
self.amount = amount
self.min_due = min_due
self.due_date... | |
20,784 | [
-0.010436924174427986,
-0.024717720225453377,
0.0034675714559853077,
-0.007812143303453922,
-0.027665933594107628,
0.029059182852506638,
-0.02175706811249256,
0.02153315208852291,
0.04249407723546028,
-0.005069185048341751,
0.027815209701657295,
-0.018858613446354866,
0.01563672535121441,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_pmt_method(self):
spm = self.payment_method
if spm == MYCHECKFREE:
return "Mycheckfree"
elif spm == SCHED_ONLINE:
return "sched online"
elif spm == SCHED_HICKAM:
return "sched Hickam"
elif spm == CHECK:
return "Check"
... | |
20,785 | [
-0.0075836279429495335,
-0.04520339518785477,
0.008354422636330128,
0.005140705034136772,
-0.01779044419527054,
0.04040457308292389,
0.014520782046020031,
0.029066428542137146,
0.03811705484986305,
-0.008671442978084087,
0.03558088839054108,
-0.02286277338862419,
0.0035680346190929413,
0.0... | 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": "pmt_method", "annotation": null, "type_comment": null}}], "kwarg"... | def set_pmt_method(self, pmt_method):
pmu = pmt_method.upper()
if pmu == "MYCHECKFREE":
self.pmt_method = MYCHECKFREE
elif pmu == "SCHED ONLINE":
self.pmt_method = SCHED_ONLINE
elif pmu == "SCHED HICKAM":
self.pmt_method = SCHED_HICKAM
elif pmu... | |
20,786 | [
-0.03515499085187912,
-0.0255120936781168,
0.03747018799185753,
0.024230869486927986,
-0.018218107521533966,
0.05466556176543236,
-0.01979154162108898,
0.005346863064914942,
0.04524744302034378,
-0.004293224774301052,
0.012834719382226467,
-0.010766778141260147,
-0.004029112868010998,
-0.0... | 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": "payment_freq", "annotation": null, "type_comment": null}}], "kwar... | def set_pmt_frequency(self, payment_freq):
pfu = payment_freq.upper()
if pfu == "MONTHLY":
self.payment_frequency = MONTHLY
elif pfu == "QUARTERLY":
self.payment_frequency = QUARTERLY
elif pfu == "SEMI-YEARLY":
self.payment_frequency = SEMI_YEARLY
... | |
20,787 | [
-0.009627033025026321,
-0.01855841837823391,
0.04725676402449608,
0.007581362035125494,
-0.006148803047835827,
0.05815128609538078,
-0.021565023809671402,
0.012262233532965183,
0.03940421715378761,
0.006750124040991068,
0.007728744298219681,
-0.005538638681173325,
-0.00407365569844842,
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 get_pmt_frequency(self):
spf = self.payment_frequency
if spf == MONTHLY:
return "monthly"
elif spf == QUARTERLY:
return "quarterly"
elif spf == SEMI_YEARLY:
return "semi-yearly"
elif spf == YEARLY:
return "yearly"
elif s... | |
20,788 | [
-0.019334372133016586,
0.008861139416694641,
-0.005228555761277676,
0.008479610085487366,
-0.012660305947065353,
-0.01092999242246151,
0.032736241817474365,
0.02553555741906166,
-0.0004943752428516746,
0.0498674176633358,
0.018528325483202934,
-0.017174167558550835,
0.00947373453527689,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "date", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "time", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _get_example(date, time, time_zone=None):
md = DictionaryTreeBrowser({'General': {'date': date,
'time': time}})
if time_zone:
md.set_item('General.time_zone', time_zone)
dt = parser.parse('%sT%s' % (date, time))
dt = dt.replace(tzinfo=tz.ge... | |
20,789 | [
0.0005928964237682521,
-0.030048951506614685,
0.039103828370571136,
-0.04295746982097626,
0.012861235067248344,
0.04113703966140747,
0.04789864271879196,
0.01380691397935152,
-0.025556975975632668,
-0.006460169795900583,
0.022282563149929047,
0.022743580862879753,
0.009415416978299618,
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": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_get_date_time_from_metadata():
assert (dtt.get_date_time_from_metadata(md1) ==
'2014-12-27T00:00:00+00:00')
assert (dtt.get_date_time_from_metadata(md1, formatting='ISO') ==
'2014-12-27T00:00:00+00:00')
assert (dtt.get_date_time_from_metadata(md1, formatting='datetime64') ==... | |
20,790 | [
-0.0014680820750072598,
-0.03293074294924736,
0.01943611353635788,
-0.07153836637735367,
-0.002388922031968832,
-0.011943106539547443,
0.027446294203400612,
-0.02900984324514866,
0.025858690962195396,
-0.01259258110076189,
0.002188968239352107,
0.03723651543259621,
-0.012785017490386963,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_serial_date_to_ISO_format():
iso_1 = dtt.serial_date_to_ISO_format(serial1)
dt1_local = dt1.astimezone(tz.tzlocal())
assert iso_1[0] == dt1_local.date().isoformat()
assert iso_1[1] == dt1_local.time().isoformat()
assert iso_1[2] == dt1_local.tzname()
iso_2 = dtt.serial_date_to_ISO_form... | |
20,791 | [
0.011025267653167248,
-0.040327321738004684,
0.029894012957811356,
-0.05712420493364334,
0.0032126198057085276,
0.00023431776207871735,
0.023567434400320053,
-0.01745050773024559,
0.018523436039686203,
-0.0061662569642066956,
0.017684824764728546,
0.0344817079603672,
-0.018992071971297264,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_ISO_format_to_serial_date():
res1 = dtt.ISO_format_to_serial_date(
dt1.date().isoformat(), dt1.time().isoformat(), timezone=dt1.tzname())
assert_allclose(res1, serial1, atol=1E-5)
dt = dt2.astimezone(tz.tzlocal())
res2 = dtt.ISO_format_to_serial_date(
dt.date().isoformat(), dt.t... | |
20,792 | [
0.01667790673673153,
0.029289759695529938,
0.026051102206110954,
0.023734398186206818,
-0.021937770769000053,
0.008711280301213264,
-0.028958803042769432,
0.04579036682844162,
-0.035648878663778305,
0.008935859426856041,
-0.029407959431409836,
-0.04727967828512192,
0.03311941400170326,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "res.partner"}}, "targets": [{"_type": "Name", "_fields": {"id": "_inherit", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": ... | class ResPartner(models.Model):
_inherit = 'res.partner'
@api.multi
def get_top_partner_id(self):
self.ensure_one()
if self.parent_id:
return self.parent_id.get_top_partner_id()
return self.id | |
20,793 | [
0.015816980972886086,
0.01084817759692669,
-0.00671687675639987,
-0.015906913205981255,
0.04694506898522377,
-0.011505813337862492,
-0.042201098054647446,
0.01769433356821537,
0.053600117564201355,
0.009223761968314648,
0.05953570082783699,
-0.01135967206209898,
-0.04892359673976898,
0.038... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def _readpid(f):
f.seek(0)
data = f.read()
if not data.endswith("\n"):
return None
if len(data)==0:
return None
else:
return int(data.rstrip()) | |
20,794 | [
-0.013376534916460514,
0.022397149354219437,
0.02465781755745411,
-0.017203127965331078,
0.016298862174153328,
0.01884624734520912,
0.044066473841667175,
0.029973143711686134,
-0.014677797444164753,
-0.03853059560060501,
0.062195926904678345,
0.02184576727449894,
-0.00939004123210907,
-0.0... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def acquire(self):
logger.debug("Acquiring lock %s" % self.lock_id)
if not os.path.exists(self.path):
self._make_lockfile()
while True:
with open(self.path, "r+") as f:
fcntl.flock(f, fcntl.LOCK_EX)
pid = _readpid(f)
if pid=... | |
20,795 | [
0.04664880782365799,
0.03770890459418297,
0.03795536980032921,
-0.03311572223901749,
-0.04279501363635063,
0.015896892175078392,
-0.0032404339872300625,
0.04003910347819328,
0.0015207914402708411,
-0.023010723292827606,
0.07048854231834412,
0.029934104532003403,
-0.01472058892250061,
0.002... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def release(self):
logger.debug("%d: Releasing lock %s" % (os.getpid(), self.lock_id))
if not os.path.exists(self.path):
raise LockError("Process %d attempted to release lock %s, but lockfile %s does not exist" %
(os.getpid(), self.lock_id, self.lock_path))
... | |
20,796 | [
0.013774829916656017,
0.049093686044216156,
0.009175276383757591,
0.0016324842581525445,
0.0428735613822937,
0.04227776452898979,
0.021269958466291428,
-0.003139850916340947,
0.0023638252168893814,
-0.006917205173522234,
0.042516086250543594,
0.03970392048358917,
0.021901503205299377,
0.01... | 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 is_locked_by_me(self):
if not os.path.exists(self.path):
return False
with open(self.path, "r") as f:
fcntl.flock(f, fcntl.LOCK_EX)
pid = _readpid(f)
fcntl.flock(f, fcntl.LOCK_UN)
if pid!=None and pid==os.getpid():
return True
... | |
20,797 | [
0.01416790671646595,
0.044341593980789185,
0.009706993587315083,
-0.001019263407215476,
0.041735999286174774,
0.040130771696567535,
0.01819261536002159,
-0.002671022666618228,
0.007776063866913319,
-0.006868759170174599,
0.03813004866242409,
0.033802904188632965,
0.021193699911236763,
0.01... | 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 is_locked(self):
if not os.path.exists(self.path):
return False
with open(self.path, "r") as f:
fcntl.flock(f, fcntl.LOCK_EX)
pid = _readpid(f)
fcntl.flock(f, fcntl.LOCK_UN)
if pid!=None and (pid==os.getpid() or is_process_alive(pid)):
... | |
20,798 | [
0.008446912281215191,
-0.03674818202853203,
0.011936109513044357,
0.012805472128093243,
0.009504244662821293,
0.0023466909769922495,
-0.004804989323019981,
0.01077304407954216,
-0.0018224301747977734,
-0.024365641176700592,
0.010308993048965931,
0.01298169419169426,
0.016764596104621887,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, "targets": [{"_type": "Name", "_fields": {"id": "num_ipv4_received", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": nul... | class AddrReceiver(P2PInterface):
num_ipv4_received = 0
test_addr_contents = False
_tokens = 1
send_getaddr = True
def __init__(self, test_addr_contents=False, send_getaddr=True):
super().__init__()
self.test_addr_contents = test_addr_contents
self.send_getaddr = send_getadd... | |
20,799 | [
-0.031049737706780434,
0.0335051454603672,
0.009196615777909756,
-0.020770510658621788,
0.004294171929359436,
-0.0014620833098888397,
0.027589846402406693,
0.018170012161135674,
-0.01027364656329155,
-0.027076443657279015,
0.06031372398138046,
0.01293553039431572,
-0.006629598792642355,
0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def acquire_if_available(self):
logger.debug("Attepting to acquire lock %s" % self.lock_id)
if not os.path.exists(self.path):
self._make_lockfile()
with open(self.path, "r+") as f:
fcntl.flock(f, fcntl.LOCK_EX)
pid = _readpid(f)
if pid==None:
... | |
20,800 | [
0.028391102328896523,
0.0189497210085392,
0.07922724634408951,
-0.012836260721087456,
-0.027908990159630775,
-0.009896709583699703,
0.002656643744558096,
-0.004576725885272026,
0.021989712491631508,
0.03551566228270531,
0.03230157494544983,
0.03230157494544983,
-0.04290806129574776,
-0.023... | 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 run_test(self):
self.oversized_addr_test()
self.relay_tests()
self.inbound_blackhole_tests()
# This test populates the addrman, which can impact the node's behavior
# in subsequent tests
self.getaddr_tests()
self.blocksonly_mode_tests()
self.rate_limi... |