query_name
stringlengths 13
55
| code_file_path
stringlengths 14
194
| context_blocks
list | answer_spans
list | supporting_fact_spans
list | example_type
int8 0
1
| single_hop
bool 2
classes | subtokenized_input_sequence
sequence | label_sequence
sequence |
---|---|---|---|---|---|---|---|---|
Implicit string concatenation in a list | saltstack/salt/tests/unit/modules/cmdmod_test.py | [
{
"content": " @patch('salt.modules.cmdmod._is_valid_shell', MagicMock(return_value=True))\n @patch('salt.utils.is_windows', MagicMock(return_value=True))\n def test_run_runas_with_windows(self):\n '''\n Tests error raised when runas is passed on windows\n '''\n with patch.dict(cmdmod.__grains__, {'os': 'fake_os'}):\n self.assertRaises(CommandExecutionError,\n cmdmod._run,\n 'foo', 'bar', runas='baz')",
"metadata": "root.CMDMODTestCase.test_run_runas_with_windows",
"header": "['class', 'CMDMODTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 128
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Implicit",
"_",
"string_",
"concate",
"nation_",
"in_",
"a_",
"list_",
"[SEP]_",
"class_",
"CMD",
"MOD",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"salt",
".",
"module",
"s",
".",
"cmd",
"mod",
".\\u",
"is",
"\\u",
"valid",
"\\u",
"shell",
"'_",
",_",
"Mag",
"ic",
"Mock_",
"(_",
"return",
"\\u",
"value_",
"=_",
"True_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"patch_",
"(_",
"'",
"salt",
".",
"util",
"s",
".",
"is",
"\\u",
"windows",
"'_",
",_",
"Mag",
"ic",
"Mock_",
"(_",
"return",
"\\u",
"value_",
"=_",
"True_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"run",
"\\u",
"runa",
"s",
"\\u",
"with",
"\\u",
"windows_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
"s",
" ",
"error",
" ",
"raise",
"d",
" ",
"whe",
"n",
" ",
"runa",
"s",
" ",
"is",
" ",
"pass",
"ed",
" ",
"on",
" ",
"windows",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"patch_",
"._",
"dict_",
"(_",
"cmd",
"mod_",
"._",
"\\u\\u",
"grains",
"\\u\\u_",
",_",
"{_",
"'",
"os",
"'_",
":_",
"'",
"fake",
"\\u",
"os",
"'_",
"}_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"Raises_",
"(_",
"Command",
"Execut",
"ion",
"Error_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cmd",
"mod_",
"._",
"\\u",
"run_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"foo",
"'_",
",_",
"'",
"bar",
"'_",
",_",
"runa",
"s_",
"=_",
"'",
"ba",
"z",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | mozilla/kitsune/kitsune/customercare/tests/test_badges.py | [
{
"content": "from datetime import date\n\nfrom kitsune.customercare.badges import AOA_BADGE\nfrom kitsune.customercare.tests import ReplyFactory\nfrom kitsune.kbadge.tests import BadgeFactory\nfrom kitsune.sumo.tests import TestCase\nfrom kitsune.users.tests import UserFactory\nfrom kitsune.customercare.badges import register_signals\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestAOABadges(TestCase):\n\n",
"metadata": "root.TestAOABadges",
"header": "['module', '___EOS___']",
"index": 10
},
{
"content": " def setUp(self):\n # Make sure the badges hear this.\n register_signals()",
"metadata": "root.TestAOABadges.setUp",
"header": "['class', 'TestAOABadges', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 12
},
{
"content": " def test_aoa_badge(self):\n \"\"\"Verify the KB Badge is awarded properly.\"\"\"\n # Create the user and badge.\n year = date.today().year\n u = UserFactory()\n b = BadgeFactory(\n slug=AOA_BADGE['slug'].format(year=year),\n title=AOA_BADGE['title'].format(year=year),\n description=AOA_BADGE['description'].format(year=year))\n\n # Create 49 replies.\n # FIXME: Do this as a batch\n for _ in range(49):\n ReplyFactory(user=u)\n\n # User should NOT have the badge yet.\n assert not b.is_awarded_to(u)\n\n # Create 1 more reply.\n ReplyFactory(user=u)\n\n # User should have the badge now.\n assert b.is_awarded_to(u)",
"metadata": "root.TestAOABadges.test_aoa_badge",
"header": "['class', 'TestAOABadges', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 16
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"datetime_",
"import_",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"kit",
"sun",
"e_",
"._",
"customer",
"care",
"_",
"._",
"badge",
"s_",
"import_",
"AO",
"A",
"\\u",
"BAD",
"GE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"kit",
"sun",
"e_",
"._",
"customer",
"care",
"_",
"._",
"tests_",
"import_",
"Repl",
"y",
"Factory_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"kit",
"sun",
"e_",
"._",
"kb",
"ad",
"ge_",
"._",
"tests_",
"import_",
"Badge",
"Factory_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"kit",
"sun",
"e_",
"._",
"sum",
"o_",
"._",
"tests_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"kit",
"sun",
"e_",
"._",
"users_",
"._",
"tests_",
"import_",
"User",
"Factory_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"kit",
"sun",
"e_",
"._",
"customer",
"care",
"_",
"._",
"badge",
"s_",
"import_",
"register",
"\\u",
"signals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"AO",
"AB",
"ad",
"ges_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"AO",
"AB",
"ad",
"ges_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"the",
" ",
"badge",
"s",
" ",
"hear",
" ",
"this",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"register",
"\\u",
"signals_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"AO",
"AB",
"ad",
"ges_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"ao",
"a",
"\\u",
"badge",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Verify",
" ",
"the",
" ",
"KB",
" ",
"Badge",
" ",
"is",
" ",
"award",
"ed",
" ",
"proper",
"ly",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"the",
" ",
"user",
" ",
"and",
" ",
"badge",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"year_",
"=_",
"date_",
"._",
"today_",
"(_",
")_",
"._",
"year_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u_",
"=_",
"User",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b_",
"=_",
"Badge",
"Factory_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"slug_",
"=_",
"AO",
"A",
"\\u",
"BAD",
"GE_",
"[_",
"'",
"slug",
"'_",
"]_",
"._",
"format_",
"(_",
"year_",
"=_",
"year_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"title_",
"=_",
"AO",
"A",
"\\u",
"BAD",
"GE_",
"[_",
"'",
"title",
"'_",
"]_",
"._",
"format_",
"(_",
"year_",
"=_",
"year_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"AO",
"A",
"\\u",
"BAD",
"GE_",
"[_",
"'",
"description",
"'_",
"]_",
"._",
"format_",
"(_",
"year_",
"=_",
"year_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"4",
"9",
" ",
"replies",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FIX",
"ME",
":",
" ",
"Do",
" ",
"this",
" ",
"as",
" ",
"a",
" ",
"batch_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"\\u_",
"in_",
"range_",
"(_",
"49_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Repl",
"y",
"Factory_",
"(_",
"user_",
"=_",
"u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"User",
" ",
"shou",
"ld",
" ",
"NOT",
" ",
"have",
" ",
"the",
" ",
"badge",
" ",
"ye",
"t",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"not_",
"b_",
"._",
"is",
"\\u",
"award",
"ed",
"\\u",
"to_",
"(_",
"u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | django/django/tests/admin_views/admin.py | [
{
"content": "class MainPrepopulatedAdmin(admin.ModelAdmin):\n inlines = [RelatedPrepopulatedInline1, RelatedPrepopulatedInline2]\n fieldsets = (\n (None, {\n 'fields': (('pubdate', 'status'), ('name', 'slug1', 'slug2', 'slug3'))\n }),\n )\n formfield_overrides = {models.CharField: {'strip': False}}\n prepopulated_fields = {\n 'slug1': ['name', 'pubdate'],\n 'slug2': ['status', 'name'],\n 'slug3': ['name'],\n }",
"metadata": "root.MainPrepopulatedAdmin",
"header": "['module', '___EOS___']",
"index": 683
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Main",
"Prep",
"opu",
"late",
"d",
"Admin_",
"(_",
"admin_",
"._",
"Model",
"Admin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"inlines_",
"=_",
"[_",
"Rela",
"ted",
"Prep",
"opu",
"late",
"d",
"In",
"line1_",
",_",
"Rela",
"ted",
"Prep",
"opu",
"late",
"d",
"In",
"line2_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fieldsets_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"None_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"fields",
"'_",
":_",
"(_",
"(_",
"'",
"pub",
"date",
"'_",
",_",
"'",
"status",
"'_",
")_",
",_",
"(_",
"'",
"name",
"'_",
",_",
"'",
"slug",
"1",
"'_",
",_",
"'",
"slug",
"2",
"'_",
",_",
"'",
"slug",
"3",
"'_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"formfi",
"eld",
"\\u",
"overrides_",
"=_",
"{_",
"models_",
"._",
"Char",
"Field_",
":_",
"{_",
"'",
"strip",
"'_",
":_",
"False_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"prepo",
"pulat",
"ed",
"\\u",
"fields_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"slug",
"1",
"'_",
":_",
"[_",
"'",
"name",
"'_",
",_",
"'",
"pub",
"date",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"slug",
"2",
"'_",
":_",
"[_",
"'",
"status",
"'_",
",_",
"'",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"slug",
"3",
"'_",
":_",
"[_",
"'",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | GluuFederation/community-edition-setup/static/auth/lib/duo_web.py | [
{
"content": "# \n# duo_web.py\n#\n# Copyright (c) 2011 Duo Security\n# All rights reserved, all wrongs reversed.\n#\n\nimport base64\nimport hashlib\nimport hmac\nimport time\n\nDUO_PREFIX = 'TX'\nAPP_PREFIX = 'APP'\nAUTH_PREFIX = 'AUTH'\n\nDUO_EXPIRE = 300\nAPP_EXPIRE = 3600\n\nIKEY_LEN = 20\nSKEY_LEN = 40\nAKEY_LEN = 40\n\nERR_USER = 'ERR|The username passed to sign_request() is invalid.'\nERR_IKEY = 'ERR|The Duo integration key passed to sign_request() is invalid.'\nERR_SKEY = 'ERR|The Duo secret key passed to sign_request() is invalid.'\nERR_AKEY = 'ERR|The application secret key passed to sign_request() must be at least %s characters.' % AKEY_LEN\nERR_UNKNOWN = 'ERR|An unknown error has occurred.'\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def _hmac_sha1(key, msg):\n ctx = hmac.new(key, msg, hashlib.sha1)\n return ctx.hexdigest()",
"metadata": "root._hmac_sha1",
"header": "['module', '___EOS___']",
"index": 29
},
{
"content": "def _sign_vals(key, vals, prefix, expire):\n exp = str(int(time.time()) + expire)\n\n val = '|'.join(vals + [ exp ])\n b64 = base64.b64encode(val)\n cookie = '%s|%s' % (prefix, b64)\n\n sig = _hmac_sha1(key, cookie)\n return '%s|%s' % (cookie, sig)",
"metadata": "root._sign_vals",
"header": "['module', '___EOS___']",
"index": 33
},
{
"content": "def _parse_vals(key, val, prefix):\n ts = int(time.time())\n u_prefix, u_b64, u_sig = val.split('|')\n\n sig = _hmac_sha1(key, '%s|%s' % (u_prefix, u_b64))\n if _hmac_sha1(key, sig) != _hmac_sha1(key, u_sig):\n return None\n\n if u_prefix != prefix:\n return None\n\n user, ikey, exp = base64.b64decode(u_b64).split('|')\n\n if ts >= int(exp):\n return None\n\n return user",
"metadata": "root._parse_vals",
"header": "['module', '___EOS___']",
"index": 43
},
{
"content": "def sign_request(ikey, skey, akey, username):\n \"\"\"Generate a signed request for Duo authentication.\n The returned value should be passed into the Duo.init() call \n in the rendered web page used for Duo authentication.\n \n Arguments:\n \n ikey -- Duo integration key\n skey -- Duo secret key\n akey -- Application secret key\n username -- Primary-authenticated username\n \"\"\"\n if not username:\n return ERR_USER\n if not ikey or len(ikey) != IKEY_LEN:\n return ERR_IKEY\n if not skey or len(skey) != SKEY_LEN:\n return ERR_SKEY\n if not akey or len(akey) < AKEY_LEN:\n return ERR_AKEY\n\n vals = [ username, ikey ]\n\n try:\n duo_sig = _sign_vals(skey, vals, DUO_PREFIX, DUO_EXPIRE)\n app_sig = _sign_vals(akey, vals, APP_PREFIX, APP_EXPIRE)\n except:\n return ERR_UNKNOWN\n\n return '%s:%s' % (duo_sig, app_sig)",
"metadata": "root.sign_request",
"header": "['module', '___EOS___']",
"index": 61
},
{
"content": "def verify_response(ikey, skey, akey, sig_response):\n \"\"\"Validate the signed response returned from Duo.\n Returns the username of the authenticated user, or None.\n \n Arguments:\n \n ikey -- Duo integration key\n skey -- Duo secret key\n akey -- Application secret key\n sig_response -- The signed response POST'ed to the server\n \"\"\"\n try:\n auth_sig, app_sig = sig_response.split(':')\n auth_user = _parse_vals(skey, auth_sig, AUTH_PREFIX)\n app_user = _parse_vals(akey, app_sig, APP_PREFIX)\n except:\n return None\n\n if auth_user != app_user:\n return None\n\n return auth_user",
"metadata": "root.verify_response",
"header": "['module', '___EOS___']",
"index": 92
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"du",
"o",
"\\u",
"web",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2011",
" ",
"Du",
"o",
" ",
"Secur",
"ity_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
",",
" ",
"all",
" ",
"wrong",
"s",
" ",
"reverse",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"base64_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"hashlib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"hmac_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"DU",
"O",
"\\u",
"PREFIX_",
"=_",
"'",
"TX",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"APP",
"\\u",
"PREFIX_",
"=_",
"'",
"APP",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"AUTH",
"\\u",
"PREFIX_",
"=_",
"'",
"AUTH",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"DU",
"O",
"\\u",
"EXPIRE",
"_",
"=_",
"300_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"APP",
"\\u",
"EXPIRE",
"_",
"=_",
"3600_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"IK",
"EY",
"\\u",
"LEN_",
"=_",
"20_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SK",
"EY",
"\\u",
"LEN_",
"=_",
"40_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"AKE",
"Y",
"\\u",
"LEN_",
"=_",
"40_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ERR",
"\\u",
"USER_",
"=_",
"'",
"ERR",
"|",
"The",
" ",
"user",
"name",
" ",
"pass",
"ed",
" ",
"to",
" ",
"sign",
"\\u",
"request",
"()",
" ",
"is",
" ",
"invalid",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ERR",
"\\u",
"IK",
"EY",
"_",
"=_",
"'",
"ERR",
"|",
"The",
" ",
"Du",
"o",
" ",
"integrati",
"on",
" ",
"key",
" ",
"pass",
"ed",
" ",
"to",
" ",
"sign",
"\\u",
"request",
"()",
" ",
"is",
" ",
"invalid",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ERR",
"\\u",
"SK",
"EY",
"_",
"=_",
"'",
"ERR",
"|",
"The",
" ",
"Du",
"o",
" ",
"secret",
" ",
"key",
" ",
"pass",
"ed",
" ",
"to",
" ",
"sign",
"\\u",
"request",
"()",
" ",
"is",
" ",
"invalid",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ERR",
"\\u",
"AKE",
"Y_",
"=_",
"'",
"ERR",
"|",
"The",
" ",
"applica",
"tion",
" ",
"secret",
" ",
"key",
" ",
"pass",
"ed",
" ",
"to",
" ",
"sign",
"\\u",
"request",
"()",
" ",
"must",
" ",
"be",
" ",
"at",
" ",
"leas",
"t",
" ",
"%",
"s",
" ",
"character",
"s",
".'_",
"%_",
"AKE",
"Y",
"\\u",
"LEN_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ERR",
"\\u",
"UNKNOWN_",
"=_",
"'",
"ERR",
"|",
"An",
" ",
"unknown",
" ",
"error",
" ",
"has",
" ",
"occur",
"red",
".'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"hmac",
"\\u",
"sha1_",
"(_",
"key_",
",_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ctx_",
"=_",
"hmac_",
"._",
"new_",
"(_",
"key_",
",_",
"msg_",
",_",
"hashlib_",
"._",
"sha1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"ctx_",
"._",
"hexdigest_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"sign",
"\\u",
"vals_",
"(_",
"key_",
",_",
"vals_",
",_",
"prefix_",
",_",
"expire_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exp_",
"=_",
"str_",
"(_",
"int_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
")_",
"+_",
"expire_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"val_",
"=_",
"'|'_",
"._",
"join_",
"(_",
"vals_",
"+_",
"[_",
"exp_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"b64",
"_",
"=_",
"base64_",
"._",
"b64encode_",
"(_",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cookie_",
"=_",
"'%",
"s",
"|",
"%",
"s",
"'_",
"%_",
"(_",
"prefix_",
",_",
"b64",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sig_",
"=_",
"\\u",
"hmac",
"\\u",
"sha1_",
"(_",
"key_",
",_",
"cookie_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"'%",
"s",
"|",
"%",
"s",
"'_",
"%_",
"(_",
"cookie_",
",_",
"sig_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"parse",
"\\u",
"vals_",
"(_",
"key_",
",_",
"val_",
",_",
"prefix_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ts_",
"=_",
"int_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"u\\u",
"prefix_",
",_",
"u\\u",
"b64",
"_",
",_",
"u\\u",
"sig_",
"=_",
"val_",
"._",
"split_",
"(_",
"'|'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"sig_",
"=_",
"\\u",
"hmac",
"\\u",
"sha1_",
"(_",
"key_",
",_",
"'%",
"s",
"|",
"%",
"s",
"'_",
"%_",
"(_",
"u\\u",
"prefix_",
",_",
"u\\u",
"b64",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"\\u",
"hmac",
"\\u",
"sha1_",
"(_",
"key_",
",_",
"sig_",
")_",
"!=_",
"\\u",
"hmac",
"\\u",
"sha1_",
"(_",
"key_",
",_",
"u\\u",
"sig_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"u\\u",
"prefix_",
"!=_",
"prefix_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"user_",
",_",
"ike",
"y_",
",_",
"exp_",
"=_",
"base64_",
"._",
"b64decode_",
"(_",
"u\\u",
"b64",
"_",
")_",
"._",
"split_",
"(_",
"'|'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"ts_",
">=_",
"int_",
"(_",
"exp_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"user_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"sign",
"\\u",
"request_",
"(_",
"ike",
"y_",
",_",
"skey",
"_",
",_",
"ake",
"y_",
",_",
"username_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Generate",
" ",
"a",
" ",
"sign",
"ed",
" ",
"request",
" ",
"for",
" ",
"Du",
"o",
" ",
"authenticat",
"ion",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"return",
"ed",
" ",
"value",
" ",
"shou",
"ld",
" ",
"be",
" ",
"pass",
"ed",
" ",
"int",
"o",
" ",
"the",
" ",
"Du",
"o",
".",
"init",
"()",
" ",
"call",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"in",
" ",
"the",
" ",
"render",
"ed",
" ",
"web",
" ",
"page",
" ",
"used",
" ",
"for",
" ",
"Du",
"o",
" ",
"authenticat",
"ion",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"ument",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ike",
"y",
" ",
" ",
"--",
" ",
"Du",
"o",
" ",
"integrati",
"on",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"skey",
" ",
" ",
"--",
" ",
"Du",
"o",
" ",
"secret",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ake",
"y",
" ",
" ",
"--",
" ",
"Applica",
"tion",
" ",
"secret",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"user",
"name",
" ",
" ",
"--",
" ",
"Prim",
"ary",
"-",
"authenticat",
"ed",
" ",
"user",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"username_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"ERR",
"\\u",
"USER_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"ike",
"y_",
"or_",
"len_",
"(_",
"ike",
"y_",
")_",
"!=_",
"IK",
"EY",
"\\u",
"LEN_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"ERR",
"\\u",
"IK",
"EY",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"skey",
"_",
"or_",
"len_",
"(_",
"skey",
"_",
")_",
"!=_",
"SK",
"EY",
"\\u",
"LEN_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"ERR",
"\\u",
"SK",
"EY",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"ake",
"y_",
"or_",
"len_",
"(_",
"ake",
"y_",
")_",
"<_",
"AKE",
"Y",
"\\u",
"LEN_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"ERR",
"\\u",
"AKE",
"Y_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"vals_",
"=_",
"[_",
"username_",
",_",
"ike",
"y_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"du",
"o",
"\\u",
"sig_",
"=_",
"\\u",
"sign",
"\\u",
"vals_",
"(_",
"skey",
"_",
",_",
"vals_",
",_",
"DU",
"O",
"\\u",
"PREFIX_",
",_",
"DU",
"O",
"\\u",
"EXPIRE",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app",
"\\u",
"sig_",
"=_",
"\\u",
"sign",
"\\u",
"vals_",
"(_",
"ake",
"y_",
",_",
"vals_",
",_",
"APP",
"\\u",
"PREFIX_",
",_",
"APP",
"\\u",
"EXPIRE",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"ERR",
"\\u",
"UNKNOWN_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"'%",
"s",
":",
"%",
"s",
"'_",
"%_",
"(_",
"du",
"o",
"\\u",
"sig_",
",_",
"app",
"\\u",
"sig_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"verify",
"\\u",
"response_",
"(_",
"ike",
"y_",
",_",
"skey",
"_",
",_",
"ake",
"y_",
",_",
"sig",
"\\u",
"response_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Validate",
" ",
"the",
" ",
"sign",
"ed",
" ",
"response",
" ",
"return",
"ed",
" ",
"from",
" ",
"Du",
"o",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"user",
"name",
" ",
"of",
" ",
"the",
" ",
"authenticat",
"ed",
" ",
"user",
",",
" ",
"or",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Arg",
"ument",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ike",
"y",
" ",
" ",
"--",
" ",
"Du",
"o",
" ",
"integrati",
"on",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"skey",
" ",
" ",
"--",
" ",
"Du",
"o",
" ",
"secret",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ake",
"y",
" ",
" ",
"--",
" ",
"Applica",
"tion",
" ",
"secret",
" ",
"key",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"sig",
"\\u",
"response",
" ",
" ",
"--",
" ",
"The",
" ",
"sign",
"ed",
" ",
"response",
" ",
"POST",
"'",
"ed",
" ",
"to",
" ",
"the",
" ",
"server",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"auth",
"\\u",
"sig_",
",_",
"app",
"\\u",
"sig_",
"=_",
"sig",
"\\u",
"response_",
"._",
"split_",
"(_",
"':'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"auth",
"\\u",
"user_",
"=_",
"\\u",
"parse",
"\\u",
"vals_",
"(_",
"skey",
"_",
",_",
"auth",
"\\u",
"sig_",
",_",
"AUTH",
"\\u",
"PREFIX_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"app",
"\\u",
"user_",
"=_",
"\\u",
"parse",
"\\u",
"vals_",
"(_",
"ake",
"y_",
",_",
"app",
"\\u",
"sig_",
",_",
"APP",
"\\u",
"PREFIX_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"auth",
"\\u",
"user_",
"!=_",
"app",
"\\u",
"user_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"auth",
"\\u",
"user_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | pantsbuild/pants/src/python/pants/backend/jvm/tasks/jvm_dependency_usage.py | [
{
"content": " @staticmethod\n def from_cacheable_dict(cached_dict, target_resolve_func):\n res = Node(target_resolve_func(cached_dict['target']))\n res.products_total = cached_dict['products_total']\n res.derivations.update([target_resolve_func(spec) for spec in cached_dict['derivations']])\n for edge in cached_dict['dep_edges']:\n res.dep_edges[target_resolve_func(edge)] = Edge(\n is_declared=cached_dict['dep_edges'][edge]['is_declared'],\n products_used=set(cached_dict['dep_edges'][edge]['products_used']))\n return res",
"metadata": "root.Node.from_cacheable_dict",
"header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']",
"index": 296
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Node_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"staticmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"from",
"\\u",
"cache",
"able",
"\\u",
"dict_",
"(_",
"cache",
"d\\u",
"dict_",
",_",
"target",
"\\u",
"resolve",
"\\u",
"func_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"res_",
"=_",
"Node_",
"(_",
"target",
"\\u",
"resolve",
"\\u",
"func_",
"(_",
"cache",
"d\\u",
"dict_",
"[_",
"'",
"target",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"res_",
"._",
"products",
"\\u",
"total_",
"=_",
"cache",
"d\\u",
"dict_",
"[_",
"'",
"products",
"\\u",
"total",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"res_",
"._",
"derivation",
"s_",
"._",
"update_",
"(_",
"[_",
"target",
"\\u",
"resolve",
"\\u",
"func_",
"(_",
"spec_",
")_",
"for_",
"spec_",
"in_",
"cache",
"d\\u",
"dict_",
"[_",
"'",
"derivation",
"s",
"'_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"edge_",
"in_",
"cache",
"d\\u",
"dict_",
"[_",
"'",
"dep",
"\\u",
"edge",
"s",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"res_",
"._",
"dep",
"\\u",
"edges_",
"[_",
"target",
"\\u",
"resolve",
"\\u",
"func_",
"(_",
"edge_",
")_",
"]_",
"=_",
"Edge_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"is",
"\\u",
"declared",
"_",
"=_",
"cache",
"d\\u",
"dict_",
"[_",
"'",
"dep",
"\\u",
"edge",
"s",
"'_",
"]_",
"[_",
"edge_",
"]_",
"[_",
"'",
"is",
"\\u",
"declared",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"products",
"\\u",
"used_",
"=_",
"set_",
"(_",
"cache",
"d\\u",
"dict_",
"[_",
"'",
"dep",
"\\u",
"edge",
"s",
"'_",
"]_",
"[_",
"edge_",
"]_",
"[_",
"'",
"products",
"\\u",
"used",
"'_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"res_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Testing equality to None | django/django/django/contrib/staticfiles/storage.py | [
{
"content": " def stored_name(self, name):\n hash_key = self.hash_key(name)\n cache_name = self.hashed_files.get(hash_key)\n if cache_name is None:\n cache_name = self.clean_name(self.hashed_name(name))\n # store the hashed name if there was a miss, e.g.\n # when the files are still processed\n self.hashed_files[hash_key] = cache_name\n return cache_name",
"metadata": "root.HashedFilesMixin.stored_name",
"header": "['class', 'HashedFilesMixin', '(', 'object', ')', ':', '___EOS___']",
"index": 287
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Hashe",
"d",
"Files",
"Mixin_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"store",
"d\\u",
"name_",
"(_",
"self_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"hash",
"\\u",
"key_",
"=_",
"self_",
"._",
"hash",
"\\u",
"key_",
"(_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cache",
"\\u",
"name_",
"=_",
"self_",
"._",
"hashed",
"\\u",
"files_",
"._",
"get_",
"(_",
"hash",
"\\u",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"cache",
"\\u",
"name_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cache",
"\\u",
"name_",
"=_",
"self_",
"._",
"clean",
"\\u",
"name_",
"(_",
"self_",
"._",
"hashed",
"\\u",
"name_",
"(_",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"store",
" ",
"the",
" ",
"hashed",
" ",
"name",
" ",
"if",
" ",
"there",
" ",
"was",
" ",
"a",
" ",
"miss",
",",
" ",
"e",
".",
"g",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"whe",
"n",
" ",
"the",
" ",
"files",
" ",
"are",
" ",
"still",
" ",
"processed_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"hashed",
"\\u",
"files_",
"[_",
"hash",
"\\u",
"key_",
"]_",
"=_",
"cache",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"cache",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | openstack/rally/rally/plugins/openstack/scenarios/keystone/basic.py | [
{
"content": " @validation.required_openstack(admin=True)\n @scenario.configure(context={\"admin_cleanup\": [\"keystone\"]})\n def get_entities(self, service_name=\"keystone\"):\n \"\"\"Get instance of a tenant, user, role and service by id's.\n\n An ephemeral tenant, user, and role are each created. By\n default, fetches the 'keystone' service. This can be\n overridden (for instance, to get the 'Identity Service'\n service on older OpenStack), or None can be passed explicitly\n to service_name to create a new service and then query it by\n ID.\n\n :param service_name: The name of the service to get by ID; or\n None, to create an ephemeral service and\n get it by ID.\n \"\"\"\n tenant = self._tenant_create()\n user = self._user_create()\n role = self._role_create()\n self._get_tenant(tenant.id)\n self._get_user(user.id)\n self._get_role(role.id)\n if service_name is None:\n service = self._service_create()\n else:\n service = self._get_service_by_name(service_name)\n self._get_service(service.id)",
"metadata": "root.KeystoneBasic.get_entities",
"header": "['class', 'KeystoneBasic', '(', 'kutils', '.', 'KeystoneScenario', ')', ':', '___EOS___']",
"index": 148
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Keys",
"tone",
"Basic_",
"(_",
"ku",
"tils_",
"._",
"Keys",
"tone",
"Scenario_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"validation_",
"._",
"require",
"d\\u",
"openstack_",
"(_",
"admin_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"scenario_",
"._",
"configure_",
"(_",
"context_",
"=_",
"{_",
"\"",
"admin",
"\\u",
"clean",
"up",
"\"_",
":_",
"[_",
"\"",
"keystone",
"\"_",
"]_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"get",
"\\u",
"entities_",
"(_",
"self_",
",_",
"service",
"\\u",
"name_",
"=_",
"\"",
"keystone",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Get",
" ",
"instance",
" ",
"of",
" ",
"a",
" ",
"tenan",
"t",
",",
" ",
"user",
",",
" ",
"role",
" ",
"and",
" ",
"service",
" ",
"by",
" ",
"id",
"'",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"ephemeral",
" ",
"tenan",
"t",
",",
" ",
"user",
",",
" ",
"and",
" ",
"role",
" ",
"are",
" ",
"each",
" ",
"created",
".",
" ",
"By",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"default",
",",
" ",
"fetches",
" ",
"the",
" ",
"'",
"keystone",
"'",
" ",
"service",
".",
" ",
"Thi",
"s",
" ",
"can",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"overrid",
"den",
" ",
"(",
"for",
" ",
"instance",
",",
" ",
"to",
" ",
"get",
" ",
"the",
" ",
"'",
"Ident",
"it",
"y",
" ",
"Service",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"service",
" ",
"on",
" ",
"older",
" ",
"Open",
"Stack",
"),",
" ",
"or",
" ",
"Non",
"e",
" ",
"can",
" ",
"be",
" ",
"pass",
"ed",
" ",
"explicit",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"service",
"\\u",
"name",
" ",
"to",
" ",
"create",
" ",
"a",
" ",
"new",
" ",
"service",
" ",
"and",
" ",
"then",
" ",
"query",
" ",
"it",
" ",
"by",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ID",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"service",
"\\u",
"name",
":",
" ",
"The",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"service",
" ",
"to",
" ",
"get",
" ",
"by",
" ",
"ID",
";",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
"Non",
"e",
",",
" ",
"to",
" ",
"create",
" ",
"an",
" ",
"ephemeral",
" ",
"service",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
"get",
" ",
"it",
" ",
"by",
" ",
"ID",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tenant_",
"=_",
"self_",
"._",
"\\u",
"tenan",
"t",
"\\u",
"create_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user_",
"=_",
"self_",
"._",
"\\u",
"user",
"\\u",
"create_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"role_",
"=_",
"self_",
"._",
"\\u",
"role",
"\\u",
"create_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"get",
"\\u",
"tenant_",
"(_",
"tenant_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"get",
"\\u",
"user_",
"(_",
"user_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"get",
"\\u",
"role_",
"(_",
"role_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"service",
"\\u",
"name_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"service_",
"=_",
"self_",
"._",
"\\u",
"service",
"\\u",
"create_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"service_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"service",
"\\u",
"by",
"\\u",
"name_",
"(_",
"service",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"get",
"\\u",
"service_",
"(_",
"service_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | idlesign/django-sitemessage/sitemessage/migrations/0002_subscription.py | [
{
"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.conf import settings\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Migration(migrations.Migration):\n\n dependencies = [\n migrations.swappable_dependency(settings.AUTH_USER_MODEL),\n ('sitemessage', '0001_initial'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='Subscription',\n fields=[\n ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n ('time_created', models.DateTimeField(auto_now_add=True, verbose_name='Time created')),\n ('message_cls', models.CharField(help_text='Message logic class identifier.', max_length=250, verbose_name='Message class', db_index=True)),\n ('messenger_cls', models.CharField(help_text='Messenger class identifier.', max_length=250, verbose_name='Messenger', db_index=True)),\n ('address', models.CharField(help_text='Recipient address.', max_length=250, null=True, verbose_name='Address')),\n ('recipient', models.ForeignKey(verbose_name='Recipient', blank=True, to=settings.AUTH_USER_MODEL, null=True)),\n ],\n options={\n 'verbose_name': 'Subscription',\n 'verbose_name_plural': 'Subscriptions',\n },\n bases=(models.Model,),\n ),\n ]",
"metadata": "root.Migration",
"header": "['module', '___EOS___']",
"index": 7
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
",_",
"migrations_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Migration_",
"(_",
"migrations_",
"._",
"Migration_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dependencies_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"migrations_",
"._",
"swapp",
"able",
"\\u",
"dependency_",
"(_",
"settings_",
"._",
"AUTH",
"\\u",
"USER",
"\\u",
"MODEL_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"site",
"message",
"'_",
",_",
"'",
"0001",
"\\u",
"initial",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"operations_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"migrations_",
"._",
"Creat",
"e",
"Model_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"Subscription",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"id",
"'_",
",_",
"models_",
"._",
"Auto",
"Field_",
"(_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"ID",
"'_",
",_",
"serialize_",
"=_",
"False_",
",_",
"auto",
"\\u",
"created_",
"=_",
"True_",
",_",
"primary",
"\\u",
"key_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"time",
"\\u",
"created",
"'_",
",_",
"models_",
"._",
"Date",
"Time",
"Field_",
"(_",
"auto",
"\\u",
"now",
"\\u",
"add_",
"=_",
"True_",
",_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"Time",
" ",
"created",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"message",
"\\u",
"cls",
"'_",
",_",
"models_",
"._",
"Char",
"Field_",
"(_",
"help",
"\\u",
"text_",
"=_",
"'",
"Messag",
"e",
" ",
"logic",
" ",
"class",
" ",
"identifi",
"er",
".'_",
",_",
"max",
"\\u",
"length_",
"=_",
"250_",
",_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"Messag",
"e",
" ",
"class",
"'_",
",_",
"db",
"\\u",
"index_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"messenger",
"\\u",
"cls",
"'_",
",_",
"models_",
"._",
"Char",
"Field_",
"(_",
"help",
"\\u",
"text_",
"=_",
"'",
"Mess",
"enger",
" ",
"class",
" ",
"identifi",
"er",
".'_",
",_",
"max",
"\\u",
"length_",
"=_",
"250_",
",_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"Mess",
"enger",
"'_",
",_",
"db",
"\\u",
"index_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"address",
"'_",
",_",
"models_",
"._",
"Char",
"Field_",
"(_",
"help",
"\\u",
"text_",
"=_",
"'",
"Recipient",
" ",
"address",
".'_",
",_",
"max",
"\\u",
"length_",
"=_",
"250_",
",_",
"null_",
"=_",
"True_",
",_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"Address",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"recip",
"ient",
"'_",
",_",
"models_",
"._",
"Fore",
"ign",
"Key_",
"(_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"Recipient",
"'_",
",_",
"blank_",
"=_",
"True_",
",_",
"to_",
"=_",
"settings_",
"._",
"AUTH",
"\\u",
"USER",
"\\u",
"MODEL_",
",_",
"null_",
"=_",
"True_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"verbo",
"se",
"\\u",
"name",
"'_",
":_",
"'",
"Subscription",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"verbo",
"se",
"\\u",
"name",
"\\u",
"plural",
"'_",
":_",
"'",
"Subscription",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"bases_",
"=_",
"(_",
"models_",
"._",
"Model_",
",_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | rossp/django-helpdesk/helpdesk/migrations/0007_max_length_by_integer.py | [
{
"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('helpdesk', '0006_email_maxlength'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='customfield',\n name='label',\n field=models.CharField(help_text='The display label for this field', max_length=30, verbose_name='Label'),\n ),\n ]",
"metadata": "root.Migration",
"header": "['module', '___EOS___']",
"index": 6
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
",_",
"migrations_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Migration_",
"(_",
"migrations_",
"._",
"Migration_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dependencies_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"help",
"desk",
"'_",
",_",
"'",
"0006",
"\\u",
"email",
"\\u",
"maxlength",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"operations_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"migrations_",
"._",
"Alter",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"model",
"\\u",
"name_",
"=_",
"'",
"custom",
"field",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"label",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"=_",
"models_",
"._",
"Char",
"Field_",
"(_",
"help",
"\\u",
"text_",
"=_",
"'",
"The",
" ",
"display",
" ",
"label",
" ",
"for",
" ",
"this",
" ",
"field",
"'_",
",_",
"max",
"\\u",
"length_",
"=_",
"30_",
",_",
"verbo",
"se",
"\\u",
"name_",
"=_",
"'",
"Label",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unreachable code | goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/sql/sqltypes.py | [
{
"content": " def result_processor(self, dialect, coltype):\n impl_processor = self.impl.result_processor(dialect, coltype)\n loads = self.pickler.loads\n if impl_processor:\n def process(value):\n value = impl_processor(value)\n if value is None:\n return None\n return loads(value)\n else:\n def process(value):\n if value is None:\n return None\n return loads(value)\n return process",
"metadata": "root.PickleType.result_processor",
"header": "['class', 'PickleType', '(', 'TypeDecorator', ')', ':', '___EOS___']",
"index": 1241
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Pickl",
"e",
"Type_",
"(_",
"Type",
"Decorator_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"result",
"\\u",
"processor_",
"(_",
"self_",
",_",
"dialect_",
",_",
"col",
"type_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"impl",
"\\u",
"processor_",
"=_",
"self_",
"._",
"impl_",
"._",
"result",
"\\u",
"processor_",
"(_",
"dialect_",
",_",
"col",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"loads_",
"=_",
"self_",
"._",
"pickle",
"r_",
"._",
"loads_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"impl",
"\\u",
"processor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"process_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"impl",
"\\u",
"processor_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"value_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"loads_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"process_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"value_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"loads_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"process_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | django-money/django-money/djmoney/models/managers.py | [
{
"content": "def _get_field(model, name):\n from django.db.models.fields import FieldDoesNotExist\n\n # Create a fake query object so we can easily work out what field\n # type we are dealing with\n qs = Query(model)\n opts = qs.get_meta()\n alias = qs.get_initial_alias()\n\n parts = name.split(LOOKUP_SEP)\n\n # The following is borrowed from the innards of Query.add_filter - it strips out __gt, __exact et al.\n num_parts = len(parts)\n if num_parts > 1 and parts[-1] in qs.query_terms:\n # Traverse the lookup query to distinguish related fields from\n # lookup types.\n for counter, field_name in enumerate(parts, 1):\n try:\n lookup_field = model._meta.get_field(field_name)\n except FieldDoesNotExist:\n # Not a field. Bail out.\n parts.pop()\n break\n # Unless we're at the end of the list of lookups, let's attempt\n # to continue traversing relations.\n if counter < num_parts:\n try:\n model = lookup_field.rel.to\n except AttributeError:\n # Not a related field. Bail out.\n parts.pop()\n break\n\n if VERSION < (1, 6):\n field = qs.setup_joins(parts, opts, alias, False)[0]\n else:\n field = qs.setup_joins(parts, opts, alias)[0]\n\n return field",
"metadata": "root._get_field",
"header": "['module', '___EOS___']",
"index": 26
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"get",
"\\u",
"field_",
"(_",
"model_",
",_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"django_",
"._",
"db_",
"._",
"models_",
"._",
"fields_",
"import_",
"Field",
"Do",
"es",
"Not",
"Exist_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"a",
" ",
"fake",
" ",
"query",
" ",
"object",
" ",
"so",
" ",
"we",
" ",
"can",
" ",
"easi",
"ly",
" ",
"work",
" ",
"out",
" ",
"what",
" ",
"field_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"type",
" ",
"we",
" ",
"are",
" ",
"deal",
"ing",
" ",
"with_",
"\\u\\u\\uNL\\u\\u\\u_",
"qs_",
"=_",
"Query_",
"(_",
"model_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"opts_",
"=_",
"qs_",
"._",
"get",
"\\u",
"meta_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"alias_",
"=_",
"qs_",
"._",
"get",
"\\u",
"initial",
"\\u",
"alias_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parts_",
"=_",
"name_",
"._",
"split_",
"(_",
"LOOKUP",
"\\u",
"SEP",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
" ",
"follow",
"ing",
" ",
"is",
" ",
"borrow",
"ed",
" ",
"from",
" ",
"the",
" ",
"inn",
"ards",
" ",
"of",
" ",
"Query",
".",
"add",
"\\u",
"filter",
" ",
"-",
" ",
"it",
" ",
"strip",
"s",
" ",
"out",
" ",
"\\u\\u",
"gt",
",",
" ",
"\\u\\u",
"exact",
" ",
"et",
" ",
"al",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"num",
"\\u",
"parts_",
"=_",
"len_",
"(_",
"parts_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"num",
"\\u",
"parts_",
">_",
"1_",
"and_",
"parts_",
"[_",
"-_",
"1_",
"]_",
"in_",
"qs_",
"._",
"query",
"\\u",
"terms_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Travers",
"e",
" ",
"the",
" ",
"look",
"up",
" ",
"query",
" ",
"to",
" ",
"distinguish",
" ",
"relate",
"d",
" ",
"fields",
" ",
"from_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"look",
"up",
" ",
"types",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"counter_",
",_",
"field",
"\\u",
"name_",
"in_",
"enumerate_",
"(_",
"parts_",
",_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"look",
"up",
"\\u",
"field_",
"=_",
"model_",
"._",
"\\u",
"meta_",
"._",
"get",
"\\u",
"field_",
"(_",
"field",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Field",
"Do",
"es",
"Not",
"Exist_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Not",
" ",
"a",
" ",
"field",
".",
" ",
"Bai",
"l",
" ",
"out",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parts_",
"._",
"pop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"we",
"'",
"re",
" ",
"at",
" ",
"the",
" ",
"end",
" ",
"of",
" ",
"the",
" ",
"list",
" ",
"of",
" ",
"lookups",
",",
" ",
"let",
"'",
"s",
" ",
"attempt_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"to",
" ",
"continue",
" ",
"trav",
"ersi",
"ng",
" ",
"relation",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"counter_",
"<_",
"num",
"\\u",
"parts_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"model_",
"=_",
"look",
"up",
"\\u",
"field_",
"._",
"rel_",
"._",
"to_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Not",
" ",
"a",
" ",
"relate",
"d",
" ",
"field",
".",
" ",
"Bai",
"l",
" ",
"out",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"parts_",
"._",
"pop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"VERSION_",
"<_",
"(_",
"1_",
",_",
"6_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"qs_",
"._",
"setup",
"\\u",
"joins",
"_",
"(_",
"parts_",
",_",
"opts_",
",_",
"alias_",
",_",
"False_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"qs_",
"._",
"setup",
"\\u",
"joins",
"_",
"(_",
"parts_",
",_",
"opts_",
",_",
"al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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | SublimeGit/SublimeGit/sgit/tag.py | [
{
"content": " def run(self, sign=False):\n repo = self.get_repo()\n if not repo:\n return\n\n tags = self.get_tags(repo, annotate=False)\n\n def on_done(name):\n name = name.strip()\n if not name:\n return\n\n if name in tags:\n if sublime.ok_cancel_dialog(TAG_FORCE % name, 'Overwrite'):\n self.on_name(repo, sign, name, force=True)\n else:\n self.on_name(repo, sign, name)\n\n self.window.show_input_panel('Tag:', '', on_done, noop, noop)",
"metadata": "root.GitAddTagCommand.run",
"header": "['class', 'GitAddTagCommand', '(', 'WindowCommand', ',', 'GitTagHelper', ',', 'GitErrorHelper', ',', 'GitCmd', ')', ':', '___EOS___']",
"index": 19
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Git",
"Add",
"Ta",
"g",
"Command_",
"(_",
"Window",
"Command_",
",_",
"Git",
"Ta",
"g",
"Helper_",
",_",
"Git",
"Error",
"Helper_",
",_",
"Git",
"Cmd_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"run_",
"(_",
"self_",
",_",
"sign_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"repo_",
"=_",
"self_",
"._",
"get",
"\\u",
"repo_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"repo_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tags_",
"=_",
"self_",
"._",
"get",
"\\u",
"tags_",
"(_",
"repo_",
",_",
"annotate_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"on",
"\\u",
"done_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"name_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"name_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"name_",
"in_",
"tags_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"sublime_",
"._",
"ok",
"\\u",
"cancel",
"\\u",
"dialog_",
"(_",
"TAG",
"\\u",
"FORCE",
"_",
"%_",
"name_",
",_",
"'",
"Over",
"write",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"on",
"\\u",
"name_",
"(_",
"repo_",
",_",
"sign_",
",_",
"name_",
",_",
"force_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"on",
"\\u",
"name_",
"(_",
"repo_",
",_",
"sign_",
",_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"window_",
"._",
"show",
"\\u",
"input",
"\\u",
"panel_",
"(_",
"'",
"Ta",
"g",
":'_",
",_",
"''_",
",_",
"on",
"\\u",
"done_",
",_",
"noop_",
",_",
"noop_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | spookylukey/django-paypal/paypal/standard/pdt/urls.py | [
{
"content": "from __future__ import unicode_literals\n\nfrom django.conf.urls import url\n\nfrom paypal.standard.pdt import views\n\nurlpatterns = [\n url(r'^$', views.pdt, name=\"paypal-pdt\"),\n]\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"import_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"paypal",
"_",
"._",
"standard_",
"._",
"pd",
"t_",
"import_",
"views_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"urlpatterns_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"r",
"'",
"^",
"$'_",
",_",
"views_",
"._",
"pd",
"t_",
",_",
"name_",
"=_",
"\"",
"paypal",
"-",
"pd",
"t",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | project-fondue/python-yql/yql/tests/test_query_placeholders.py | [
{
"content": "\"\"\"Set of tests for the placeholder checking\"\"\"\n\nfrom unittest import TestCase\n\nfrom nose.tools import raises\n\nfrom yql import YQLQuery\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class YQLQueryTest(TestCase):\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.YQLQueryTest",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " @raises(ValueError)\n def test_empty_args_raises_valueerror(self):\n query = YQLQuery(\"SELECT * from foo where dog=@dog\")\n params = {}\n query.validate(params)",
"metadata": "root.YQLQueryTest.test_empty_args_raises_valueerror",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 10
},
{
"content": " @raises(ValueError)\n def test_incorrect_args_raises_valueerror(self):\n query = YQLQuery(\"SELECT * from foo where dog=@dog\")\n params = {'test': 'fail'}\n query.validate(params)",
"metadata": "root.YQLQueryTest.test_incorrect_args_raises_valueerror",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 16
},
{
"content": " @raises(ValueError)\n def test_params_raises_when_not_dict(self):\n query = YQLQuery(\"SELECT * from foo where dog=@dog\")\n params = ['test']\n query.validate(params)",
"metadata": "root.YQLQueryTest.test_params_raises_when_not_dict",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 22
},
{
"content": " @raises(ValueError)\n def test_unecessary_args_raises_valueerror(self):\n query = YQLQuery(\"SELECT * from foo where dog='test'\")\n params = {'test': 'fail'}\n query.validate(params)",
"metadata": "root.YQLQueryTest.test_unecessary_args_raises_valueerror",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " @raises(ValueError)\n def test_incorrect_type_raises_valueerror(self):\n query = YQLQuery(\"SELECT * from foo where dog=@test\")\n params = ('fail')\n query.validate(params)",
"metadata": "root.YQLQueryTest.test_incorrect_type_raises_valueerror",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " @raises(ValueError)\n def test_requires_substitutions(self):\n query = YQLQuery(\"SELECT * from foo where dog=@dog\")\n query.validate()",
"metadata": "root.YQLQueryTest.test_requires_substitutions",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 40
},
{
"content": " def test_placeholder_regex_one(self):\n query = YQLQuery(\"SELECT * from foo where email='[email protected]'\")\n placeholders = query.get_placeholder_keys()\n self.assertEqual(placeholders, [])",
"metadata": "root.YQLQueryTest.test_placeholder_regex_one",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 45
},
{
"content": " def test_placeholder_regex_two(self):\n query = YQLQuery(\"SELECT * from foo where email=@foo'\")\n placeholders = query.get_placeholder_keys()\n self.assertEqual(placeholders, ['foo'])",
"metadata": "root.YQLQueryTest.test_placeholder_regex_two",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 50
},
{
"content": " def test_placeholder_regex_three(self):\n query = YQLQuery(\"SELECT * from foo where email=@foo and test=@bar'\")\n placeholders = query.get_placeholder_keys()\n self.assertEqual(placeholders, ['foo', 'bar'])",
"metadata": "root.YQLQueryTest.test_placeholder_regex_three",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 55
},
{
"content": " def test_placeholder_regex_four(self):\n query = YQLQuery(\"SELECT * from foo where foo='bar' LIMIT @foo\")\n placeholders = query.get_placeholder_keys()\n self.assertEqual(placeholders, ['foo'])",
"metadata": "root.YQLQueryTest.test_placeholder_regex_four",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 60
},
{
"content": " def test_placeholder_regex_five(self):\n query = YQLQuery(\"\"\"SELECT * from foo\n where foo='bar' LIMIT\n @foo\"\"\")\n placeholders = query.get_placeholder_keys()\n self.assertEqual(placeholders, ['foo'])",
"metadata": "root.YQLQueryTest.test_placeholder_regex_five",
"header": "['class', 'YQLQueryTest', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 65
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"Set",
" ",
"of",
" ",
"tests",
" ",
"for",
" ",
"the",
" ",
"placehold",
"er",
" ",
"checking",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"unittest_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"nose_",
"._",
"tools_",
"import_",
"raises_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"yq",
"l_",
"import_",
"YQ",
"LQ",
"uery_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"raises_",
"(_",
"Value",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"empty",
"\\u",
"args",
"\\u",
"raise",
"s",
"\\u",
"value",
"error_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"dog",
"=",
"@",
"dog",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"._",
"validate_",
"(_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raises_",
"(_",
"Value",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"incorrect",
"\\u",
"args",
"\\u",
"raise",
"s",
"\\u",
"value",
"error_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"dog",
"=",
"@",
"dog",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"test",
"'_",
":_",
"'",
"fail",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"._",
"validate_",
"(_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raises_",
"(_",
"Value",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"params",
"\\u",
"raise",
"s",
"\\u",
"whe",
"n",
"\\u",
"not",
"\\u",
"dict_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"dog",
"=",
"@",
"dog",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"[_",
"'",
"test",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"._",
"validate_",
"(_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raises_",
"(_",
"Value",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"une",
"cess",
"ary",
"\\u",
"args",
"\\u",
"raise",
"s",
"\\u",
"value",
"error_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"dog",
"='",
"test",
"'\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"{_",
"'",
"test",
"'_",
":_",
"'",
"fail",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"._",
"validate_",
"(_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raises_",
"(_",
"Value",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"incorrect",
"\\u",
"type",
"\\u",
"raise",
"s",
"\\u",
"value",
"error_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"dog",
"=",
"@",
"test",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"(_",
"'",
"fail",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"._",
"validate_",
"(_",
"params_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raises_",
"(_",
"Value",
"Error_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"require",
"s",
"\\u",
"substitutions_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"dog",
"=",
"@",
"dog",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"._",
"validate_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"placehold",
"er",
"\\u",
"regex",
"\\u",
"one_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"email",
"='",
"foo",
"@",
"foo",
".",
"com",
"'\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"placeholders_",
"=_",
"query_",
"._",
"get",
"\\u",
"placehold",
"er",
"\\u",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"placeholders_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"placehold",
"er",
"\\u",
"regex",
"\\u",
"two_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"email",
"=",
"@",
"foo",
"'\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"placeholders_",
"=_",
"query_",
"._",
"get",
"\\u",
"placehold",
"er",
"\\u",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"placeholders_",
",_",
"[_",
"'",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"placehold",
"er",
"\\u",
"regex",
"\\u",
"three_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"email",
"=",
"@",
"foo",
" ",
"and",
" ",
"test",
"=",
"@",
"bar",
"'\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"placeholders_",
"=_",
"query_",
"._",
"get",
"\\u",
"placehold",
"er",
"\\u",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"placeholders_",
",_",
"[_",
"'",
"foo",
"'_",
",_",
"'",
"bar",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"placehold",
"er",
"\\u",
"regex",
"\\u",
"four",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
" ",
"where",
" ",
"foo",
"='",
"bar",
"'",
" ",
"LIMIT",
" ",
"@",
"foo",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"placeholders_",
"=_",
"query_",
"._",
"get",
"\\u",
"placehold",
"er",
"\\u",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"placeholders_",
",_",
"[_",
"'",
"foo",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"YQ",
"LQ",
"uer",
"y",
"Test_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"placehold",
"er",
"\\u",
"regex",
"\\u",
"five",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"YQ",
"LQ",
"uery_",
"(_",
"\"\"\"",
"SELECT",
" ",
"*",
" ",
"from",
" ",
"foo",
"\\",
"10",
";",
" ",
" ",
"where",
" ",
"foo",
"='",
"bar",
"'",
" ",
"LIMIT",
"\\",
"10",
";",
" ",
" ",
"@",
"foo",
"\"\"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"placeholders_",
"=_",
"query_",
"._",
"get",
"\\u",
"placehold",
"er",
"\\u",
"keys_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"placeholders_",
",_",
"[_",
"'",
"foo",
"'_",
"]_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | caktus/django-sticky-uploads/stickyuploads/urls.py | [
{
"content": "from django.conf.urls import url\n\nfrom .views import UploadView\n\nurlpatterns = [\n url(r'^default/$', UploadView.as_view(), name='sticky-upload-default'),\n]\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"import_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"views_",
"import_",
"Upload",
"View_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"urlpatterns_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"r",
"'",
"^",
"default",
"/$'_",
",_",
"Upload",
"View_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"name_",
"=_",
"'",
"sticky",
"-",
"upload",
"-",
"default",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Use of the return value of a procedure | openaddresses/machine/openaddr/tests/sample.py | [
{
"content": " def test_sample(self):\n geojson_input = b'''{ \"type\": \"FeatureCollection\", \"features\": [\n { \"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [102.0, 0.5]}, \"properties\": {\"prop0\": \"value0\"} },\n { \"type\": \"Feature\", \"geometry\": { \"type\": \"LineString\", \"coordinates\": [ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }, \"properties\": { \"prop0\": \"value0\", \"prop1\": 0.0 } },\n { \"type\": \"Feature\", \"geometry\": { \"type\": \"Polygon\", \"coordinates\": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }, \"properties\": { \"prop0\": \"value0\", \"prop1\": {\"this\": \"that\"}, \"prop2\": true, \"prop3\": null } }\n ] }'''\n \n geojson0 = json.loads(sample_geojson(BytesIO(geojson_input), max_features=0))\n self.assertEqual(len(geojson0['features']), 0)\n \n geojson1 = json.loads(sample_geojson(BytesIO(geojson_input), max_features=1))\n self.assertEqual(len(geojson1['features']), 1)\n \n geojson2 = json.loads(sample_geojson(BytesIO(geojson_input), max_features=2))\n self.assertEqual(len(geojson2['features']), 2)\n \n geojson3 = json.loads(sample_geojson(BytesIO(geojson_input), max_features=3))\n self.assertEqual(len(geojson3['features']), 3)\n \n geojson4 = json.loads(sample_geojson(BytesIO(geojson_input), max_features=4))\n self.assertEqual(len(geojson4['features']), 3)\n\n self.assertEqual(geojson0['type'], 'FeatureCollection')\n\n self.assertEqual(geojson1['features'][0]['type'], 'Feature')\n self.assertEqual(geojson1['features'][0]['properties']['prop0'], 'value0')\n self.assertEqual(geojson1['features'][0]['geometry']['type'], 'Point')\n self.assertEqual(len(geojson1['features'][0]['geometry']['coordinates']), 2)\n self.assertEqual(geojson1['features'][0]['geometry']['coordinates'][0], 102.)\n self.assertEqual(geojson1['features'][0]['geometry']['coordinates'][1], .5)\n \n self.assertEqual(geojson2['features'][1]['geometry']['type'], 'LineString')\n self.assertEqual(len(geojson2['features'][1]['geometry']['coordinates']), 4)\n self.assertEqual(geojson2['features'][1]['geometry']['coordinates'][0][0], 102.)\n self.assertEqual(geojson2['features'][1]['geometry']['coordinates'][0][1], 0.)\n \n self.assertEqual(geojson3['features'][2]['geometry']['type'], 'Polygon')\n self.assertEqual(len(geojson3['features'][2]['geometry']['coordinates']), 1)\n self.assertEqual(geojson3['features'][2]['geometry']['coordinates'][0][0][0], 100.)\n self.assertEqual(geojson3['features'][2]['geometry']['coordinates'][0][0][1], 0.)",
"metadata": "root.TestSample.test_sample",
"header": "['class', 'TestSample', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 11
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Use_",
"of_",
"the_",
"return_",
"value_",
"of_",
"a_",
"procedure_",
"[SEP]_",
"class_",
"Test",
"Sample_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"sample_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"geo",
"json",
"\\u",
"input_",
"=_",
"b",
"'''",
"{",
" ",
"\"",
"type",
"\":",
" ",
"\"",
"Feature",
"Collecti",
"on",
"\",",
" ",
"\"",
"features",
"\":",
" ",
"[",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"{",
" ",
"\"",
"type",
"\":",
" ",
"\"",
"Feature",
"\",",
" ",
"\"",
"geom",
"etry",
"\":",
" ",
"{",
"\"",
"type",
"\":",
" ",
"\"",
"Point",
"\",",
" ",
"\"",
"coordinate",
"s",
"\":",
" ",
"[",
"102",
".0",
",",
" ",
"0.",
"5",
"]},",
" ",
"\"",
"proper",
"ties",
"\":",
" ",
"{",
"\"",
"prop",
"0",
"\":",
" ",
"\"",
"value",
"0",
"\"}",
" ",
"},",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"{",
" ",
"\"",
"type",
"\":",
" ",
"\"",
"Feature",
"\",",
" ",
"\"",
"geom",
"etry",
"\":",
" ",
"{",
" ",
"\"",
"type",
"\":",
" ",
"\"",
"Line",
"String",
"\",",
" ",
"\"",
"coordinate",
"s",
"\":",
" ",
"[",
" ",
"[",
"102",
".0",
",",
" ",
"0.",
"0",
"],",
" ",
"[",
"103",
".0",
",",
" ",
"1.0",
"],",
" ",
"[",
"104",
".0",
",",
" ",
"0.",
"0",
"],",
" ",
"[",
"105",
".0",
",",
" ",
"1.0",
"]",
" ",
"]",
" ",
"},",
" ",
"\"",
"proper",
"ties",
"\":",
" ",
"{",
" ",
"\"",
"prop",
"0",
"\":",
" ",
"\"",
"value",
"0",
"\",",
" ",
"\"",
"prop",
"1",
"\":",
" ",
"0.",
"0",
" ",
"}",
" ",
"},",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"{",
" ",
"\"",
"type",
"\":",
" ",
"\"",
"Feature",
"\",",
" ",
"\"",
"geom",
"etry",
"\":",
" ",
"{",
" ",
"\"",
"type",
"\":",
" ",
"\"",
"Polygon",
"\",",
" ",
"\"",
"coordinate",
"s",
"\":",
" ",
"[",
" ",
"[",
" ",
"[",
"100",
".0",
",",
" ",
"0.",
"0",
"],",
" ",
"[",
"101.",
"0",
",",
" ",
"0.",
"0",
"],",
" ",
"[",
"101.",
"0",
",",
" ",
"1.0",
"],",
" ",
"[",
"100",
".0",
",",
" ",
"1.0",
"],",
" ",
"[",
"100",
".0",
",",
" ",
"0.",
"0",
"]",
" ",
"]",
" ",
"]",
" ",
"},",
" ",
"\"",
"proper",
"ties",
"\":",
" ",
"{",
" ",
"\"",
"prop",
"0",
"\":",
" ",
"\"",
"value",
"0",
"\",",
" ",
"\"",
"prop",
"1",
"\":",
" ",
"{",
"\"",
"this",
"\":",
" ",
"\"",
"tha",
"t",
"\"},",
" ",
"\"",
"prop",
"2",
"\":",
" ",
"true",
",",
" ",
"\"",
"prop",
"3",
"\":",
" ",
"null",
" ",
"}",
" ",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"]",
" ",
"}''",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"geo",
"json",
"0_",
"=_",
"json_",
"._",
"loads_",
"(_",
"sample",
"\\u",
"geojson_",
"(_",
"Byte",
"s",
"IO_",
"(_",
"geo",
"json",
"\\u",
"input_",
")_",
",_",
"max",
"\\u",
"features_",
"=_",
"0_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"0_",
"[_",
"'",
"features",
"'_",
"]_",
")_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"geo",
"json",
"1_",
"=_",
"json_",
"._",
"loads_",
"(_",
"sample",
"\\u",
"geojson_",
"(_",
"Byte",
"s",
"IO_",
"(_",
"geo",
"json",
"\\u",
"input_",
")_",
",_",
"max",
"\\u",
"features_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"geo",
"json",
"2_",
"=_",
"json_",
"._",
"loads_",
"(_",
"sample",
"\\u",
"geojson_",
"(_",
"Byte",
"s",
"IO_",
"(_",
"geo",
"json",
"\\u",
"input_",
")_",
",_",
"max",
"\\u",
"features_",
"=_",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"2_",
"[_",
"'",
"features",
"'_",
"]_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"geo",
"json",
"3_",
"=_",
"json_",
"._",
"loads_",
"(_",
"sample",
"\\u",
"geojson_",
"(_",
"Byte",
"s",
"IO_",
"(_",
"geo",
"json",
"\\u",
"input_",
")_",
",_",
"max",
"\\u",
"features_",
"=_",
"3_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"3_",
"[_",
"'",
"features",
"'_",
"]_",
")_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"geo",
"json",
"4_",
"=_",
"json_",
"._",
"loads_",
"(_",
"sample",
"\\u",
"geojson_",
"(_",
"Byte",
"s",
"IO_",
"(_",
"geo",
"json",
"\\u",
"input_",
")_",
",_",
"max",
"\\u",
"features_",
"=_",
"4_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"4_",
"[_",
"'",
"features",
"'_",
"]_",
")_",
",_",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"0_",
"[_",
"'",
"type",
"'_",
"]_",
",_",
"'",
"Feature",
"Collecti",
"on",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"'",
"type",
"'_",
"]_",
",_",
"'",
"Feature",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"'",
"proper",
"ties",
"'_",
"]_",
"[_",
"'",
"prop",
"0",
"'_",
"]_",
",_",
"'",
"value",
"0",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"type",
"'_",
"]_",
",_",
"'",
"Point",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
"[_",
"0_",
"]_",
",_",
"102",
"._",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"1_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
"[_",
"1_",
"]_",
",_",
".5_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"2_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"1_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"type",
"'_",
"]_",
",_",
"'",
"Line",
"String",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"2_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"1_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
")_",
",_",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"2_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"1_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
",_",
"102",
"._",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"2_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"1_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"1_",
"]_",
",_",
"0._",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"3_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"2_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"type",
"'_",
"]_",
",_",
"'",
"Polygon",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"geo",
"json",
"3_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"2_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"3_",
"[_",
"'",
"features",
"'_",
"]_",
"[_",
"2_",
"]_",
"[_",
"'",
"geom",
"etry",
"'_",
"]_",
"[_",
"'",
"coordinate",
"s",
"'_",
"]_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
",_",
"100._",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"geo",
"json",
"3_",
"[_",
"'",
"features",
"'_",
"]_",
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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | enthought/envisage/envisage/plugins/remote_editor/editor_plugins/editra/start_editra.py | [
{
"content": "\"\"\" Provides a platform indepedent way to launch Editra. Code mostly copied\n from Editra run file (/usr/bin/editra) in Ubuntu wx package.\n\"\"\"\n\nimport sys\nimport os\n\ntry:\n import Editra as Editra_root\n sys.path.insert(0, os.path.join(os.path.dirname(Editra_root.__file__),\n 'src'))\n # Really ugly: we need to remove the Editra name from the list of\n # imported modules\n sys.modules.pop('Editra')\nexcept ImportError:\n import wx.tools\n\n # Editra needs its src package to be on the sys.path for plugins and\n # such to work right, so put it there before we do the first import of\n # any Editra package or module.\n sys.path.insert(0, os.path.join(os.path.dirname(wx.tools.__file__),\n 'Editra', 'src'))\n\nimport Editra\n\n# XXX: Super ugly: monkey-patch the main Editra class to add our plugins\nold_MainLoop = Editra.Editra.MainLoop\n\n\nEditra.Editra.MainLoop = my_MainLoop\n\n\nif __name__ == '__main__':\n main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def my_MainLoop(self, *args, **kwargs):\n from envisage.plugins.remote_editor.editor_plugins.editra.editra_plugin \\\n import RemoteEditorPlugin\n plugin = RemoteEditorPlugin(Editra=self)\n try:\n plugin.do_PlugIt()\n old_MainLoop(self, *args, **kwargs)\n finally:\n plugin.client.unregister()",
"metadata": "root.my_MainLoop",
"header": "['module', '___EOS___']",
"index": 28
},
{
"content": "def main():\n Editra.Main()",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 40
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
" ",
"Prov",
"ides",
" ",
"a",
" ",
"platform",
" ",
"indep",
"eden",
"t",
" ",
"way",
" ",
"to",
" ",
"launch",
" ",
"Edit",
"ra",
".",
" ",
"Code",
" ",
"most",
"ly",
" ",
"copie",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"from",
" ",
"Edit",
"ra",
" ",
"run",
" ",
"file",
" ",
"(/",
"usr",
"/",
"bin",
"/",
"edit",
"ra",
")",
" ",
"in",
" ",
"Ub",
"unt",
"u",
" ",
"wx",
" ",
"package",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"Edit",
"ra_",
"as_",
"Edit",
"ra",
"\\u",
"root_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"insert_",
"(_",
"0_",
",_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"Edit",
"ra",
"\\u",
"root_",
"._",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"src",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Real",
"ly",
" ",
"ug",
"ly",
":",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"remove",
" ",
"the",
" ",
"Edit",
"ra",
" ",
"name",
" ",
"from",
" ",
"the",
" ",
"list",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"import",
"ed",
" ",
"modules_",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"modules_",
"._",
"pop_",
"(_",
"'",
"Edit",
"ra",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"wx_",
"._",
"tools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Edit",
"ra",
" ",
"need",
"s",
" ",
"its",
" ",
"src",
" ",
"package",
" ",
"to",
" ",
"be",
" ",
"on",
" ",
"the",
" ",
"sys",
".",
"path",
" ",
"for",
" ",
"plugin",
"s",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"suc",
"h",
" ",
"to",
" ",
"work",
" ",
"right",
",",
" ",
"so",
" ",
"put",
" ",
"it",
" ",
"there",
" ",
"bef",
"ore",
" ",
"we",
" ",
"do",
" ",
"the",
" ",
"first",
" ",
"import",
" ",
"of_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"any",
" ",
"Edit",
"ra",
" ",
"package",
" ",
"or",
" ",
"module",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"sys_",
"._",
"path_",
"._",
"insert_",
"(_",
"0_",
",_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"wx_",
"._",
"tools_",
"._",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Edit",
"ra",
"'_",
",_",
"'",
"src",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"import_",
"Edit",
"ra_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"XX",
"X",
":",
" ",
"Super",
" ",
"ug",
"ly",
":",
" ",
"monkey",
"-",
"patch",
" ",
"the",
" ",
"main",
" ",
"Edit",
"ra",
" ",
"class",
" ",
"to",
" ",
"add",
" ",
"our",
" ",
"plugins_",
"\\u\\u\\uNL\\u\\u\\u_",
"old",
"\\u",
"Main",
"Loop_",
"=_",
"Edit",
"ra_",
"._",
"Edit",
"ra_",
"._",
"Main",
"Loop_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Edit",
"ra_",
"._",
"Edit",
"ra_",
"._",
"Main",
"Loop_",
"=_",
"my",
"\\u",
"Main",
"Loop_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"my",
"\\u",
"Main",
"Loop_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"envi",
"sage",
"_",
"._",
"plugins_",
"._",
"remote",
"\\u",
"editor_",
"._",
"editor",
"\\u",
"plugins_",
"._",
"edit",
"ra_",
"._",
"edit",
"ra",
"\\u",
"plugin_",
"import_",
"Remo",
"te",
"Edit",
"or",
"Plugin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plugin_",
"=_",
"Remo",
"te",
"Edit",
"or",
"Plugin_",
"(_",
"Edit",
"ra_",
"=_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plugin_",
"._",
"do",
"\\u",
"Plug",
"It_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"old",
"\\u",
"Main",
"Loop_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"finally_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plugin_",
"._",
"client_",
"._",
"unregister_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | yetty/django-embed-video/docs/ext/djangodocs.py | [
{
"content": "def parse_django_adminopt_node(env, sig, signode):\n \"\"\"A copy of sphinx.directives.CmdoptionDesc.parse_signature()\"\"\"\n from sphinx.domains.std import option_desc_re\n count = 0\n firstname = ''\n for m in option_desc_re.finditer(sig):\n optname, args = m.groups()\n if count:\n signode += addnodes.desc_addname(', ', ', ')\n signode += addnodes.desc_name(optname, optname)\n signode += addnodes.desc_addname(args, args)\n if not count:\n firstname = optname\n count += 1\n if not count:\n for m in simple_option_desc_re.finditer(sig):\n optname, args = m.groups()\n if count:\n signode += addnodes.desc_addname(', ', ', ')\n signode += addnodes.desc_name(optname, optname)\n signode += addnodes.desc_addname(args, args)\n if not count:\n firstname = optname\n count += 1\n if not firstname:\n raise ValueError\n return firstname",
"metadata": "root.parse_django_adminopt_node",
"header": "['module', '___EOS___']",
"index": 167
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"parse",
"\\u",
"django",
"\\u",
"admin",
"opt",
"\\u",
"node_",
"(_",
"env_",
",_",
"sig_",
",_",
"signo",
"de_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"A",
" ",
"copy",
" ",
"of",
" ",
"sphinx",
".",
"directive",
"s",
".",
"Cmd",
"option",
"Des",
"c",
".",
"parse",
"\\u",
"signa",
"ture",
"()\"",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sphinx_",
"._",
"domains_",
"._",
"std_",
"import_",
"option",
"\\u",
"desc",
"\\u",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"count_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"firstname_",
"=_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"m_",
"in_",
"option",
"\\u",
"desc",
"\\u",
"re_",
"._",
"finditer_",
"(_",
"sig_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"opt",
"name_",
",_",
"args_",
"=_",
"m_",
"._",
"groups_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"signo",
"de_",
"+=_",
"addn",
"odes_",
"._",
"desc",
"\\u",
"addn",
"ame_",
"(_",
"',",
" ",
"'_",
",_",
"',",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"signo",
"de_",
"+=_",
"addn",
"odes_",
"._",
"desc",
"\\u",
"name_",
"(_",
"opt",
"name_",
",_",
"opt",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"signo",
"de_",
"+=_",
"addn",
"odes_",
"._",
"desc",
"\\u",
"addn",
"ame_",
"(_",
"args_",
",_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"firstname_",
"=_",
"opt",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"count_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"m_",
"in_",
"simple",
"\\u",
"option",
"\\u",
"desc",
"\\u",
"re_",
"._",
"finditer_",
"(_",
"sig_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"opt",
"name_",
",_",
"args_",
"=_",
"m_",
"._",
"groups_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"signo",
"de_",
"+=_",
"addn",
"odes_",
"._",
"desc",
"\\u",
"addn",
"ame_",
"(_",
"',",
" ",
"'_",
",_",
"',",
" ",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"signo",
"de_",
"+=_",
"addn",
"odes_",
"._",
"desc",
"\\u",
"name_",
"(_",
"opt",
"name_",
",_",
"opt",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"signo",
"de_",
"+=_",
"addn",
"odes_",
"._",
"desc",
"\\u",
"addn",
"ame_",
"(_",
"args_",
",_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"count_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"firstname_",
"=_",
"opt",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"count_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"firstname_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"firstname_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Redundant comparison | EasyEngine/easyengine/ee/cli/plugins/debug.py | [
{
"content": " @expose(hide=True)\n def debug_nginx(self):\n \"\"\"Start/Stop Nginx debug\"\"\"\n # start global debug\n if (self.app.pargs.nginx == 'on' and not self.app.pargs.site_name):\n try:\n debug_address = (self.app.config.get('stack', 'ip-address')\n .split())\n except Exception as e:\n debug_address = ['0.0.0.0/0']\n\n # Check if IP address is 127.0.0.1 then enable debug globally\n if debug_address == ['127.0.0.1'] or debug_address == []:\n debug_address = ['0.0.0.0/0']\n\n for ip_addr in debug_address:\n if not (\"debug_connection \"+ip_addr in open('/etc/nginx/'\n 'nginx.conf', encoding='utf-8').read()):\n Log.info(self, \"Setting up Nginx debug connection\"\n \" for \"+ip_addr)\n EEShellExec.cmd_exec(self, \"sed -i \\\"/events {{/a\\\\ \\\\ \\\\ \"\n \"\\\\ $(echo debug_connection \"\n \"{ip}\\;)\\\" /etc/nginx/\"\n \"nginx.conf\".format(ip=ip_addr))\n self.trigger_nginx = True\n\n if not self.trigger_nginx:\n Log.info(self, \"Nginx debug connection already enabled\")\n\n self.msg = self.msg + [\"/var/log/nginx/*.error.log\"]\n\n # stop global debug\n elif (self.app.pargs.nginx == 'off' and not self.app.pargs.site_name):\n if \"debug_connection \" in open('/etc/nginx/nginx.conf',\n encoding='utf-8').read():\n Log.info(self, \"Disabling Nginx debug connections\")\n EEShellExec.cmd_exec(self, \"sed -i \\\"/debug_connection.*/d\\\"\"\n \" /etc/nginx/nginx.conf\")\n self.trigger_nginx = True\n else:\n Log.info(self, \"Nginx debug connection already disabled\")\n\n # start site specific debug\n elif (self.app.pargs.nginx == 'on' and self.app.pargs.site_name):\n config_path = (\"/etc/nginx/sites-available/{0}\"\n .format(self.app.pargs.site_name))\n if os.path.isfile(config_path):\n if not EEShellExec.cmd_exec(self, \"grep \\\"error.log debug\\\" \"\n \"{0}\".format(config_path)):\n Log.info(self, \"Starting NGINX debug connection for \"\n \"{0}\".format(self.app.pargs.site_name))\n EEShellExec.cmd_exec(self, \"sed -i \\\"s/error.log;/\"\n \"error.log \"\n \"debug;/\\\" {0}\".format(config_path))\n self.trigger_nginx = True\n\n else:\n Log.info(self, \"Nginx debug for site already enabled\")\n\n self.msg = self.msg + ['{0}{1}/logs/error.log'\n .format(EEVariables.ee_webroot,\n self.app.pargs.site_name)]\n\n else:\n Log.info(self, \"{0} domain not valid\"\n .format(self.app.pargs.site_name))\n\n # stop site specific debug\n elif (self.app.pargs.nginx == 'off' and self.app.pargs.site_name):\n config_path = (\"/etc/nginx/sites-available/{0}\"\n .format(self.app.pargs.site_name))\n if os.path.isfile(config_path):\n if EEShellExec.cmd_exec(self, \"grep \\\"error.log debug\\\" {0}\"\n .format(config_path)):\n Log.info(self, \"Stoping NGINX debug connection for {0}\"\n .format(self.app.pargs.site_name))\n EEShellExec.cmd_exec(self, \"sed -i \\\"s/error.log debug;/\"\n \"error.log;/\\\" {0}\"\n .format(config_path))\n self.trigger_nginx = True\n\n else:\n\n Log.info(self, \"Nginx debug for site already disabled\")\n else:\n Log.info(self, \"{0} domain not valid\"\n .format(self.app.pargs.site_name))",
"metadata": "root.EEDebugController.debug_nginx",
"header": "['class', 'EEDebugController', '(', 'CementBaseController', ')', ':', '___EOS___']",
"index": 86
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Redu",
"ndan",
"t_",
"comparison_",
"[SEP]_",
"class_",
"EE",
"Deb",
"ug",
"Controller_",
"(_",
"Ce",
"ment",
"Base",
"Controller_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"expose_",
"(_",
"hide_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"debug",
"\\u",
"ngin",
"x_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Start",
"/",
"Sto",
"p",
" ",
"Ng",
"inx",
" ",
"debug",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"start",
" ",
"global",
" ",
"debug_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"ngin",
"x_",
"==_",
"'",
"on",
"'_",
"and_",
"not_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"debug",
"\\u",
"address_",
"=_",
"(_",
"self_",
"._",
"app_",
"._",
"config_",
"._",
"get_",
"(_",
"'",
"stack",
"'_",
",_",
"'",
"ip",
"-",
"address",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"split_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"debug",
"\\u",
"address_",
"=_",
"[_",
"'",
"0.",
"0.",
"0.",
"0",
"/",
"0",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"if",
" ",
"IP",
" ",
"address",
" ",
"is",
" ",
"127",
".0",
".0",
".1",
" ",
"then",
" ",
"enable",
" ",
"debug",
" ",
"global",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"debug",
"\\u",
"address_",
"==_",
"[_",
"'",
"127",
".0",
".0",
".1",
"'_",
"]_",
"or_",
"debug",
"\\u",
"address_",
"==_",
"[_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"debug",
"\\u",
"address_",
"=_",
"[_",
"'",
"0.",
"0.",
"0.",
"0",
"/",
"0",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"ip",
"\\u",
"addr_",
"in_",
"debug",
"\\u",
"address_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"(_",
"\"",
"debug",
"\\u",
"connecti",
"on",
" ",
"\"_",
"+_",
"ip",
"\\u",
"addr_",
"in_",
"open_",
"(_",
"'/",
"etc",
"/",
"ngin",
"x",
"/'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ngin",
"x",
".",
"conf",
"'_",
",_",
"encoding_",
"=_",
"'",
"utf",
"-",
"8",
"'_",
")_",
"._",
"read_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Sett",
"ing",
" ",
"up",
" ",
"Ng",
"inx",
" ",
"debug",
" ",
"connecti",
"on",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"for",
" ",
"\"_",
"+_",
"ip",
"\\u",
"addr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EE",
"Shel",
"l",
"Exec_",
"._",
"cmd",
"\\u",
"exec_",
"(_",
"self_",
",_",
"\"",
"sed",
" ",
"-",
"i",
" ",
"\\\\\"",
"/",
"events",
" ",
"{{",
"/",
"a",
"\\\\\\\\",
" ",
"\\\\\\\\",
" ",
"\\\\\\\\",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\\\\\\\\",
" ",
"$(",
"echo",
" ",
"debug",
"\\u",
"connecti",
"on",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"{",
"ip",
"}\\\\",
";)",
"\\\\\"",
" ",
"/",
"etc",
"/",
"ngin",
"x",
"/\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"ngin",
"x",
".",
"conf",
"\"_",
"._",
"format_",
"(_",
"ip_",
"=_",
"ip",
"\\u",
"addr_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"trigger",
"\\u",
"ngin",
"x_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"trigger",
"\\u",
"ngin",
"x_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Ng",
"inx",
" ",
"debug",
" ",
"connecti",
"on",
" ",
"alr",
"ead",
"y",
" ",
"enable",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"msg_",
"=_",
"self_",
"._",
"msg_",
"+_",
"[_",
"\"/",
"var",
"/",
"log",
"/",
"ngin",
"x",
"/*",
".",
"error",
".",
"log",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"stop",
" ",
"global",
" ",
"debug_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"ngin",
"x_",
"==_",
"'",
"off",
"'_",
"and_",
"not_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"\"",
"debug",
"\\u",
"connecti",
"on",
" ",
"\"_",
"in_",
"open_",
"(_",
"'/",
"etc",
"/",
"ngin",
"x",
"/",
"ngin",
"x",
".",
"conf",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"encoding_",
"=_",
"'",
"utf",
"-",
"8",
"'_",
")_",
"._",
"read_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Disa",
"blin",
"g",
" ",
"Ng",
"inx",
" ",
"debug",
" ",
"connections",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EE",
"Shel",
"l",
"Exec_",
"._",
"cmd",
"\\u",
"exec_",
"(_",
"self_",
",_",
"\"",
"sed",
" ",
"-",
"i",
" ",
"\\\\\"",
"/",
"debug",
"\\u",
"connecti",
"on",
".*",
"/",
"d",
"\\\\\"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
" ",
"/",
"etc",
"/",
"ngin",
"x",
"/",
"ngin",
"x",
".",
"conf",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"trigger",
"\\u",
"ngin",
"x_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Ng",
"inx",
" ",
"debug",
" ",
"connecti",
"on",
" ",
"alr",
"ead",
"y",
" ",
"disable",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"start",
" ",
"site",
" ",
"specific",
" ",
"debug_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"ngin",
"x_",
"==_",
"'",
"on",
"'_",
"and_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"config",
"\\u",
"path_",
"=_",
"(_",
"\"/",
"etc",
"/",
"ngin",
"x",
"/",
"sites",
"-",
"avail",
"able",
"/{",
"0",
"}\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"isfile_",
"(_",
"config",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"EE",
"Shel",
"l",
"Exec_",
"._",
"cmd",
"\\u",
"exec_",
"(_",
"self_",
",_",
"\"",
"grep",
" ",
"\\\\\"",
"error",
".",
"log",
" ",
"debug",
"\\\\\"",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"{",
"0",
"}\"_",
"._",
"format_",
"(_",
"config",
"\\u",
"path_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Start",
"ing",
" ",
"NG",
"IN",
"X",
" ",
"debug",
" ",
"connecti",
"on",
" ",
"for",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"{",
"0",
"}\"_",
"._",
"format_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EE",
"Shel",
"l",
"Exec_",
"._",
"cmd",
"\\u",
"exec_",
"(_",
"self_",
",_",
"\"",
"sed",
" ",
"-",
"i",
" ",
"\\\\\"",
"s",
"/",
"error",
".",
"log",
";",
"/\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"error",
".",
"log",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"debug",
";",
"/\\\\",
"\"",
" ",
"{",
"0",
"}\"_",
"._",
"format_",
"(_",
"config",
"\\u",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"trigger",
"\\u",
"ngin",
"x_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Ng",
"inx",
" ",
"debug",
" ",
"for",
" ",
"site",
" ",
"alr",
"ead",
"y",
" ",
"enable",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"msg_",
"=_",
"self_",
"._",
"msg_",
"+_",
"[_",
"'{",
"0",
"}{",
"1",
"}/",
"logs",
"/",
"error",
".",
"log",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"EE",
"Variables_",
"._",
"ee",
"\\u",
"webr",
"oot_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"{",
"0",
"}",
" ",
"domain",
" ",
"not",
" ",
"valid",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"stop",
" ",
"site",
" ",
"specific",
" ",
"debug_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"ngin",
"x_",
"==_",
"'",
"off",
"'_",
"and_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"config",
"\\u",
"path_",
"=_",
"(_",
"\"/",
"etc",
"/",
"ngin",
"x",
"/",
"sites",
"-",
"avail",
"able",
"/{",
"0",
"}\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"os_",
"._",
"path_",
"._",
"isfile_",
"(_",
"config",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"EE",
"Shel",
"l",
"Exec_",
"._",
"cmd",
"\\u",
"exec_",
"(_",
"self_",
",_",
"\"",
"grep",
" ",
"\\\\\"",
"error",
".",
"log",
" ",
"debug",
"\\\\\"",
" ",
"{",
"0",
"}\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"config",
"\\u",
"path_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Sto",
"ping",
" ",
"NG",
"IN",
"X",
" ",
"debug",
" ",
"connecti",
"on",
" ",
"for",
" ",
"{",
"0",
"}\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"self_",
"._",
"app_",
"._",
"pargs_",
"._",
"site",
"\\u",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"EE",
"Shel",
"l",
"Exec_",
"._",
"cmd",
"\\u",
"exec_",
"(_",
"self_",
",_",
"\"",
"sed",
" ",
"-",
"i",
" ",
"\\\\\"",
"s",
"/",
"error",
".",
"log",
" ",
"debug",
";",
"/\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"error",
".",
"log",
";",
"/\\\\",
"\"",
" ",
"{",
"0",
"}\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"format_",
"(_",
"config",
"\\u",
"path_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"trigger",
"\\u",
"ngin",
"x_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"",
"Ng",
"inx",
" ",
"debug",
" ",
"for",
" ",
"site",
" ",
"alr",
"ead",
"y",
" ",
"disable",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Log_",
"._",
"info_",
"(_",
"self_",
",_",
"\"{",
"0",
"}",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y/Path.py | [
{
"content": " def printiter(self, it, output=None):\n\tif output is None:\n\t output = self.output\n\tself.moreiterator = it\n\ti = 0\n\tlastindex = None\n\twhile i < self.maxpaths:\n\t try:\n\t\tel = it.next()\n\t except StopIteration:\n\t\tit.reset(0)\n\t\tbreak\n\t el.pp(output=output)\n\t i += 1\n\t lastindex = el.index\n\telse:\n\t if lastindex is not None:\n\t\tnummore = self.numpaths-(lastindex+1)\n\t\tif nummore == 1:\n\t\t it.next().pp(output=output)\n\t\telif nummore > 1:\n\t\t print >>output, '<... %d more paths ...>'%nummore",
"metadata": "root.ShortestPaths.printiter",
"header": "['class', 'ShortestPaths', ':', '___EOS___']",
"index": 374
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Short",
"est",
"Paths_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"print",
"iter_",
"(_",
"self_",
",_",
"it_",
",_",
"output_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"_",
"if_",
"output_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
" _",
"output_",
"=_",
"self_",
"._",
"output_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"more",
"iterator_",
"=_",
"it_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"i_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lasti",
"ndex_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"i_",
"<_",
"self_",
"._",
"maxp",
"ath",
"s_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"el_",
"=_",
"it_",
"._",
"next_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Sto",
"p",
"Iteration_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"it_",
"._",
"reset_",
"(_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"el_",
"._",
"pp_",
"(_",
"output_",
"=_",
"output_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"i_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lasti",
"ndex_",
"=_",
"el_",
"._",
"index_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
" _",
"if_",
"lasti",
"ndex_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"num",
"more_",
"=_",
"self_",
"._",
"nump",
"ath",
"s_",
"-_",
"(_",
"lasti",
"ndex_",
"+_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"num",
"more_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t _",
"it_",
"._",
"next_",
"(_",
")_",
"._",
"pp_",
"(_",
"output_",
"=_",
"output_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"num",
"more_",
">_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t _",
"print_",
">>_",
"output_",
",_",
"'<",
"...",
" ",
"%",
"d",
" ",
"more",
" ",
"path",
"s",
" ",
"...",
">'_",
"%_",
"num",
"more_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | ambitioninc/django-query-builder/querybuilder/tests/field_tests.py | [
{
"content": "import datetime\nfrom fleming import unix_time, floor\n\nfrom querybuilder.fields import SimpleField, LagDifferenceField, LeadDifferenceField, AllTime, SumField, Week\nfrom querybuilder.query import Query, QueryWindow\nfrom querybuilder.tests.models import Order\nfrom querybuilder.tests.query_tests import QueryTestCase\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class FieldTest(QueryTestCase):\n\n\n\n\n # def test_cast(self):\n # \"\"\"\n # Verified a value is casted to a float\n # \"\"\"\n # query = Query().from_table(\n # table=Order,\n # fields=[\n # AllTime('time', cast='FLOAT'),\n # SumField('margin')\n # ]\n # )\n # expected_query = (\n # 'SELECT CAST(0 AS FLOAT) AS time__epoch, '\n # 'SUM(tests_order.margin) AS margin_sum '\n # 'FROM tests_order'\n # )\n # self.assertEqual(expected_query, query.get_sql())\n # rows = query.select()\n # self.assertEqual(1, len(rows))\n # self.assertEqual(825.0, rows[0]['margin_sum'])\n # self.assertEqual(float, type(rows[0]['time__epoch']))\n # self.assertEqual(0.0, rows[0]['time__epoch'])\n",
"metadata": "root.FieldTest",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " def test_cast(self):\n \"\"\"\n Tests that the cast sql is generated and that the resulting value is of that type\n \"\"\"\n query = Query().from_table(\n table=Order,\n fields=[SimpleField(field='revenue', cast='INT')]\n ).order_by('revenue').limit(1)\n expected_query = 'SELECT CAST(tests_order.revenue AS INT) FROM tests_order ORDER BY revenue ASC LIMIT 1'\n self.assertEqual(expected_query, query.get_sql())\n rows = query.select()\n self.assertEqual(1, len(rows))\n self.assertEqual(type(rows[0]['revenue']), int)",
"metadata": "root.FieldTest.test_cast",
"header": "['class', 'FieldTest', '(', 'QueryTestCase', ')', ':', '___EOS___']",
"index": 10
},
{
"content": " def test_get_alias(self):\n \"\"\"\n Tests the different cases of getting the alias of a field\n \"\"\"\n field = SimpleField(field='revenue')\n query = Query().from_table(table=Order, fields=[field])\n expected_query = 'SELECT tests_order.revenue FROM tests_order'\n self.assertEqual(expected_query, query.get_sql())\n\n field.auto_alias = 'my_auto_alias'\n query = Query().from_table(table=Order, fields=[field])\n expected_query = 'SELECT tests_order.revenue AS my_auto_alias FROM tests_order'\n self.assertEqual(expected_query, query.get_sql())\n\n field.alias = 'my_alias'\n query = Query().from_table(table=Order, fields=[field])\n expected_query = 'SELECT tests_order.revenue AS my_alias FROM tests_order'\n self.assertEqual(expected_query, query.get_sql())\n\n query = Query().from_table(\n table=Order,\n fields=[field],\n prefix_fields=True,\n field_prefix='my_field_prefix',\n )\n expected_query = 'SELECT tests_order.revenue AS my_field_prefix__my_alias FROM tests_order'\n self.assertEqual(expected_query, query.get_sql())\n\n field.alias = None\n field.auto_alias = None\n query = Query().from_table(\n table=Order,\n fields=[field],\n prefix_fields=True,\n field_prefix='my_field_prefix',\n )\n expected_query = 'SELECT tests_order.revenue AS my_field_prefix__revenue FROM tests_order'\n self.assertEqual(expected_query, query.get_sql())",
"metadata": "root.FieldTest.test_get_alias",
"header": "['class', 'FieldTest', '(', 'QueryTestCase', ')', ':', '___EOS___']",
"index": 24
},
{
"content": " def lead_lag_difference_test(self):\n query = Query().from_table(\n table=Order,\n fields=[\n 'margin',\n LagDifferenceField('margin', over=QueryWindow().order_by('-margin')),\n LeadDifferenceField('margin', over=QueryWindow().order_by('-margin')),\n ]\n )\n expected_query = (\n 'SELECT tests_order.margin, '\n '((tests_order.margin) - (LAG(tests_order.margin, 1) '\n 'OVER (ORDER BY margin DESC))) AS margin_lag, '\n '((tests_order.margin) - (LEAD(tests_order.margin, 1) '\n 'OVER (ORDER BY margin DESC))) AS margin_lead '\n 'FROM tests_order'\n )\n self.assertEqual(expected_query, query.get_sql())\n rows = query.select()\n self.assertEqual(4, len(rows))\n self.assertEqual(None, rows[0]['margin_lag'])\n self.assertEqual(500.0, rows[0]['margin_lead'])\n self.assertEqual(-75.0, rows[3]['margin_lag'])\n self.assertEqual(None, rows[3]['margin_lead'])",
"metadata": "root.FieldTest.lead_lag_difference_test",
"header": "['class', 'FieldTest', '(', 'QueryTestCase', ')', ':', '___EOS___']",
"index": 63
},
{
"content": " def date_part_field_test(self):\n \"\"\"\n Tests the different options of DatePartField objects\n \"\"\"\n # test with no cast\n query = Query().from_table(\n table=Order,\n fields=[\n AllTime('time'),\n SumField('margin')\n ]\n )\n expected_query = (\n 'SELECT CAST(0 AS INT) AS time__epoch, '\n 'SUM(tests_order.margin) AS margin_sum '\n 'FROM tests_order'\n )\n self.assertEqual(expected_query, query.get_sql())\n rows = query.select()\n self.assertEqual(1, len(rows))\n self.assertEqual(825.0, rows[0]['margin_sum'])\n self.assertEqual(0, rows[0]['time__epoch'])",
"metadata": "root.FieldTest.date_part_field_test",
"header": "['class', 'FieldTest', '(', 'QueryTestCase', ')', ':', '___EOS___']",
"index": 88
},
{
"content": " def test_week_grouping(self):\n \"\"\"\n Verifies that the week grouping query and result is correct\n \"\"\"\n query = Query().from_table(\n table=Order,\n fields=[\n Week('time', auto=True),\n SumField('margin')\n ]\n )\n expected_query = (\n \"SELECT CAST(EXTRACT(year FROM tests_order.time) AS INT) AS time__year, \"\n \"CAST(EXTRACT(week FROM tests_order.time) AS INT) AS time__week, \"\n \"CAST(EXTRACT(epoch FROM date_trunc('week', tests_order.time)) AS INT) AS time__epoch, \"\n \"SUM(tests_order.margin) AS margin_sum \"\n \"FROM tests_order \"\n \"GROUP BY time__year, time__week, time__epoch \"\n \"ORDER BY time__epoch ASC\"\n )\n self.assertEqual(expected_query, query.get_sql())\n rows = query.select()\n self.assertEqual(1, len(rows))\n week_dt = datetime.datetime(2012, 10, 19)\n week_unix_time = unix_time(floor(week_dt, week=1))\n self.assertEqual(825.0, rows[0]['margin_sum'])\n self.assertEqual(week_unix_time, rows[0]['time__epoch'])\n self.assertEqual(2012, rows[0]['time__year'])\n self.assertEqual(42, rows[0]['time__week'])",
"metadata": "root.FieldTest.test_week_grouping",
"header": "['class', 'FieldTest', '(', 'QueryTestCase', ')', ':', '___EOS___']",
"index": 134
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"fle",
"ming",
"_",
"import_",
"unix",
"\\u",
"time_",
",_",
"floor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"query",
"builder_",
"._",
"fields_",
"import_",
"Simple",
"Field_",
",_",
"Lag",
"Difference",
"Field_",
",_",
"Lead",
"Difference",
"Field_",
",_",
"All",
"Time_",
",_",
"Sum",
"Field_",
",_",
"Week",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"query",
"builder_",
"._",
"query_",
"import_",
"Query_",
",_",
"Query",
"Window_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"query",
"builder_",
"._",
"tests_",
"._",
"models_",
"import_",
"Order_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"query",
"builder_",
"._",
"tests_",
"._",
"query",
"\\u",
"tests_",
"import_",
"Query",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Field",
"Test_",
"(_",
"Query",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"def",
" ",
"test\\u",
"cast",
"(",
"self",
"):",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"\"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Verifie",
"d",
" ",
"a",
" ",
"value",
" ",
"is",
" ",
"cast",
"ed",
" ",
"to",
" ",
"a",
" ",
"float_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"\"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"query",
" ",
"=",
" ",
"Query",
"()",
".",
"from",
"\\u",
"table",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"table",
"=",
"Order",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"fields",
"=[",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"All",
"Time",
"('",
"time",
"',",
" ",
"cast",
"='",
"FLOAT",
"')",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"Sum",
"Field",
"('",
"marg",
"in",
"')",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"expected",
"\\u",
"query",
" ",
"=",
" ",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"'",
"SELECT",
" ",
"CAST",
"(",
"0",
" ",
"AS",
" ",
"FLOAT",
")",
" ",
"AS",
" ",
"time",
"\\u\\u",
"epoch",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"'",
"SUM",
"(",
"tests",
"\\u",
"order",
".",
"marg",
"in",
")",
" ",
"AS",
" ",
"marg",
"in",
"\\u",
"sum",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"'",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"self",
".",
"assert",
"Equal",
"(",
"expected",
"\\u",
"query",
",",
" ",
"query",
".",
"get",
"\\u",
"sql",
"())",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"rows",
" ",
"=",
" ",
"query",
".",
"select",
"()",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"self",
".",
"assert",
"Equal",
"(",
"1",
",",
" ",
"len",
"(",
"rows",
"))",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"self",
".",
"assert",
"Equal",
"(",
"825",
".0",
",",
" ",
"rows",
"[",
"0",
"]['",
"marg",
"in",
"\\u",
"sum",
"'])",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"self",
".",
"assert",
"Equal",
"(",
"float",
",",
" ",
"type",
"(",
"rows",
"[",
"0",
"]['",
"time",
"\\u\\u",
"epoch",
"'])",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"self",
".",
"assert",
"Equal",
"(",
"0.",
"0",
",",
" ",
"rows",
"[",
"0",
"]['",
"time",
"\\u\\u",
"epoch",
"'])",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Field",
"Test_",
"(_",
"Query",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"cast_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"cast",
" ",
"sql",
" ",
"is",
" ",
"generat",
"ed",
" ",
"and",
" ",
"tha",
"t",
" ",
"the",
" ",
"result",
"ing",
" ",
"value",
" ",
"is",
" ",
"of",
" ",
"tha",
"t",
" ",
"type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"=_",
"Order_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"Simple",
"Field_",
"(_",
"field_",
"=_",
"'",
"revenu",
"e",
"'_",
",_",
"cast_",
"=_",
"'",
"INT",
"'_",
")_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"._",
"order",
"\\u",
"by_",
"(_",
"'",
"revenu",
"e",
"'_",
")_",
"._",
"limit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"'",
"SELECT",
" ",
"CAST",
"(",
"tests",
"\\u",
"order",
".",
"revenu",
"e",
" ",
"AS",
" ",
"INT",
")",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
" ",
"ORDE",
"R",
" ",
"BY",
" ",
"revenu",
"e",
" ",
"ASC",
" ",
"LIMIT",
" ",
"1",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rows_",
"=_",
"query_",
"._",
"select_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"len_",
"(_",
"rows_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"type_",
"(_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"revenu",
"e",
"'_",
"]_",
")_",
",_",
"int_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Field",
"Test_",
"(_",
"Query",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"alias_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
"s",
" ",
"the",
" ",
"different",
" ",
"case",
"s",
" ",
"of",
" ",
"getti",
"ng",
" ",
"the",
" ",
"alias",
" ",
"of",
" ",
"a",
" ",
"field",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"field_",
"=_",
"Simple",
"Field_",
"(_",
"field_",
"=_",
"'",
"revenu",
"e",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"table_",
"=_",
"Order_",
",_",
"fields_",
"=_",
"[_",
"field_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"'",
"SELECT",
" ",
"tests",
"\\u",
"order",
".",
"revenu",
"e",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"._",
"auto",
"\\u",
"alias_",
"=_",
"'",
"my",
"\\u",
"auto",
"\\u",
"alias",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"table_",
"=_",
"Order_",
",_",
"fields_",
"=_",
"[_",
"field_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"'",
"SELECT",
" ",
"tests",
"\\u",
"order",
".",
"revenu",
"e",
" ",
"AS",
" ",
"my",
"\\u",
"auto",
"\\u",
"alias",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"._",
"alias_",
"=_",
"'",
"my",
"\\u",
"alias",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"table_",
"=_",
"Order_",
",_",
"fields_",
"=_",
"[_",
"field_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"'",
"SELECT",
" ",
"tests",
"\\u",
"order",
".",
"revenu",
"e",
" ",
"AS",
" ",
"my",
"\\u",
"alias",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"=_",
"Order_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"field_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"prefix",
"\\u",
"fields_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"field",
"\\u",
"prefix_",
"=_",
"'",
"my",
"\\u",
"field",
"\\u",
"prefix",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"'",
"SELECT",
" ",
"tests",
"\\u",
"order",
".",
"revenu",
"e",
" ",
"AS",
" ",
"my",
"\\u",
"field",
"\\u",
"prefix",
"\\u\\u",
"my",
"\\u",
"alias",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"field_",
"._",
"alias_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"field_",
"._",
"auto",
"\\u",
"alias_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"=_",
"Order_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"field_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"prefix",
"\\u",
"fields_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"field",
"\\u",
"prefix_",
"=_",
"'",
"my",
"\\u",
"field",
"\\u",
"prefix",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"'",
"SELECT",
" ",
"tests",
"\\u",
"order",
".",
"revenu",
"e",
" ",
"AS",
" ",
"my",
"\\u",
"field",
"\\u",
"prefix",
"\\u\\u",
"revenu",
"e",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Field",
"Test_",
"(_",
"Query",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"lead",
"\\u",
"lag",
"\\u",
"difference",
"\\u",
"test_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"=_",
"Order_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"marg",
"in",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lag",
"Difference",
"Field_",
"(_",
"'",
"marg",
"in",
"'_",
",_",
"over_",
"=_",
"Query",
"Window_",
"(_",
")_",
"._",
"order",
"\\u",
"by_",
"(_",
"'-",
"marg",
"in",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Lead",
"Difference",
"Field_",
"(_",
"'",
"marg",
"in",
"'_",
",_",
"over_",
"=_",
"Query",
"Window_",
"(_",
")_",
"._",
"order",
"\\u",
"by_",
"(_",
"'-",
"marg",
"in",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"SELECT",
" ",
"tests",
"\\u",
"order",
".",
"marg",
"in",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'((",
"tests",
"\\u",
"order",
".",
"marg",
"in",
")",
" ",
"-",
" ",
"(",
"LA",
"G",
"(",
"tests",
"\\u",
"order",
".",
"marg",
"in",
",",
" ",
"1",
")",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"OVER",
" ",
"(",
"ORDE",
"R",
" ",
"BY",
" ",
"marg",
"in",
" ",
"DESC",
")))",
" ",
"AS",
" ",
"marg",
"in",
"\\u",
"lag",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'((",
"tests",
"\\u",
"order",
".",
"marg",
"in",
")",
" ",
"-",
" ",
"(",
"LEA",
"D",
"(",
"tests",
"\\u",
"order",
".",
"marg",
"in",
",",
" ",
"1",
")",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"OVER",
" ",
"(",
"ORDE",
"R",
" ",
"BY",
" ",
"marg",
"in",
" ",
"DESC",
")))",
" ",
"AS",
" ",
"marg",
"in",
"\\u",
"lead",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rows_",
"=_",
"query_",
"._",
"select_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"4_",
",_",
"len_",
"(_",
"rows_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"None_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"marg",
"in",
"\\u",
"lag",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"500",
".0_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"marg",
"in",
"\\u",
"lead",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"-_",
"75.",
"0_",
",_",
"rows_",
"[_",
"3_",
"]_",
"[_",
"'",
"marg",
"in",
"\\u",
"lag",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"None_",
",_",
"rows_",
"[_",
"3_",
"]_",
"[_",
"'",
"marg",
"in",
"\\u",
"lead",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Field",
"Test_",
"(_",
"Query",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"date",
"\\u",
"part",
"\\u",
"field",
"\\u",
"test_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Test",
"s",
" ",
"the",
" ",
"different",
" ",
"options",
" ",
"of",
" ",
"Date",
"Part",
"Field",
" ",
"object",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"test",
" ",
"with",
" ",
"no",
" ",
"cast_",
"\\u\\u\\uNL\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"=_",
"Order_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"All",
"Time_",
"(_",
"'",
"time",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Sum",
"Field_",
"(_",
"'",
"marg",
"in",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"SELECT",
" ",
"CAST",
"(",
"0",
" ",
"AS",
" ",
"INT",
")",
" ",
"AS",
" ",
"time",
"\\u\\u",
"epoch",
",",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"SUM",
"(",
"tests",
"\\u",
"order",
".",
"marg",
"in",
")",
" ",
"AS",
" ",
"marg",
"in",
"\\u",
"sum",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"FROM",
" ",
"tests",
"\\u",
"order",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rows_",
"=_",
"query_",
"._",
"select_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"len_",
"(_",
"rows_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"825",
".0_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"marg",
"in",
"\\u",
"sum",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"0_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"time",
"\\u\\u",
"epoch",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Field",
"Test_",
"(_",
"Query",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"week",
"\\u",
"grouping_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Verifie",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"week",
" ",
"grouping",
" ",
"query",
" ",
"and",
" ",
"result",
" ",
"is",
" ",
"correct",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"query_",
"=_",
"Query_",
"(_",
")_",
"._",
"from",
"\\u",
"table_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"table_",
"=_",
"Order_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fields_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"Week",
"_",
"(_",
"'",
"time",
"'_",
",_",
"auto_",
"=_",
"True_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Sum",
"Field_",
"(_",
"'",
"marg",
"in",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"query_",
"=_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"SELECT",
" ",
"CAST",
"(",
"EXTRACT",
"(",
"year",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
".",
"time",
")",
" ",
"AS",
" ",
"INT",
")",
" ",
"AS",
" ",
"time",
"\\u\\u",
"year",
",",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"CAST",
"(",
"EXTRACT",
"(",
"week",
" ",
"FROM",
" ",
"tests",
"\\u",
"order",
".",
"time",
")",
" ",
"AS",
" ",
"INT",
")",
" ",
"AS",
" ",
"time",
"\\u\\u",
"week",
",",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"CAST",
"(",
"EXTRACT",
"(",
"epoch",
" ",
"FROM",
" ",
"date",
"\\u",
"trunc",
"('",
"week",
"',",
" ",
"tests",
"\\u",
"order",
".",
"time",
"))",
" ",
"AS",
" ",
"INT",
")",
" ",
"AS",
" ",
"time",
"\\u\\u",
"epoch",
",",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"SUM",
"(",
"tests",
"\\u",
"order",
".",
"marg",
"in",
")",
" ",
"AS",
" ",
"marg",
"in",
"\\u",
"sum",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"FROM",
" ",
"tests",
"\\u",
"order",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"GROU",
"P",
" ",
"BY",
" ",
"time",
"\\u\\u",
"year",
",",
" ",
"time",
"\\u\\u",
"week",
",",
" ",
"time",
"\\u\\u",
"epoch",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"ORDE",
"R",
" ",
"BY",
" ",
"time",
"\\u\\u",
"epoch",
" ",
"ASC",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"query_",
",_",
"query_",
"._",
"get",
"\\u",
"sql_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rows_",
"=_",
"query_",
"._",
"select_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"1_",
",_",
"len_",
"(_",
"rows_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"week",
"\\u",
"dt_",
"=_",
"datetime_",
"._",
"datetime_",
"(_",
"2012_",
",_",
"10_",
",_",
"19_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"week",
"\\u",
"unix",
"\\u",
"time_",
"=_",
"unix",
"\\u",
"time_",
"(_",
"floor_",
"(_",
"week",
"\\u",
"dt_",
",_",
"week_",
"=_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"825",
".0_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"marg",
"in",
"\\u",
"sum",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"week",
"\\u",
"unix",
"\\u",
"time_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"time",
"\\u\\u",
"epoch",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"2012_",
",_",
"rows_",
"[_",
"0_",
"]_",
"[_",
"'",
"time",
"\\u\\u",
"year",
"'_",
"]_",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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | chango/inferno/inferno/lib/job_options.py | [
{
"content": "from datetime import timedelta, date\nfrom inferno.lib.rule import InfernoRule\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class JobOptions(object):\n\n\n\n\n\n",
"metadata": "root.JobOptions",
"header": "['module', '___EOS___']",
"index": 4
},
{
"content": " def __init__(self, rule, settings):\n self.rule = rule\n self.settings = settings",
"metadata": "root.JobOptions.__init__",
"header": "['class', 'JobOptions', '(', 'object', ')', ':', '___EOS___']",
"index": 6
},
{
"content": " @property\n def result_tag(self):\n if self.settings.get('result_tag'):\n return self.settings.get('result_tag')\n else:\n return self.rule.result_tag",
"metadata": "root.JobOptions.result_tag",
"header": "['class', 'JobOptions', '(', 'object', ')', ':', '___EOS___']",
"index": 10
},
{
"content": " @property\n def tags(self):\n def _filter_rules(tags):\n return [tag for tag in tags if not isinstance(tag, InfernoRule)]\n\n if self.settings.get('source_tags') is not None:\n tags = _filter_rules(self.settings.get('source_tags'))\n else:\n tags = _filter_rules(self.rule.source_tags)\n\n # note that all day range options are disabled if we pass tags in\n # on the command line\n count = None\n if self.settings.get('day_start') is not None:\n start = self.settings.get('day_start')\n count = 1\n elif self.rule.day_start is not None:\n start = self.rule.day_start\n else:\n start = date.today()\n\n if self.settings.get('day_offset') is not None:\n start += timedelta(days=-self.settings.get('day_offset'))\n count = 1\n else:\n start += timedelta(days=-self.rule.day_offset)\n\n if self.settings.get('day_range') is not None:\n count = self.settings.get('day_range')\n elif count is None:\n count = self.rule.day_range\n\n if count and tags:\n tags = [self._name(tag, day, start) for tag in tags for day in range(count)]\n\n return tags or []",
"metadata": "root.JobOptions.tags",
"header": "['class', 'JobOptions', '(', 'object', ')', ':', '___EOS___']",
"index": 17
},
{
"content": " @property\n def urls(self):\n import operator\n\n urls_or_func = self.settings.get('source_urls') or getattr(self.rule, 'source_urls', None)\n rval = urls_or_func\n if operator.isCallable(urls_or_func):\n rval = urls_or_func(self)\n return rval or []",
"metadata": "root.JobOptions.urls",
"header": "['class', 'JobOptions', '(', 'object', ')', ':', '___EOS___']",
"index": 54
},
{
"content": " def _name(self, tag, delta, start):\n return '%s:%s' % (tag, start + timedelta(days=-delta))",
"metadata": "root.JobOptions._name",
"header": "['class', 'JobOptions', '(', 'object', ')', ':', '___EOS___']",
"index": 65
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"datetime_",
"import_",
"timedelta_",
",_",
"date_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"infer",
"no_",
"._",
"lib_",
"._",
"rule_",
"import_",
"Infer",
"no",
"Rule_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Jo",
"b",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Jo",
"b",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"rule_",
",_",
"settings_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"rule_",
"=_",
"rule_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"settings_",
"=_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Jo",
"b",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"result",
"\\u",
"tag_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"result",
"\\u",
"tag",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"result",
"\\u",
"tag",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"rule_",
"._",
"result",
"\\u",
"tag_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Jo",
"b",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"tags_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u",
"filter",
"\\u",
"rules_",
"(_",
"tags_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"[_",
"tag_",
"for_",
"tag_",
"in_",
"tags_",
"if_",
"not_",
"isinstance_",
"(_",
"tag_",
",_",
"Infer",
"no",
"Rule_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"source",
"\\u",
"tags",
"'_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tags_",
"=_",
"\\u",
"filter",
"\\u",
"rules_",
"(_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"source",
"\\u",
"tags",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tags_",
"=_",
"\\u",
"filter",
"\\u",
"rules_",
"(_",
"self_",
"._",
"rule_",
"._",
"source",
"\\u",
"tags_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"note",
" ",
"tha",
"t",
" ",
"all",
" ",
"day",
" ",
"range",
" ",
"options",
" ",
"are",
" ",
"disable",
"d",
" ",
"if",
" ",
"we",
" ",
"pass",
" ",
"tags",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"on",
" ",
"the",
" ",
"command",
" ",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"count_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"day",
"\\u",
"start",
"'_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"=_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"day",
"\\u",
"start",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"count_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"rule_",
"._",
"day",
"\\u",
"start_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"=_",
"self_",
"._",
"rule_",
"._",
"day",
"\\u",
"start_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"=_",
"date_",
"._",
"today_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"day",
"\\u",
"offset",
"'_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"+=_",
"timedelta_",
"(_",
"days_",
"=_",
"-_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"day",
"\\u",
"offset",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"count_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"+=_",
"timedelta_",
"(_",
"days_",
"=_",
"-_",
"self_",
"._",
"rule_",
"._",
"day",
"\\u",
"offset_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"day",
"\\u",
"range",
"'_",
")_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"count_",
"=_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"day",
"\\u",
"range",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"count_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"count_",
"=_",
"self_",
"._",
"rule_",
"._",
"day",
"\\u",
"range_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"count_",
"and_",
"tags_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tags_",
"=_",
"[_",
"self_",
"._",
"\\u",
"name_",
"(_",
"tag_",
",_",
"day_",
",_",
"start_",
")_",
"for_",
"tag_",
"in_",
"tags_",
"for_",
"day_",
"in_",
"range_",
"(_",
"count_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"tags_",
"or_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Jo",
"b",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"urls_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"operator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"urls",
"\\u",
"or",
"\\u",
"func_",
"=_",
"self_",
"._",
"settings_",
"._",
"get_",
"(_",
"'",
"source",
"\\u",
"urls",
"'_",
")_",
"or_",
"getattr_",
"(_",
"self_",
"._",
"rule_",
",_",
"'",
"source",
"\\u",
"urls",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rval_",
"=_",
"urls",
"\\u",
"or",
"\\u",
"func_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"operator_",
"._",
"is",
"Callable_",
"(_",
"urls",
"\\u",
"or",
"\\u",
"func_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rval_",
"=_",
"urls",
"\\u",
"or",
"\\u",
"func_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"rval_",
"or_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Jo",
"b",
"Options_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"name_",
"(_",
"self_",
",_",
"tag_",
",_",
"delta_",
",_",
"start_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'%",
"s",
":",
"%",
"s",
"'_",
"%_",
"(_",
"tag_",
",_",
"start_",
"+_",
"timedelta_",
"(_",
"days_",
"=_",
"-_",
"delta_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unreachable code | dieseldev/diesel/examples/consolechat.py | [
{
"content": " def input_handler(self):\n nick = thread(self.read_chat_message, \"nick: \").strip()\n self.nick = nick\n self.input.put(nick)\n while True:\n msg = thread(self.read_chat_message, \"\").strip()\n self.input.put(msg)",
"metadata": "root.ChatClient.input_handler",
"header": "['class', 'ChatClient', '(', 'Client', ')', ':', '___EOS___']",
"index": 32
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Cha",
"t",
"Client_",
"(_",
"Client_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"input",
"\\u",
"handler_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"nick_",
"=_",
"thread_",
"(_",
"self_",
"._",
"read",
"\\u",
"chat",
"\\u",
"message_",
",_",
"\"",
"nick",
":",
" ",
"\"_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"nick_",
"=_",
"nick_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"input_",
"._",
"put_",
"(_",
"nick_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"thread_",
"(_",
"self_",
"._",
"read",
"\\u",
"chat",
"\\u",
"message_",
",_",
"\"\"_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"input_",
"._",
"put_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | pennersr/django-allauth/allauth/account/views.py | [
{
"content": " def dispatch(self, request, *args, **kwargs):\n # WORKAROUND: https://code.djangoproject.com/ticket/19316\n self.request = request\n # (end WORKAROUND)\n if request.user.is_authenticated() and \\\n app_settings.AUTHENTICATED_LOGIN_REDIRECTS:\n redirect_to = self.get_authenticated_redirect_url()\n response = HttpResponseRedirect(redirect_to)\n return _ajax_response(request, response)\n else:\n response = super(RedirectAuthenticatedUserMixin,\n self).dispatch(request,\n *args,\n **kwargs)\n return response",
"metadata": "root.RedirectAuthenticatedUserMixin.dispatch",
"header": "['class', 'RedirectAuthenticatedUserMixin', '(', 'object', ')', ':', '___EOS___']",
"index": 52
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Redirect",
"Auth",
"entica",
"ted",
"User",
"Mixin_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"dispatch_",
"(_",
"self_",
",_",
"request_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"WORK",
"AR",
"OUN",
"D",
":",
" ",
"https",
"://",
"code",
".",
"django",
"project",
".",
"com",
"/",
"tick",
"et",
"/",
"193",
"16_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"request_",
"=_",
"request_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"(",
"end",
" ",
"WORK",
"AR",
"OUN",
"D",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"request_",
"._",
"user_",
"._",
"is",
"\\u",
"authenticated_",
"(_",
")_",
"and_",
"app",
"\\u",
"settings_",
"._",
"AUTH",
"ENTI",
"CATE",
"D",
"\\u",
"LOGIN",
"\\u",
"REDIRECT",
"S_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"redirec",
"t",
"\\u",
"to_",
"=_",
"self_",
"._",
"get",
"\\u",
"authenticat",
"ed",
"\\u",
"redirec",
"t",
"\\u",
"url_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"Http",
"Respons",
"e",
"Redirect_",
"(_",
"redirec",
"t",
"\\u",
"to_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u",
"aja",
"x",
"\\u",
"response_",
"(_",
"request_",
",_",
"response_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"super_",
"(_",
"Redirect",
"Auth",
"entica",
"ted",
"User",
"Mixin_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
")_",
"._",
"dispatch_",
"(_",
"request_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"*_",
"args_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"response_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | adieu/django-mediagenerator/mediagenerator/management/commands/importsassframeworks.py | [
{
"content": " def get_framework_paths(self):\n run = ['ruby', PATHS_SCRIPT]\n run.extend(sass.SASS_FRAMEWORKS)\n try:\n cmd = Popen(run, universal_newlines=True,\n stdin=PIPE, stdout=PIPE, stderr=PIPE)\n output, error = cmd.communicate()\n assert cmd.wait() == 0, 'Command returned bad result:\\n%s' % error\n return map(os.path.abspath, filter(None, output.split('\\n')))\n except Exception, e:\n raise ValueError(\"Failed to execute an internal Ruby script. \"\n \"Please make sure that you have installed Ruby \"\n \"(http://ruby-lang.org), Sass (http://sass-lang.com), and \"\n \"Compass (http://compass-style.org).\\n\"\n \"Error was: %s\" % e)",
"metadata": "root.Command.get_framework_paths",
"header": "['class', 'Command', '(', 'NoArgsCommand', ')', ':', '___EOS___']",
"index": 58
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Command_",
"(_",
"No",
"Arg",
"s",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"frame",
"work",
"\\u",
"paths_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"run_",
"=_",
"[_",
"'",
"rub",
"y",
"'_",
",_",
"PATH",
"S",
"\\u",
"SCRIPT_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run_",
"._",
"extend_",
"(_",
"sass",
"_",
"._",
"SAS",
"S",
"\\u",
"FRAME",
"WORKS",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"=_",
"Popen_",
"(_",
"run_",
",_",
"universal",
"\\u",
"newlines_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"stdin_",
"=_",
"PIPE_",
",_",
"stdout_",
"=_",
"PIPE_",
",_",
"stderr_",
"=_",
"PIPE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"output_",
",_",
"error_",
"=_",
"cmd_",
"._",
"communicate_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"cmd_",
"._",
"wait_",
"(_",
")_",
"==_",
"0_",
",_",
"'",
"Command",
" ",
"return",
"ed",
" ",
"bad",
" ",
"result",
":\\\\",
"n",
"%",
"s",
"'_",
"%_",
"error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"map_",
"(_",
"os_",
"._",
"path_",
"._",
"abspath_",
",_",
"filter_",
"(_",
"None_",
",_",
"output_",
"._",
"split_",
"(_",
"'\\\\",
"n",
"'_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Value",
"Error_",
"(_",
"\"",
"Fail",
"ed",
" ",
"to",
" ",
"execute",
" ",
"an",
" ",
"internal",
" ",
"Rub",
"y",
" ",
"script",
".",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Ple",
"ase",
" ",
"make",
" ",
"sure",
" ",
"tha",
"t",
" ",
"you",
" ",
"have",
" ",
"install",
"ed",
" ",
"Rub",
"y",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"(",
"http",
"://",
"rub",
"y",
"-",
"lang",
".",
"org",
"),",
" ",
"Sas",
"s",
" ",
"(",
"http",
"://",
"sass",
"-",
"lang",
".",
"com",
"),",
" ",
"and",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Compa",
"ss",
" ",
"(",
"http",
"://",
"compass",
"-",
"style",
".",
"org",
").",
"\\\\",
"n",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Error",
" ",
"was",
":",
" ",
"%",
"s",
"\"_",
"%_",
"e_",
")_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/libvirt/volume/test_quobyte.py | [
{
"content": "# Copyright (c) 2015 Quobyte Inc.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\"\"\"Unit tests for the Quobyte volume driver module.\"\"\"\n\nimport mock\nimport os\n\nfrom oslo_concurrency import processutils\nfrom oslo_utils import fileutils\n\nfrom nova import exception\nfrom nova import test\nfrom nova.tests.unit.virt.libvirt.volume import test_volume\nfrom nova import utils\nfrom nova.virt.libvirt import utils as libvirt_utils\nfrom nova.virt.libvirt.volume import quobyte\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class QuobyteTestCase(test.NoDBTestCase):\n \"\"\"Tests the nova.virt.libvirt.volume.quobyte module utilities.\"\"\"\n\n\n\n\n\n\n\n\n",
"metadata": "root.QuobyteTestCase",
"header": "['module', '___EOS___']",
"index": 30
},
{
"content": " @mock.patch.object(fileutils, \"ensure_tree\")\n @mock.patch.object(utils, \"execute\")\n def test_quobyte_mount_volume(self, mock_execute, mock_ensure_tree):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n quobyte.mount_volume(quobyte_volume, export_mnt_base)\n\n mock_ensure_tree.assert_called_once_with(export_mnt_base)\n expected_commands = [mock.call('mount.quobyte',\n quobyte_volume,\n export_mnt_base,\n check_exit_code=[0, 4])\n ]\n mock_execute.assert_has_calls(expected_commands)",
"metadata": "root.QuobyteTestCase.test_quobyte_mount_volume",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " @mock.patch.object(fileutils, \"ensure_tree\")\n @mock.patch.object(utils, \"execute\")\n def test_quobyte_mount_volume_with_config(self,\n mock_execute,\n mock_ensure_tree):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n config_file_dummy = \"/etc/quobyte/dummy.conf\"\n\n quobyte.mount_volume(quobyte_volume,\n export_mnt_base,\n config_file_dummy)\n\n mock_ensure_tree.assert_called_once_with(export_mnt_base)\n expected_commands = [mock.call('mount.quobyte',\n quobyte_volume,\n export_mnt_base,\n '-c',\n config_file_dummy,\n check_exit_code=[0, 4])\n ]\n mock_execute.assert_has_calls(expected_commands)",
"metadata": "root.QuobyteTestCase.test_quobyte_mount_volume_with_config",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " @mock.patch.object(fileutils, \"ensure_tree\")\n @mock.patch.object(utils, \"execute\",\n side_effect=(processutils.\n ProcessExecutionError))\n def test_quobyte_mount_volume_fails(self, mock_execute, mock_ensure_tree):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n self.assertRaises(processutils.ProcessExecutionError,\n quobyte.mount_volume,\n quobyte_volume,\n export_mnt_base)",
"metadata": "root.QuobyteTestCase.test_quobyte_mount_volume_fails",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 76
},
{
"content": " @mock.patch.object(utils, \"execute\")\n def test_quobyte_umount_volume(self, mock_execute):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n quobyte.umount_volume(export_mnt_base)\n\n mock_execute.assert_called_once_with('umount.quobyte',\n export_mnt_base)",
"metadata": "root.QuobyteTestCase.test_quobyte_umount_volume",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 91
},
{
"content": " @mock.patch.object(quobyte.LOG, \"error\")\n @mock.patch.object(utils, \"execute\")\n def test_quobyte_umount_volume_warns(self,\n mock_execute,\n mock_debug):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n def exec_side_effect(*cmd, **kwargs):\n exerror = processutils.ProcessExecutionError(\n \"Device or resource busy\")\n raise exerror\n mock_execute.side_effect = exec_side_effect\n\n quobyte.umount_volume(export_mnt_base)\n\n (mock_debug.\n assert_called_once_with(\"The Quobyte volume at %s is still in use.\",\n export_mnt_base))",
"metadata": "root.QuobyteTestCase.test_quobyte_umount_volume_warns",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 103
},
{
"content": " @mock.patch.object(quobyte.LOG, \"exception\")\n @mock.patch.object(utils, \"execute\",\n side_effect=(processutils.ProcessExecutionError))\n def test_quobyte_umount_volume_fails(self,\n mock_execute,\n mock_exception):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n quobyte.umount_volume(export_mnt_base)\n\n (mock_exception.\n assert_called_once_with(\"Couldn't unmount \"\n \"the Quobyte Volume at %s\",\n export_mnt_base))",
"metadata": "root.QuobyteTestCase.test_quobyte_umount_volume_fails",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 125
},
{
"content": " @mock.patch.object(os, \"access\", return_value=True)\n @mock.patch.object(utils, \"execute\")\n def test_quobyte_is_valid_volume(self, mock_execute, mock_access):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n quobyte.validate_volume(export_mnt_base)\n\n mock_execute.assert_called_once_with('getfattr',\n '-n',\n 'quobyte.info',\n export_mnt_base)",
"metadata": "root.QuobyteTestCase.test_quobyte_is_valid_volume",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 143
},
{
"content": " @mock.patch.object(utils, \"execute\",\n side_effect=(processutils.\n ProcessExecutionError))\n def test_quobyte_is_valid_volume_vol_not_valid_volume(self, mock_execute):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n self.assertRaises(exception.NovaException,\n quobyte.validate_volume,\n export_mnt_base)",
"metadata": "root.QuobyteTestCase.test_quobyte_is_valid_volume_vol_not_valid_volume",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 158
},
{
"content": " @mock.patch.object(os, \"access\", return_value=False)\n @mock.patch.object(utils, \"execute\",\n side_effect=(processutils.\n ProcessExecutionError))\n def test_quobyte_is_valid_volume_vol_no_valid_access(self,\n mock_execute,\n mock_access):\n mnt_base = '/mnt'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n self.assertRaises(exception.NovaException,\n quobyte.validate_volume,\n export_mnt_base)",
"metadata": "root.QuobyteTestCase.test_quobyte_is_valid_volume_vol_no_valid_access",
"header": "['class', 'QuobyteTestCase', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']",
"index": 171
},
{
"content": "class LibvirtQuobyteVolumeDriverTestCase(\n test_volume.LibvirtVolumeBaseTestCase):\n \"\"\"Tests the LibvirtQuobyteVolumeDriver class.\"\"\"\n\n\n\n\n\n\n",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase",
"header": "['module', '___EOS___']",
"index": 188
},
{
"content": " @mock.patch.object(quobyte, 'validate_volume')\n @mock.patch.object(quobyte, 'mount_volume')\n @mock.patch.object(libvirt_utils, 'is_mounted', return_value=False)\n def test_libvirt_quobyte_driver_mount(self,\n mock_is_mounted,\n mock_mount_volume,\n mock_validate_volume\n ):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = 'quobyte://192.168.1.1/volume-00001'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n file_path = os.path.join(export_mnt_base, self.name)\n\n connection_info = {'data': {'export': export_string,\n 'name': self.name}}\n libvirt_driver.connect_volume(connection_info, self.disk_info)\n\n conf = libvirt_driver.get_config(connection_info, self.disk_info)\n tree = conf.format_dom()\n\n self._assertFileTypeEquals(tree, file_path)\n\n mock_mount_volume.assert_called_once_with(quobyte_volume,\n export_mnt_base,\n mock.ANY)\n mock_validate_volume.assert_called_with(export_mnt_base)",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_mount",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 192
},
{
"content": " @mock.patch.object(quobyte, 'validate_volume')\n @mock.patch.object(quobyte, 'umount_volume')\n @mock.patch.object(libvirt_utils, 'is_mounted', return_value=True)\n def test_libvirt_quobyte_driver_umount(self, mock_is_mounted,\n mock_umount_volume,\n mock_validate_volume):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = 'quobyte://192.168.1.1/volume-00001'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n file_path = os.path.join(export_mnt_base, self.name)\n\n connection_info = {'data': {'export': export_string,\n 'name': self.name}}\n libvirt_driver.connect_volume(connection_info, self.disk_info)\n\n conf = libvirt_driver.get_config(connection_info, self.disk_info)\n tree = conf.format_dom()\n self._assertFileTypeEquals(tree, file_path)\n\n libvirt_driver.disconnect_volume(connection_info, \"vde\")\n\n mock_validate_volume.assert_called_once_with(export_mnt_base)\n mock_umount_volume.assert_called_once_with(export_mnt_base)",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_umount",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 224
},
{
"content": " @mock.patch.object(quobyte, 'validate_volume')\n @mock.patch.object(quobyte, 'umount_volume')\n def test_libvirt_quobyte_driver_already_mounted(self,\n mock_umount_volume,\n mock_validate_volume\n ):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = 'quobyte://192.168.1.1/volume-00001'\n quobyte_volume = '192.168.1.1/volume-00001'\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n file_path = os.path.join(export_mnt_base, self.name)\n\n connection_info = {'data': {'export': export_string,\n 'name': self.name}}\n\n libvirt_driver.connect_volume(connection_info, self.disk_info)\n\n conf = libvirt_driver.get_config(connection_info, self.disk_info)\n tree = conf.format_dom()\n self._assertFileTypeEquals(tree, file_path)\n libvirt_driver.disconnect_volume(connection_info, \"vde\")\n\n expected_commands = [\n ('findmnt', '--target', export_mnt_base,\n '--source', \"quobyte@\" + quobyte_volume),\n ('findmnt', '--target', export_mnt_base,\n '--source', \"quobyte@\" + quobyte_volume),\n ]\n self.assertEqual(expected_commands, self.executes)\n\n mock_umount_volume.assert_called_once_with(export_mnt_base)\n mock_validate_volume.assert_called_once_with(export_mnt_base)",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_already_mounted",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 253
},
{
"content": " @mock.patch.object(quobyte, 'validate_volume')\n @mock.patch.object(quobyte, 'mount_volume')\n @mock.patch.object(libvirt_utils, 'is_mounted', return_value=False)\n def test_libvirt_quobyte_driver_qcow2(self, mock_is_mounted,\n mock_mount_volume,\n mock_validate_volume\n ):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = 'quobyte://192.168.1.1/volume-00001'\n name = 'volume-00001'\n image_format = 'qcow2'\n quobyte_volume = '192.168.1.1/volume-00001'\n\n connection_info = {'data': {'export': export_string,\n 'name': name,\n 'format': image_format}}\n\n export_mnt_base = os.path.join(mnt_base,\n utils.get_hash_str(quobyte_volume))\n\n libvirt_driver.connect_volume(connection_info, self.disk_info)\n conf = libvirt_driver.get_config(connection_info, self.disk_info)\n tree = conf.format_dom()\n self.assertEqual('file', tree.get('type'))\n self.assertEqual('qcow2', tree.find('./driver').get('type'))\n\n (mock_mount_volume.\n assert_called_once_with('192.168.1.1/volume-00001',\n export_mnt_base,\n mock.ANY))\n mock_validate_volume.assert_called_with(export_mnt_base)\n\n libvirt_driver.disconnect_volume(connection_info, \"vde\")",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_qcow2",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 290
},
{
"content": " def test_libvirt_quobyte_driver_mount_non_quobyte_volume(self):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = 'quobyte://192.168.1.1/volume-00001'\n\n connection_info = {'data': {'export': export_string,\n 'name': self.name}}\n\n def exe_side_effect(*cmd, **kwargs):\n if cmd == mock.ANY:\n raise exception.NovaException()\n\n with mock.patch.object(quobyte,\n 'validate_volume') as mock_execute:\n mock_execute.side_effect = exe_side_effect\n self.assertRaises(exception.NovaException,\n libvirt_driver.connect_volume,\n connection_info,\n self.disk_info)",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_mount_non_quobyte_volume",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 326
},
{
"content": " def test_libvirt_quobyte_driver_normalize_export_with_protocol(self):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = 'quobyte://192.168.1.1/volume-00001'\n self.assertEqual(\"192.168.1.1/volume-00001\",\n libvirt_driver._normalize_export(export_string))",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_normalize_export_with_protocol",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 348
},
{
"content": " def test_libvirt_quobyte_driver_normalize_export_without_protocol(self):\n mnt_base = '/mnt'\n self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')\n\n libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)\n export_string = '192.168.1.1/volume-00001'\n self.assertEqual(\"192.168.1.1/volume-00001\",\n libvirt_driver._normalize_export(export_string))",
"metadata": "root.LibvirtQuobyteVolumeDriverTestCase.test_libvirt_quobyte_driver_normalize_export_without_protocol",
"header": "['class', 'LibvirtQuobyteVolumeDriverTestCase', '(', '___NL___', 'test_volume', '.', 'LibvirtVolumeBaseTestCase', ')', ':', '___EOS___']",
"index": 357
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"201",
"5",
" ",
"Qu",
"ob",
"yte",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Unit",
" ",
"tests",
" ",
"for",
" ",
"the",
" ",
"Qu",
"ob",
"yte",
" ",
"volume",
" ",
"driver",
" ",
"module",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"oslo",
"\\u",
"concurrency",
"_",
"import_",
"process",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"oslo",
"\\u",
"utils_",
"import_",
"fileu",
"tils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"nova_",
"import_",
"exception_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nova_",
"import_",
"test_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nova_",
"._",
"tests_",
"._",
"unit_",
"._",
"virt_",
"._",
"libvirt_",
"._",
"volume_",
"import_",
"test\\u",
"volume_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nova_",
"import_",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nova_",
"._",
"virt_",
"._",
"libvirt_",
"import_",
"utils_",
"as_",
"libvi",
"rt",
"\\u",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nova_",
"._",
"virt_",
"._",
"libvirt_",
"._",
"volume_",
"import_",
"quo",
"byte_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Test",
"s",
" ",
"the",
" ",
"nova",
".",
"virt",
".",
"libvi",
"rt",
".",
"volume",
".",
"quo",
"byte",
" ",
"module",
" ",
"util",
"iti",
"es",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"fileu",
"tils_",
",_",
"\"",
"ensure",
"\\u",
"tree",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"volume_",
"(_",
"self_",
",_",
"mock",
"\\u",
"execute_",
",_",
"mock",
"\\u",
"ensure",
"\\u",
"tree_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"mount",
"\\u",
"volume_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
",_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"ensure",
"\\u",
"tree_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"commands_",
"=_",
"[_",
"mock_",
"._",
"call_",
"(_",
"'",
"mount",
".",
"quo",
"byte",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"check",
"\\u",
"exit",
"\\u",
"code_",
"=_",
"[_",
"0_",
",_",
"4_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"execute_",
"._",
"assert",
"\\u",
"has",
"\\u",
"calls_",
"(_",
"expected",
"\\u",
"commands_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"fileu",
"tils_",
",_",
"\"",
"ensure",
"\\u",
"tree",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"volume",
"\\u",
"with",
"\\u",
"config_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"execute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"ensure",
"\\u",
"tree_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"config",
"\\u",
"file",
"\\u",
"dummy_",
"=_",
"\"/",
"etc",
"/",
"quo",
"byte",
"/",
"dummy",
".",
"conf",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"mount",
"\\u",
"volume_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"config",
"\\u",
"file",
"\\u",
"dummy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"ensure",
"\\u",
"tree_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected",
"\\u",
"commands_",
"=_",
"[_",
"mock_",
"._",
"call_",
"(_",
"'",
"mount",
".",
"quo",
"byte",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"c",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"config",
"\\u",
"file",
"\\u",
"dummy_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"check",
"\\u",
"exit",
"\\u",
"code_",
"=_",
"[_",
"0_",
",_",
"4_",
"]_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"execute_",
"._",
"assert",
"\\u",
"has",
"\\u",
"calls_",
"(_",
"expected",
"\\u",
"commands_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"fileu",
"tils_",
",_",
"\"",
"ensure",
"\\u",
"tree",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"side",
"\\u",
"effect_",
"=_",
"(_",
"process",
"utils_",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"Process",
"Execut",
"ion",
"Error_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"volume",
"\\u",
"fails_",
"(_",
"self_",
",_",
"mock",
"\\u",
"execute_",
",_",
"mock",
"\\u",
"ensure",
"\\u",
"tree_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"process",
"utils_",
"._",
"Process",
"Execut",
"ion",
"Error_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"mount",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"umount",
"\\u",
"volume_",
"(_",
"self_",
",_",
"mock",
"\\u",
"execute_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"umount",
"\\u",
"volume_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"execute_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"'",
"umount",
".",
"quo",
"byte",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
"._",
"LOG_",
",_",
"\"",
"error",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"umount",
"\\u",
"volume",
"\\u",
"warns",
"_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"execute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"debug_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"exec",
"\\u",
"side",
"\\u",
"effect_",
"(_",
"*_",
"cmd_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exe",
"rror_",
"=_",
"process",
"utils_",
"._",
"Process",
"Execut",
"ion",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Dev",
"ice",
" ",
"or",
" ",
"resource",
" ",
"bus",
"y",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"exe",
"rror_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mock",
"\\u",
"execute_",
"._",
"side",
"\\u",
"effect_",
"=_",
"exec",
"\\u",
"side",
"\\u",
"effect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"umount",
"\\u",
"volume_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"mock",
"\\u",
"debug_",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"\"",
"The",
" ",
"Qu",
"ob",
"yte",
" ",
"volume",
" ",
"at",
" ",
"%",
"s",
" ",
"is",
" ",
"still",
" ",
"in",
" ",
"use",
".\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
"._",
"LOG_",
",_",
"\"",
"exception",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"side",
"\\u",
"effect_",
"=_",
"(_",
"process",
"utils_",
"._",
"Process",
"Execut",
"ion",
"Error_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"umount",
"\\u",
"volume",
"\\u",
"fails_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"execute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"umount",
"\\u",
"volume_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"mock",
"\\u",
"exception_",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"\"",
"Cou",
"ld",
"n",
"'",
"t",
" ",
"unmo",
"unt",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"the",
" ",
"Qu",
"ob",
"yte",
" ",
"Volume",
" ",
"at",
" ",
"%",
"s",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"os_",
",_",
"\"",
"access",
"\"_",
",_",
"return",
"\\u",
"value_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"is",
"\\u",
"valid",
"\\u",
"volume_",
"(_",
"self_",
",_",
"mock",
"\\u",
"execute_",
",_",
"mock",
"\\u",
"access_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"validat",
"e\\u",
"volume_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"execute_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"'",
"getf",
"attr",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quo",
"byte",
".",
"info",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"side",
"\\u",
"effect_",
"=_",
"(_",
"process",
"utils_",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"Process",
"Execut",
"ion",
"Error_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"is",
"\\u",
"valid",
"\\u",
"volume",
"\\u",
"vol",
"\\u",
"not",
"\\u",
"valid",
"\\u",
"volume_",
"(_",
"self_",
",_",
"mock",
"\\u",
"execute_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"exception_",
"._",
"Nov",
"a",
"Exception_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"validat",
"e\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qu",
"ob",
"yte",
"Test",
"Case_",
"(_",
"test_",
"._",
"No",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"os_",
",_",
"\"",
"access",
"\"_",
",_",
"return",
"\\u",
"value_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"utils_",
",_",
"\"",
"execute",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"side",
"\\u",
"effect_",
"=_",
"(_",
"process",
"utils_",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"Process",
"Execut",
"ion",
"Error_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"quo",
"byte",
"\\u",
"is",
"\\u",
"valid",
"\\u",
"volume",
"\\u",
"vol",
"\\u",
"no",
"\\u",
"valid",
"\\u",
"access_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"execute_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"access_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"exception_",
"._",
"Nov",
"a",
"Exception_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quo",
"byte_",
"._",
"validat",
"e\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Test",
"s",
" ",
"the",
" ",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
" ",
"class",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"validat",
"e\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"mount",
"\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"libvi",
"rt",
"\\u",
"utils_",
",_",
"'",
"is",
"\\u",
"mounte",
"d",
"'_",
",_",
"return",
"\\u",
"value_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"mount_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"is",
"\\u",
"mounte",
"d_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"mount",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"quo",
"byte",
"://",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"file",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"connecti",
"on",
"\\u",
"info_",
"=_",
"{_",
"'",
"data",
"'_",
":_",
"{_",
"'",
"export",
"'_",
":_",
"export",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"self_",
"._",
"name_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"connect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"conf_",
"=_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"get",
"\\u",
"config_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tree_",
"=_",
"conf_",
"._",
"format\\u",
"dom_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"assert",
"File",
"Type",
"Equals_",
"(_",
"tree_",
",_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"mount",
"\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"._",
"ANY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"validat",
"e\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"umount",
"\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"libvi",
"rt",
"\\u",
"utils_",
",_",
"'",
"is",
"\\u",
"mounte",
"d",
"'_",
",_",
"return",
"\\u",
"value_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"umount",
"_",
"(_",
"self_",
",_",
"mock",
"\\u",
"is",
"\\u",
"mounte",
"d_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"umount",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"quo",
"byte",
"://",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"file",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"connecti",
"on",
"\\u",
"info_",
"=_",
"{_",
"'",
"data",
"'_",
":_",
"{_",
"'",
"export",
"'_",
":_",
"export",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"self_",
"._",
"name_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"connect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"conf_",
"=_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"get",
"\\u",
"config_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tree_",
"=_",
"conf_",
"._",
"format\\u",
"dom_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"assert",
"File",
"Type",
"Equals_",
"(_",
"tree_",
",_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"discon",
"nect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"\"",
"vde",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"umount",
"\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"validat",
"e\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"umount",
"\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"alr",
"ead",
"y",
"\\u",
"mounte",
"d_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"umount",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"quo",
"byte",
"://",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"file",
"\\u",
"path_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"self_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"connecti",
"on",
"\\u",
"info_",
"=_",
"{_",
"'",
"data",
"'_",
":_",
"{_",
"'",
"export",
"'_",
":_",
"export",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"self_",
"._",
"name_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"connect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"conf_",
"=_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"get",
"\\u",
"config_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tree_",
"=_",
"conf_",
"._",
"format\\u",
"dom_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"assert",
"File",
"Type",
"Equals_",
"(_",
"tree_",
",_",
"file",
"\\u",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"discon",
"nect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"\"",
"vde",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected",
"\\u",
"commands_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"find",
"mnt",
"'_",
",_",
"'--",
"target",
"'_",
",_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"source",
"'_",
",_",
"\"",
"quo",
"byte",
"@\"_",
"+_",
"quo",
"byte",
"\\u",
"volume_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"'",
"find",
"mnt",
"'_",
",_",
"'--",
"target",
"'_",
",_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"source",
"'_",
",_",
"\"",
"quo",
"byte",
"@\"_",
"+_",
"quo",
"byte",
"\\u",
"volume_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected",
"\\u",
"commands_",
",_",
"self_",
"._",
"execute",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"umount",
"\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"validat",
"e\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"'",
"mount",
"\\u",
"volume",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"libvi",
"rt",
"\\u",
"utils_",
",_",
"'",
"is",
"\\u",
"mounte",
"d",
"'_",
",_",
"return",
"\\u",
"value_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"qcow",
"2_",
"(_",
"self_",
",_",
"mock",
"\\u",
"is",
"\\u",
"mounte",
"d_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"mount",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"quo",
"byte",
"://",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"'",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"image",
"\\u",
"format_",
"=_",
"'",
"qcow",
"2",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"quo",
"byte",
"\\u",
"volume_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"connecti",
"on",
"\\u",
"info_",
"=_",
"{_",
"'",
"data",
"'_",
":_",
"{_",
"'",
"export",
"'_",
":_",
"export",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"format",
"'_",
":_",
"image",
"\\u",
"format_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"utils_",
"._",
"get",
"\\u",
"hash",
"\\u",
"str_",
"(_",
"quo",
"byte",
"\\u",
"volume_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"connect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"=_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"get",
"\\u",
"config_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tree_",
"=_",
"conf_",
"._",
"format\\u",
"dom_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"file",
"'_",
",_",
"tree_",
"._",
"get_",
"(_",
"'",
"type",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"qcow",
"2",
"'_",
",_",
"tree_",
"._",
"find_",
"(_",
"'./",
"driver",
"'_",
")_",
"._",
"get_",
"(_",
"'",
"type",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"mock",
"\\u",
"mount",
"\\u",
"volume_",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"._",
"ANY_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"validat",
"e\\u",
"volume_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"with_",
"(_",
"export",
"\\u",
"mnt",
"\\u",
"base_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"discon",
"nect",
"\\u",
"volume_",
"(_",
"connecti",
"on",
"\\u",
"info_",
",_",
"\"",
"vde",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"mount",
"\\u",
"non",
"\\u",
"quo",
"byte",
"\\u",
"volume_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"quo",
"byte",
"://",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"connecti",
"on",
"\\u",
"info_",
"=_",
"{_",
"'",
"data",
"'_",
":_",
"{_",
"'",
"export",
"'_",
":_",
"export",
"\\u",
"string_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"self_",
"._",
"name_",
"}_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"exe",
"\\u",
"side",
"\\u",
"effect_",
"(_",
"*_",
"cmd_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"cmd_",
"==_",
"mock_",
"._",
"ANY_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"exception_",
"._",
"Nov",
"a",
"Exception_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"quo",
"byte_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"validat",
"e\\u",
"volume",
"'_",
")_",
"as_",
"mock",
"\\u",
"execute_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mock",
"\\u",
"execute_",
"._",
"side",
"\\u",
"effect_",
"=_",
"exe",
"\\u",
"side",
"\\u",
"effect_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"exception_",
"._",
"Nov",
"a",
"Exception_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"connect",
"\\u",
"volume_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"connecti",
"on",
"\\u",
"info_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"disk",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"normali",
"ze",
"\\u",
"export",
"\\u",
"with",
"\\u",
"protocol_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"quo",
"byte",
"://",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"\\u",
"normali",
"ze",
"\\u",
"export_",
"(_",
"export",
"\\u",
"string_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Drive",
"r",
"Test",
"Case_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"volume_",
"._",
"Lib",
"virt",
"Volume",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"libvi",
"rt",
"\\u",
"quo",
"byte",
"\\u",
"driver",
"\\u",
"normali",
"ze",
"\\u",
"export",
"\\u",
"with",
"out",
"\\u",
"protocol_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mnt",
"\\u",
"base_",
"=_",
"'/",
"mnt",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"flags_",
"(_",
"quo",
"byte",
"\\u",
"mount",
"\\u",
"point",
"\\u",
"base_",
"=_",
"mnt",
"\\u",
"base_",
",_",
"group_",
"=_",
"'",
"libvi",
"rt",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"=_",
"quo",
"byte_",
"._",
"Lib",
"virt",
"Qu",
"ob",
"yte",
"Volume",
"Driver_",
"(_",
"self_",
"._",
"fake",
"\\u",
"conn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"export",
"\\u",
"string_",
"=_",
"'",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"192",
".1",
"68.",
"1.1",
"/",
"volume",
"-0",
"0001",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"libvi",
"rt",
"\\u",
"driver_",
"._",
"\\u",
"normali",
"ze",
"\\u",
"export_",
"(_",
"export",
"\\u",
"string_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | RobotLocomotion/director/src/python/director/handdriver.py | [
{
"content": " def sendDrop(self):\n msg = lcmrobotiq.command_t()\n msg.utime = getUtime()\n msg.activate = 1\n msg.emergency_release = 1\n msg.do_move = 0\n msg.mode = 0\n msg.position = 0\n msg.force = 0\n msg.velocity = 0\n channel = 'ROBOTIQ_%s_COMMAND' % self.side.upper()\n lcmUtils.publish(channel, msg)",
"metadata": "root.RobotiqHandDriver.sendDrop",
"header": "['class', 'RobotiqHandDriver', '(', 'object', ')', ':', '___EOS___']",
"index": 85
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Robot",
"iq",
"Hand",
"Driver_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send",
"Drop",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"lcm",
"robot",
"iq_",
"._",
"command",
"\\u",
"t_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"utime",
"_",
"=_",
"get",
"Ut",
"ime_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"activate_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"emergency",
"\\u",
"release_",
"=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"do",
"\\u",
"move_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"mode_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"position_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"force_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"msg_",
"._",
"velocity_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"channel_",
"=_",
"'",
"ROB",
"OT",
"IQ",
"\\u",
"%",
"s",
"\\u",
"COMMA",
"ND",
"'_",
"%_",
"self_",
"._",
"side_",
"._",
"upper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lcm",
"Utils_",
"._",
"publish_",
"(_",
"channel_",
",_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | ionelmc/python-hunter/src/hunter/event.py | [
{
"content": "from __future__ import absolute_import\n\nimport linecache\nimport re\nimport tokenize\nimport weakref\nfrom functools import partial\nfrom threading import current_thread\n\nfrom fields import Fields\n\nfrom .const import SITE_PACKAGES_PATHS\nfrom .const import SYS_PREFIX_PATHS\nfrom .util import cached_property\n\ntry:\n from threading import main_thread\nexcept ImportError:\n from threading import _shutdown\n get_main_thread = weakref.ref(\n _shutdown.__self__ if hasattr(_shutdown, '__self__') else _shutdown.im_self)\n del _shutdown\nelse:\n get_main_thread = weakref.ref(main_thread())\n\n__all__ = 'Event',\n\nSTARTSWITH_TYPES = list, tuple, set\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": " @cached_property\n def fullsource(self):\n \"\"\"\n A string with the sourcecode for the current statement (from ``linecache`` - failures are ignored).\n\n May include multiple lines if it's a class/function definition (will include decorators).\n \"\"\"\n try:\n return self._raw_fullsource\n except Exception as exc:\n return \"??? NO SOURCE: {!r}\".format(exc)",
"metadata": "root.Event.fullsource",
"header": "['class', 'Event', '(', 'Fields', '.', 'kind', '.', 'function', '.', 'module', '.', 'filename', ')', ':', '___EOS___']",
"index": 155
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"linec",
"ache_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"tokenize_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"weakref_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"functools_",
"import_",
"partial_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"threading_",
"import_",
"current",
"\\u",
"thread_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"fields_",
"import_",
"Fields_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"._",
"const_",
"import_",
"SITE",
"\\u",
"PACKAGES",
"\\u",
"PATHS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"const_",
"import_",
"SYS",
"\\u",
"PREF",
"IX",
"\\u",
"PATHS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"util_",
"import_",
"cache",
"d\\u",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"threading_",
"import_",
"main",
"\\u",
"thread_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"threading_",
"import_",
"\\u",
"shutdown_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"get",
"\\u",
"main",
"\\u",
"thread_",
"=_",
"weakref_",
"._",
"ref_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u",
"shutdown_",
"._",
"\\u\\u",
"self",
"\\u\\u_",
"if_",
"hasattr_",
"(_",
"\\u",
"shutdown_",
",_",
"'\\u",
"\\u",
"self",
"\\u\\u'_",
")_",
"else_",
"\\u",
"shutdown_",
"._",
"im",
"\\u",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"\\u",
"shutdown_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"get",
"\\u",
"main",
"\\u",
"thread_",
"=_",
"weakref_",
"._",
"ref_",
"(_",
"main",
"\\u",
"thread_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"'",
"Event",
"'_",
",_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"START",
"SWI",
"TH",
"\\u",
"TYPES_",
"=_",
"list_",
",_",
"tuple_",
",_",
"set_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"class_",
"Event_",
"(_",
"Fields_",
"._",
"kind_",
"._",
"function_",
"._",
"module_",
"._",
"filename_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"cache",
"d\\u",
"property_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"fulls",
"ource_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"string",
" ",
"with",
" ",
"the",
" ",
"source",
"code",
" ",
"for",
" ",
"the",
" ",
"current",
" ",
"statem",
"ent",
" ",
"(",
"from",
" ",
"``",
"linec",
"ache",
"``",
" ",
"-",
" ",
"fail",
"ure",
"s",
" ",
"are",
" ",
"ignore",
"d",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ma",
"y",
" ",
"include",
" ",
"multiple",
" ",
"lines",
" ",
"if",
" ",
"it",
"'",
"s",
" ",
"a",
" ",
"class",
"/",
"function",
" ",
"definit",
"ion",
" ",
"(",
"will",
" ",
"include",
" ",
"decorat",
"ors",
").",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"raw",
"\\u",
"fulls",
"ource_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"exc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"?",
"??",
" ",
"NO",
" ",
"SOU",
"RC",
"E",
":",
" ",
"{",
"!",
"r",
"}\"_",
"._",
"format_",
"(_",
"exc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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unobraga/termsaver/termsaverlib/i18n.py | [
{
"content": "###############################################################################\n#\n# file: i18n.py\n#\n# Purpose: refer to python doc for documentation details.\n#\n# Note: This file is part of Termsaver application, and should not be used\n# or executed separately.\n#\n###############################################################################\n#\n# Copyright 2012 Termsaver\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n#\n###############################################################################\n\"\"\"\nHandles all internationalization (i18n) functionality for termsaver application\n\"\"\"\n\n#\n# Python build-in modules\n#\nimport gettext\n\n#\n# Internal modules\n#\nfrom termsaverlib import constants\n\n_ = None\n\"\"\"\nThe unicode text dealer for i18n stuff, renamed as an underscore to keep same\nstandards used by gettext.\n\"\"\"\n\n\n\n#\n# Call the default (termsaver app name)\n# \n_ = set_app(constants.App.NAME)\n#\n# This should be overriden by plugins, as they can have their own i18n files\n#",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def set_app(application_name):\n \"\"\"\n Defines the application name for the binding text files.\n \"\"\"\n result = None\n\n try:\n gettext.textdomain(application_name)\n result = gettext.gettext\n except:\n #\n # If we can not handle i18n, just deal with text as it is\n #\n result = lambda x: x\n \n # For debugging\n #raise\n\n return result",
"metadata": "root.set_app",
"header": "['module', '___EOS___']",
"index": 47
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"file",
":",
" ",
"i18n",
".",
"py_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pur",
"pose",
":",
" ",
" ",
"refer",
" ",
"to",
" ",
"python",
" ",
"doc",
" ",
"for",
" ",
"documentation",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Not",
"e",
":",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"part",
" ",
"of",
" ",
"Term",
"saver",
" ",
"applica",
"tion",
",",
" ",
"and",
" ",
"shou",
"ld",
" ",
"not",
" ",
"be",
" ",
"used_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
"or",
" ",
"executed",
" ",
"separately",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2012",
" ",
"Term",
"saver_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Handle",
"s",
" ",
"all",
" ",
"international",
"izatio",
"n",
" ",
"(",
"i18n",
")",
" ",
"functional",
"it",
"y",
" ",
"for",
" ",
"term",
"saver",
" ",
"applica",
"tion",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Pyth",
"on",
" ",
"build",
"-",
"in",
" ",
"modules_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"gettext_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Intern",
"al",
" ",
"modules_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"term",
"saver",
"lib_",
"import_",
"constants_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"The",
" ",
"unicode",
" ",
"text",
" ",
"dealer",
" ",
"for",
" ",
"i18n",
" ",
"stu",
"ff",
",",
" ",
"renamed",
" ",
"as",
" ",
"an",
" ",
"underscore",
" ",
"to",
" ",
"keep",
" ",
"same",
"\\",
"10",
";",
"standard",
"s",
" ",
"used",
" ",
"by",
" ",
"gettext",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Call",
" ",
"the",
" ",
"default",
" ",
"(",
"term",
"saver",
" ",
"app",
" ",
"name",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" _",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u_",
"=_",
"set\\u",
"app_",
"(_",
"constants_",
"._",
"App_",
"._",
"NAME_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"shou",
"ld",
" ",
"be",
" ",
"override",
"n",
" ",
"by",
" ",
"plugin",
"s",
",",
" ",
"as",
" ",
"the",
"y",
" ",
"can",
" ",
"have",
" ",
"thei",
"r",
" ",
"own",
" ",
"i18n",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"set\\u",
"app_",
"(_",
"applica",
"tion",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Define",
"s",
" ",
"the",
" ",
"applica",
"tion",
" ",
"name",
" ",
"for",
" ",
"the",
" ",
"bindi",
"ng",
" ",
"text",
" ",
"files",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gettext_",
"._",
"textd",
"omain",
"_",
"(_",
"applica",
"tion",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"gettext_",
"._",
"gettext_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"If",
" ",
"we",
" ",
"can",
" ",
"not",
" ",
"handle",
" ",
"i18n",
",",
" ",
"just",
" ",
"deal",
" ",
"with",
" ",
"text",
" ",
"as",
" ",
"it",
" ",
"is_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"For",
" ",
"debugg",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"raise_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | pinax/symposion/symposion/utils/mail.py | [
{
"content": "from django.conf import settings\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import render_to_string\nfrom django.utils.html import strip_tags\n\nfrom django.contrib.sites.models import Site\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def send_email(to, kind, **kwargs):\n\n current_site = Site.objects.get_current()\n\n ctx = {\n \"current_site\": current_site,\n \"STATIC_URL\": settings.STATIC_URL,\n }\n ctx.update(kwargs.get(\"context\", {}))\n subject = \"[%s] %s\" % (\n current_site.name,\n render_to_string(\"symposion/emails/%s/subject.txt\" % kind, ctx).strip()\n )\n\n message_html = render_to_string(\"symposion/emails/%s/message.html\" % kind, ctx)\n message_plaintext = strip_tags(message_html)\n\n from_email = settings.DEFAULT_FROM_EMAIL\n\n email = EmailMultiAlternatives(subject, message_plaintext, from_email, to)\n email.attach_alternative(message_html, \"text/html\")\n email.send()",
"metadata": "root.send_email",
"header": "['module', '___EOS___']",
"index": 8
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"mail_",
"import_",
"Ema",
"il",
"Multi",
"Alternative",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"._",
"loader_",
"import_",
"render",
"\\u",
"to",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"html_",
"import_",
"strip",
"\\u",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"._",
"sites_",
"._",
"models_",
"import_",
"Site_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"send",
"\\u",
"email_",
"(_",
"to_",
",_",
"kind_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"current",
"\\u",
"site_",
"=_",
"Site_",
"._",
"objects_",
"._",
"get",
"\\u",
"current_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"ctx_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"current",
"\\u",
"site",
"\"_",
":_",
"current",
"\\u",
"site_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"STATI",
"C",
"\\u",
"URL",
"\"_",
":_",
"settings_",
"._",
"STATI",
"C",
"\\u",
"URL_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ctx_",
"._",
"update_",
"(_",
"kwargs_",
"._",
"get_",
"(_",
"\"",
"context",
"\"_",
",_",
"{_",
"}_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subject_",
"=_",
"\"[",
"%",
"s",
"]",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"current",
"\\u",
"site_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"\"",
"symp",
"osi",
"on",
"/",
"email",
"s",
"/",
"%",
"s",
"/",
"subject",
".",
"txt",
"\"_",
"%_",
"kind_",
",_",
"ctx_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"message",
"\\u",
"html_",
"=_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"\"",
"symp",
"osi",
"on",
"/",
"email",
"s",
"/",
"%",
"s",
"/",
"message",
".",
"html",
"\"_",
"%_",
"kind_",
",_",
"ctx_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"plaintext_",
"=_",
"strip",
"\\u",
"tags_",
"(_",
"message",
"\\u",
"html_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from",
"\\u",
"email_",
"=_",
"settings_",
"._",
"DEF",
"AUL",
"T",
"\\u",
"FROM",
"\\u",
"EMAIL_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"email_",
"=_",
"Ema",
"il",
"Multi",
"Alternative",
"s_",
"(_",
"subject_",
",_",
"message",
"\\u",
"plaintext_",
",_",
"from",
"\\u",
"email_",
",_",
"to_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email_",
"._",
"attach",
"\\u",
"alternative",
"_",
"(_",
"message",
"\\u",
"html_",
",_",
"\"",
"text",
"/",
"html",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email_",
"._",
"send_",
"(_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | openstack/rack/rack/openstack/common/imageutils.py | [
{
"content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n# Copyright (c) 2010 Citrix Systems, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"\nHelper methods to deal with images.\n\"\"\"\n\nimport re\n\nfrom rack.openstack.common.gettextutils import _ # noqa\nfrom rack.openstack.common import strutils\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class QemuImgInfo(object):\n BACKING_FILE_RE = re.compile((r\"^(.*?)\\s*\\(actual\\s+path\\s*:\"\n r\"\\s+(.*?)\\)\\s*$\"), re.I)\n TOP_LEVEL_RE = re.compile(r\"^([\\w\\d\\s\\_\\-]+):(.*)$\")\n SIZE_RE = re.compile(r\"\\(\\s*(\\d+)\\s+bytes\\s*\\)\", re.I)\n\n\n\n\n\n",
"metadata": "root.QemuImgInfo",
"header": "['module', '___EOS___']",
"index": 29
},
{
"content": " def __init__(self, cmd_output=None):\n details = self._parse(cmd_output or '')\n self.image = details.get('image')\n self.backing_file = details.get('backing_file')\n self.file_format = details.get('file_format')\n self.virtual_size = details.get('virtual_size')\n self.cluster_size = details.get('cluster_size')\n self.disk_size = details.get('disk_size')\n self.snapshots = details.get('snapshot_list', [])\n self.encryption = details.get('encryption')",
"metadata": "root.QemuImgInfo.__init__",
"header": "['class', 'QemuImgInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 35
},
{
"content": " def __str__(self):\n lines = [\n 'image: %s' % self.image,\n 'file_format: %s' % self.file_format,\n 'virtual_size: %s' % self.virtual_size,\n 'disk_size: %s' % self.disk_size,\n 'cluster_size: %s' % self.cluster_size,\n 'backing_file: %s' % self.backing_file,\n ]\n if self.snapshots:\n lines.append(\"snapshots: %s\" % self.snapshots)\n return \"\\n\".join(lines)",
"metadata": "root.QemuImgInfo.__str__",
"header": "['class', 'QemuImgInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 46
},
{
"content": " def _canonicalize(self, field):\n # Standardize on underscores/lc/no dash and no spaces\n # since qemu seems to have mixed outputs here... and\n # this format allows for better integration with python\n # - ie for usage in kwargs and such...\n field = field.lower().strip()\n for c in (\" \", \"-\"):\n field = field.replace(c, '_')\n return field",
"metadata": "root.QemuImgInfo._canonicalize",
"header": "['class', 'QemuImgInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 59
},
{
"content": " def _extract_bytes(self, details):\n # Replace it with the byte amount\n real_size = self.SIZE_RE.search(details)\n if real_size:\n details = real_size.group(1)\n try:\n details = strutils.to_bytes(details)\n except TypeError:\n pass\n return details",
"metadata": "root.QemuImgInfo._extract_bytes",
"header": "['class', 'QemuImgInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 69
},
{
"content": " def _extract_details(self, root_cmd, root_details, lines_after):\n real_details = root_details\n if root_cmd == 'backing_file':\n # Replace it with the real backing file\n backing_match = self.BACKING_FILE_RE.match(root_details)\n if backing_match:\n real_details = backing_match.group(2).strip()\n elif root_cmd in ['virtual_size', 'cluster_size', 'disk_size']:\n # Replace it with the byte amount (if we can convert it)\n real_details = self._extract_bytes(root_details)\n elif root_cmd == 'file_format':\n real_details = real_details.strip().lower()\n elif root_cmd == 'snapshot_list':\n # Next line should be a header, starting with 'ID'\n if not lines_after or not lines_after[0].startswith(\"ID\"):\n msg = _(\"Snapshot list encountered but no header found!\")\n raise ValueError(msg)\n del lines_after[0]\n real_details = []\n # This is the sprintf pattern we will try to match\n # \"%-10s%-20s%7s%20s%15s\"\n # ID TAG VM SIZE DATE VM CLOCK (current header)\n while lines_after:\n line = lines_after[0]\n line_pieces = line.split()\n if len(line_pieces) != 6:\n break\n # Check against this pattern in the final position\n # \"%02d:%02d:%02d.%03d\"\n date_pieces = line_pieces[5].split(\":\")\n if len(date_pieces) != 3:\n break\n real_details.append({\n 'id': line_pieces[0],\n 'tag': line_pieces[1],\n 'vm_size': line_pieces[2],\n 'date': line_pieces[3],\n 'vm_clock': line_pieces[4] + \" \" + line_pieces[5],\n })\n del lines_after[0]\n return real_details",
"metadata": "root.QemuImgInfo._extract_details",
"header": "['class', 'QemuImgInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 80
},
{
"content": " def _parse(self, cmd_output):\n # Analysis done of qemu-img.c to figure out what is going on here\n # Find all points start with some chars and then a ':' then a newline\n # and then handle the results of those 'top level' items in a separate\n # function.\n #\n # TODO(harlowja): newer versions might have a json output format\n # we should switch to that whenever possible.\n # see: http://bit.ly/XLJXDX\n contents = {}\n lines = [x for x in cmd_output.splitlines() if x.strip()]\n while lines:\n line = lines.pop(0)\n top_level = self.TOP_LEVEL_RE.match(line)\n if top_level:\n root = self._canonicalize(top_level.group(1))\n if not root:\n continue\n root_details = top_level.group(2).strip()\n details = self._extract_details(root, root_details, lines)\n contents[root] = details\n return contents",
"metadata": "root.QemuImgInfo._parse",
"header": "['class', 'QemuImgInfo', '(', 'object', ')', ':', '___EOS___']",
"index": 122
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"vim",
":",
" ",
"tabs",
"top",
"=",
"4",
" ",
"shift",
"widt",
"h",
"=",
"4",
" ",
"soft",
"tabs",
"top",
"=",
"4_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2010",
" ",
"Unit",
"ed",
" ",
"State",
"s",
" ",
"Gov",
"ern",
"ment",
" ",
"as",
" ",
"represent",
"ed",
" ",
"by",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Administra",
"tor",
" ",
"of",
" ",
"the",
" ",
"Nat",
"ional",
" ",
"Aer",
"ona",
"uti",
"cs",
" ",
"and",
" ",
"Spac",
"e",
" ",
"Administrati",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"2010",
" ",
"Cit",
"rix",
" ",
"System",
"s",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Help",
"er",
" ",
"method",
"s",
" ",
"to",
" ",
"deal",
" ",
"with",
" ",
"images",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"rack_",
"._",
"openstack_",
"._",
"common_",
"._",
"gettext",
"utils_",
"import_",
"\\u_",
"#",
" ",
"no",
"qa_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"rack_",
"._",
"openstack_",
"._",
"common_",
"import_",
"stru",
"tils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"BACK",
"ING",
"\\u",
"FILE",
"\\u",
"RE_",
"=_",
"re_",
"._",
"compile_",
"(_",
"(_",
"r",
"\"",
"^",
"(.*?)",
"\\\\",
"s",
"*\\\\",
"(",
"actual",
"\\\\",
"s",
"+",
"path",
"\\\\",
"s",
"*:",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"\"\\\\",
"s",
"+(",
".*?)",
"\\\\)",
"\\\\",
"s",
"*$",
"\"_",
")_",
",_",
"re_",
"._",
"I_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"TOP",
"\\u",
"LE",
"VEL",
"\\u",
"RE_",
"=_",
"re_",
"._",
"compile_",
"(_",
"r",
"\"",
"^",
"([\\\\",
"w",
"\\\\",
"d",
"\\\\",
"s",
"\\\\\\u",
"\\\\-]",
"+)",
":(",
".*)",
"$\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SIZE",
"\\u",
"RE_",
"=_",
"re_",
"._",
"compile_",
"(_",
"r",
"\"\\\\",
"(\\\\",
"s",
"*(",
"\\\\",
"d",
"+)\\\\",
"s",
"+",
"bytes",
"\\\\",
"s",
"*\\\\",
")\"_",
",_",
"re_",
"._",
"I_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"cmd",
"\\u",
"output_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"details_",
"=_",
"self_",
"._",
"\\u",
"parse_",
"(_",
"cmd",
"\\u",
"output_",
"or_",
"''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"image_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"image",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"backing",
"\\u",
"file_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"backing",
"\\u",
"file",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"file",
"\\u",
"format_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"file",
"\\u",
"format",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"virtual",
"\\u",
"size_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"virtual",
"\\u",
"size",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"cluster",
"\\u",
"size_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"cluster",
"\\u",
"size",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"disk",
"\\u",
"size_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"disk",
"\\u",
"size",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"snapshots_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"snapshot",
"\\u",
"list",
"'_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"encryption_",
"=_",
"details_",
"._",
"get_",
"(_",
"'",
"encrypt",
"ion",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"str\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lines_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"image",
":",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"image_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"file",
"\\u",
"format",
":",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"file",
"\\u",
"format_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"virtual",
"\\u",
"size",
":",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"virtual",
"\\u",
"size_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"disk",
"\\u",
"size",
":",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"disk",
"\\u",
"size_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"cluster",
"\\u",
"size",
":",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"cluster",
"\\u",
"size_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"backing",
"\\u",
"file",
":",
" ",
"%",
"s",
"'_",
"%_",
"self_",
"._",
"backing",
"\\u",
"file_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"snapshots_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lines_",
"._",
"append_",
"(_",
"\"",
"snapshot",
"s",
":",
" ",
"%",
"s",
"\"_",
"%_",
"self_",
"._",
"snapshots_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\"\\\\",
"n",
"\"_",
"._",
"join_",
"(_",
"lines_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"canonicaliz",
"e_",
"(_",
"self_",
",_",
"field_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Standard",
"ize",
" ",
"on",
" ",
"underscore",
"s",
"/",
"lc",
"/",
"no",
" ",
"dash",
" ",
"and",
" ",
"no",
" ",
"spaces_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"sinc",
"e",
" ",
"qe",
"mu",
" ",
"see",
"ms",
" ",
"to",
" ",
"have",
" ",
"mixed",
" ",
"output",
"s",
" ",
"here",
"...",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"this",
" ",
"format",
" ",
"allow",
"s",
" ",
"for",
" ",
"bett",
"er",
" ",
"integrati",
"on",
" ",
"with",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-",
" ",
"ie",
" ",
"for",
" ",
"usage",
" ",
"in",
" ",
"kwarg",
"s",
" ",
"and",
" ",
"suc",
"h",
"..._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"field_",
"._",
"lower_",
"(_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"c_",
"in_",
"(_",
"\"",
" ",
"\"_",
",_",
"\"-\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"field_",
"=_",
"field_",
"._",
"replace_",
"(_",
"c_",
",_",
"'\\u'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"field_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"extract",
"\\u",
"bytes_",
"(_",
"self_",
",_",
"details_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Replace",
" ",
"it",
" ",
"with",
" ",
"the",
" ",
"byte",
" ",
"amount_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"\\u",
"size_",
"=_",
"self_",
"._",
"SIZE",
"\\u",
"RE_",
"._",
"search_",
"(_",
"details_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"real",
"\\u",
"size_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"details_",
"=_",
"real",
"\\u",
"size_",
"._",
"group_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"details_",
"=_",
"stru",
"tils_",
"._",
"to",
"\\u",
"bytes_",
"(_",
"details_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Type",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"details_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"extract",
"\\u",
"details_",
"(_",
"self_",
",_",
"root",
"\\u",
"cmd_",
",_",
"root",
"\\u",
"details_",
",_",
"lines",
"\\u",
"after_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"\\u",
"details_",
"=_",
"root",
"\\u",
"details_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"root",
"\\u",
"cmd_",
"==_",
"'",
"backing",
"\\u",
"file",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Replace",
" ",
"it",
" ",
"with",
" ",
"the",
" ",
"real",
" ",
"backing",
" ",
"file_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"backing",
"\\u",
"match_",
"=_",
"self_",
"._",
"BACK",
"ING",
"\\u",
"FILE",
"\\u",
"RE_",
"._",
"match_",
"(_",
"root",
"\\u",
"details_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"backing",
"\\u",
"match_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"\\u",
"details_",
"=_",
"backing",
"\\u",
"match_",
"._",
"group_",
"(_",
"2_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"root",
"\\u",
"cmd_",
"in_",
"[_",
"'",
"virtual",
"\\u",
"size",
"'_",
",_",
"'",
"cluster",
"\\u",
"size",
"'_",
",_",
"'",
"disk",
"\\u",
"size",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Replace",
" ",
"it",
" ",
"with",
" ",
"the",
" ",
"byte",
" ",
"amo",
"unt",
" ",
"(",
"if",
" ",
"we",
" ",
"can",
" ",
"convert",
" ",
"it",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"\\u",
"details_",
"=_",
"self_",
"._",
"\\u",
"extract",
"\\u",
"bytes_",
"(_",
"root",
"\\u",
"details_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"root",
"\\u",
"cmd_",
"==_",
"'",
"file",
"\\u",
"format",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"real",
"\\u",
"details_",
"=_",
"real",
"\\u",
"details_",
"._",
"strip_",
"(_",
")_",
"._",
"lower_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"root",
"\\u",
"cmd_",
"==_",
"'",
"snapshot",
"\\u",
"list",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ne",
"xt",
" ",
"line",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a",
" ",
"header",
",",
" ",
"startin",
"g",
" ",
"with",
" ",
"'",
"ID",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"lines",
"\\u",
"after_",
"or_",
"not_",
"lines",
"\\u",
"after_",
"[_",
"0_",
"]_",
"._",
"startswith_",
"(_",
"\"",
"ID",
"\"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"=_",
"\\u_",
"(_",
"\"",
"Snapshot",
" ",
"list",
" ",
"encounter",
"ed",
" ",
"but",
" ",
"no",
" ",
"header",
" ",
"found",
"!\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Value",
"Error_",
"(_",
"msg_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"lines",
"\\u",
"after_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"real",
"\\u",
"details_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"sprint",
"f",
" ",
"pattern",
" ",
"we",
" ",
"will",
" ",
"try",
" ",
"to",
" ",
"match_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"%",
"-1",
"0",
"s",
"%",
"-",
"20",
"s",
"%",
"7",
"s",
"%",
"20",
"s",
"%",
"15",
"s",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ID",
" ",
"TAG",
" ",
"VM",
" ",
"SIZE",
" ",
"DAT",
"E",
" ",
"VM",
" ",
"CLOCK",
" ",
"(",
"current",
" ",
"header",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"while_",
"lines",
"\\u",
"after_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"lines",
"\\u",
"after_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"line",
"\\u",
"pieces_",
"=_",
"line_",
"._",
"split_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"line",
"\\u",
"pieces_",
")_",
"!=_",
"6_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Check",
" ",
"against",
" ",
"this",
" ",
"pattern",
" ",
"in",
" ",
"the",
" ",
"final",
" ",
"position_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"\"%",
"02",
"d",
":",
"%",
"02",
"d",
":",
"%",
"02",
"d",
".",
"%",
"03",
"d",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"date",
"\\u",
"pieces_",
"=_",
"line",
"\\u",
"pieces_",
"[_",
"5_",
"]_",
"._",
"split_",
"(_",
"\":\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"date",
"\\u",
"pieces_",
")_",
"!=_",
"3_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"real",
"\\u",
"details_",
"._",
"append_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"line",
"\\u",
"pieces_",
"[_",
"0_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"tag",
"'_",
":_",
"line",
"\\u",
"pieces_",
"[_",
"1_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"vm",
"\\u",
"size",
"'_",
":_",
"line",
"\\u",
"pieces_",
"[_",
"2_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"date",
"'_",
":_",
"line",
"\\u",
"pieces_",
"[_",
"3_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"vm",
"\\u",
"clock",
"'_",
":_",
"line",
"\\u",
"pieces_",
"[_",
"4_",
"]_",
"+_",
"\"",
" ",
"\"_",
"+_",
"line",
"\\u",
"pieces_",
"[_",
"5_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"lines",
"\\u",
"after_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"real",
"\\u",
"details_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Qe",
"mu",
"Im",
"g",
"Info_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"parse_",
"(_",
"self_",
",_",
"cmd",
"\\u",
"output_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Analy",
"sis",
" ",
"don",
"e",
" ",
"of",
" ",
"qe",
"mu",
"-",
"img",
".",
"c",
" ",
"to",
" ",
"figure",
" ",
"out",
" ",
"what",
" ",
"is",
" ",
"goi",
"ng",
" ",
"on",
" ",
"here_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"all",
" ",
"points",
" ",
"start",
" ",
"with",
" ",
"some",
" ",
"char",
"s",
" ",
"and",
" ",
"then",
" ",
"a",
" ",
"':",
"'",
" ",
"then",
" ",
"a",
" ",
"newline_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"and",
" ",
"then",
" ",
"handle",
" ",
"the",
" ",
"results",
" ",
"of",
" ",
"tho",
"se",
" ",
"'",
"top",
" ",
"level",
"'",
" ",
"items",
" ",
"in",
" ",
"a",
" ",
"separate",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"function",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"TOD",
"O",
"(",
"har",
"low",
"ja",
"):",
" ",
"newe",
"r",
" ",
"version",
"s",
" ",
"mig",
"ht",
" ",
"have",
" ",
"a",
" ",
"json",
" ",
"output",
" ",
"format_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"we",
" ",
"shou",
"ld",
" ",
"switch",
" ",
"to",
" ",
"tha",
"t",
" ",
"whe",
"neve",
"r",
" ",
"possib",
"le",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"see",
":",
" ",
"http",
"://",
"bit",
".",
"ly",
"/",
"XL",
"JX",
"DX",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"contents_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lines_",
"=_",
"[_",
"x_",
"for_",
"x_",
"in_",
"cmd",
"\\u",
"output_",
"._",
"splitlines_",
"(_",
")_",
"if_",
"x_",
"._",
"strip_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"lines_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"line_",
"=_",
"lines_",
"._",
"pop_",
"(_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"top",
"\\u",
"level_",
"=_",
"self_",
"._",
"TOP",
"\\u",
"LE",
"VEL",
"\\u",
"RE_",
"._",
"match_",
"(_",
"line_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"top",
"\\u",
"level_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"root_",
"=_",
"self_",
"._",
"\\u",
"canonicaliz",
"e_",
"(_",
"top",
"\\u",
"level_",
"._",
"group_",
"(_",
"1_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"root_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"root",
"\\u",
"details_",
"=_",
"top",
"\\u",
"level_",
"._",
"group_",
"(_",
"2_",
")_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"details_",
"=_",
"self_",
"._",
"\\u",
"extract",
"\\u",
"details_",
"(_",
"root_",
",_",
"root",
"\\u",
"details_",
",_",
"lines_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"contents_",
"[_",
"root_",
"]_",
"=_",
"details_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"contents_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | saltstack/salt/salt/modules/kapacitor.py | [
{
"content": "# -*- coding: utf-8 -*-\n'''\nKapacitor execution module.\n\n:configuration: This module accepts connection configuration details either as\n parameters or as configuration settings in /etc/salt/minion on the relevant\n minions::\n\n kapacitor.host: 'localhost'\n kapacitor.port: 9092\n\n This data can also be passed into pillar. Options passed into opts will\n overwrite options passed into pillar.\n\n.. versionadded:: Carbon\n'''\n\nfrom __future__ import absolute_import\n\nimport json\nimport logging\n\nimport salt.utils\nimport salt.utils.http\n\nLOG = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def __virtual__():\n return 'kapacitor' if salt.utils.which('kapacitor') else False",
"metadata": "root.__virtual__",
"header": "['module', '___EOS___']",
"index": 28
},
{
"content": "def get_task(name):\n '''\n Get a dict of data on a task.\n\n name\n Name of the task to get information about.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kapacitor.get_task cpu\n '''\n host = __salt__['config.option']('kapacitor.host', 'localhost')\n port = __salt__['config.option']('kapacitor.port', 9092)\n url = 'http://{0}:{1}/task?name={2}'.format(host, port, name)\n response = salt.utils.http.query(url, status=True)\n\n if response['status'] == 404:\n return None\n\n data = json.loads(response['body'])\n\n return data",
"metadata": "root.get_task",
"header": "['module', '___EOS___']",
"index": 32
},
{
"content": "def _run_cmd(cmd):\n '''\n Run a Kapacitor task and return a dictionary of info.\n '''\n ret = {}\n result = __salt__['cmd.run_all'](cmd)\n\n if result.get('stdout'):\n ret['stdout'] = result['stdout']\n if result.get('stderr'):\n ret['stderr'] = result['stderr']\n ret['success'] = result['retcode'] == 0\n\n return ret",
"metadata": "root._run_cmd",
"header": "['module', '___EOS___']",
"index": 58
},
{
"content": "def define_task(name,\n tick_script,\n task_type='stream',\n database=None,\n retention_policy='default'):\n '''\n Define a task. Serves as both create/update.\n\n name\n Name of the task.\n\n tick_script\n Path to the TICK script for the task. Can be a salt:// source.\n\n task_type\n Task type. Defaults to 'stream'\n\n database\n Which database to fetch data from. Defaults to None, which will use the\n default database in InfluxDB.\n\n retention_policy\n Which retention policy to fetch data from. Defaults to 'default'.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kapacitor.define_task cpu salt://kapacitor/cpu.tick database=telegraf\n '''\n cmd = 'kapacitor define -name {0} -tick {1}'.format(name, tick_script)\n\n if tick_script.startswith('salt://'):\n tick_script = __salt__['cp.cache_file'](tick_script, __env__)\n\n if task_type:\n cmd += ' -type {0}'.format(task_type)\n\n if database and retention_policy:\n cmd += ' -dbrp {0}.{1}'.format(database, retention_policy)\n\n return _run_cmd(cmd)",
"metadata": "root.define_task",
"header": "['module', '___EOS___']",
"index": 74
},
{
"content": "def delete_task(name):\n '''\n Delete a kapacitor task.\n\n name\n Name of the task to delete.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kapacitor.delete_task cpu\n '''\n return _run_cmd('kapacitor delete tasks {0}'.format(name))",
"metadata": "root.delete_task",
"header": "['module', '___EOS___']",
"index": 118
},
{
"content": "def enable_task(name):\n '''\n Enable a kapacitor task.\n\n name\n Name of the task to enable.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kapacitor.enable_task cpu\n '''\n return _run_cmd('kapacitor enable {0}'.format(name))",
"metadata": "root.enable_task",
"header": "['module', '___EOS___']",
"index": 134
},
{
"content": "def disable_task(name):\n '''\n Disable a kapacitor task.\n\n name\n Name of the task to disable.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' kapacitor.disable_task cpu\n '''\n return _run_cmd('kapacitor disable {0}'.format(name))",
"metadata": "root.disable_task",
"header": "['module', '___EOS___']",
"index": 150
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"\\",
"10",
";",
"Kap",
"aci",
"tor",
" ",
"executi",
"on",
" ",
"module",
".",
"\\",
"10",
";",
"\\",
"10",
";",
":",
"configura",
"tion",
":",
" ",
"Thi",
"s",
" ",
"module",
" ",
"accepts",
" ",
"connecti",
"on",
" ",
"configura",
"tion",
" ",
"deta",
"il",
"s",
" ",
"eit",
"her",
" ",
"as",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"parameter",
"s",
" ",
"or",
" ",
"as",
" ",
"configura",
"tion",
" ",
"settings",
" ",
"in",
" ",
"/",
"etc",
"/",
"salt",
"/",
"minion",
" ",
"on",
" ",
"the",
" ",
"rele",
"van",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"minion",
"s",
"::",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"kap",
"aci",
"tor",
".",
"host",
":",
" ",
"'",
"local",
"host",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"kap",
"aci",
"tor",
".",
"port",
":",
" ",
"909",
"2",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"data",
" ",
"can",
" ",
"als",
"o",
" ",
"be",
" ",
"pass",
"ed",
" ",
"int",
"o",
" ",
"pillar",
".",
" ",
"Optio",
"ns",
" ",
"pass",
"ed",
" ",
"int",
"o",
" ",
"opts",
" ",
"will",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"overwrit",
"e",
" ",
"options",
" ",
"pass",
"ed",
" ",
"int",
"o",
" ",
"pillar",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"..",
" ",
"version",
"adde",
"d",
"::",
" ",
"Car",
"bon",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"json_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"salt_",
"._",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"salt_",
"._",
"utils_",
"._",
"http_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"LOG_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"virtual",
"\\u\\u_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"'",
"kap",
"aci",
"tor",
"'_",
"if_",
"salt_",
"._",
"utils_",
"._",
"which_",
"(_",
"'",
"kap",
"aci",
"tor",
"'_",
")_",
"else_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"task_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Get",
" ",
"a",
" ",
"dict",
" ",
"of",
" ",
"data",
" ",
"on",
" ",
"a",
" ",
"task",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"task",
" ",
"to",
" ",
"get",
" ",
"informati",
"on",
" ",
"abo",
"ut",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"CLI",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"code",
"-",
"block",
"::",
" ",
"bash",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"salt",
" ",
"'*",
"'",
" ",
"kap",
"aci",
"tor",
".",
"get",
"\\u",
"task",
" ",
"cpu",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"host_",
"=_",
"\\u\\u",
"salt\\u\\u_",
"[_",
"'",
"config",
".",
"option",
"'_",
"]_",
"(_",
"'",
"kap",
"aci",
"tor",
".",
"host",
"'_",
",_",
"'",
"local",
"host",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"port_",
"=_",
"\\u\\u",
"salt\\u\\u_",
"[_",
"'",
"config",
".",
"option",
"'_",
"]_",
"(_",
"'",
"kap",
"aci",
"tor",
".",
"port",
"'_",
",_",
"909",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"'",
"http",
"://",
"{",
"0",
"}:",
"{",
"1",
"}/",
"task",
"?",
"name",
"={",
"2",
"}'_",
"._",
"format_",
"(_",
"host_",
",_",
"port_",
",_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"salt_",
"._",
"utils_",
"._",
"http_",
"._",
"query_",
"(_",
"url_",
",_",
"status_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"response_",
"[_",
"'",
"status",
"'_",
"]_",
"==_",
"404_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data_",
"=_",
"json_",
"._",
"loads_",
"(_",
"response_",
"[_",
"'",
"body",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"run",
"\\u",
"cmd_",
"(_",
"cmd_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Run",
" ",
"a",
" ",
"Kap",
"aci",
"tor",
" ",
"task",
" ",
"and",
" ",
"return",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"of",
" ",
"info",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ret_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"\\u\\u",
"salt\\u\\u_",
"[_",
"'",
"cmd",
".",
"run",
"\\u",
"all",
"'_",
"]_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"result_",
"._",
"get_",
"(_",
"'",
"stdout",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"[_",
"'",
"stdout",
"'_",
"]_",
"=_",
"result_",
"[_",
"'",
"stdout",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"result_",
"._",
"get_",
"(_",
"'",
"std",
"err",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ret_",
"[_",
"'",
"std",
"err",
"'_",
"]_",
"=_",
"result_",
"[_",
"'",
"std",
"err",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"ret_",
"[_",
"'",
"success",
"'_",
"]_",
"=_",
"result_",
"[_",
"'",
"ret",
"code",
"'_",
"]_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"ret_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"defin",
"e\\u",
"task_",
"(_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"tick",
"\\u",
"script_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"task",
"\\u",
"type_",
"=_",
"'",
"stream",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"database_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"retention",
"\\u",
"policy_",
"=_",
"'",
"default",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Define",
" ",
"a",
" ",
"task",
".",
" ",
"Serv",
"es",
" ",
"as",
" ",
"bot",
"h",
" ",
"create",
"/",
"update",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"task",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"tick",
"\\u",
"script",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Path",
" ",
"to",
" ",
"the",
" ",
"TICK",
" ",
"script",
" ",
"for",
" ",
"the",
" ",
"task",
".",
" ",
"Can",
" ",
"be",
" ",
"a",
" ",
"salt",
"://",
" ",
"source",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"task",
"\\u",
"type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Task",
" ",
"type",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"'",
"stream",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"databa",
"se",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whi",
"ch",
" ",
"databa",
"se",
" ",
"to",
" ",
"fetch",
" ",
"data",
" ",
"from",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"Non",
"e",
",",
" ",
"whi",
"ch",
" ",
"will",
" ",
"use",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"default",
" ",
"databa",
"se",
" ",
"in",
" ",
"Influ",
"x",
"DB",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"retention",
"\\u",
"policy",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whi",
"ch",
" ",
"retention",
" ",
"policy",
" ",
"to",
" ",
"fetch",
" ",
"data",
" ",
"from",
".",
" ",
"Default",
"s",
" ",
"to",
" ",
"'",
"default",
"'.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"CLI",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"code",
"-",
"block",
"::",
" ",
"bash",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"salt",
" ",
"'*",
"'",
" ",
"kap",
"aci",
"tor",
".",
"defin",
"e\\u",
"task",
" ",
"cpu",
" ",
"salt",
"://",
"kap",
"aci",
"tor",
"/",
"cpu",
".",
"tick",
" ",
"databa",
"se",
"=",
"tele",
"graf",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cmd_",
"=_",
"'",
"kap",
"aci",
"tor",
" ",
"defin",
"e",
" ",
"-",
"name",
" ",
"{",
"0",
"}",
" ",
"-",
"tick",
" ",
"{",
"1",
"}'_",
"._",
"format_",
"(_",
"name_",
",_",
"tick",
"\\u",
"script_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"tick",
"\\u",
"script_",
"._",
"startswith_",
"(_",
"'",
"salt",
"://'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tick",
"\\u",
"script_",
"=_",
"\\u\\u",
"salt\\u\\u_",
"[_",
"'",
"cp",
".",
"cache",
"\\u",
"file",
"'_",
"]_",
"(_",
"tick",
"\\u",
"script_",
",_",
"\\u\\u",
"env",
"\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"task",
"\\u",
"type_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"+=_",
"'",
" ",
"-",
"type",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"task",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"database_",
"and_",
"retention",
"\\u",
"policy_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cmd_",
"+=_",
"'",
" ",
"-",
"dbr",
"p",
" ",
"{",
"0",
"}.",
"{",
"1",
"}'_",
"._",
"format_",
"(_",
"database_",
",_",
"retention",
"\\u",
"policy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"\\u",
"run",
"\\u",
"cmd_",
"(_",
"cmd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"delete",
"\\u",
"task_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Delete",
" ",
"a",
" ",
"kap",
"aci",
"tor",
" ",
"task",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"task",
" ",
"to",
" ",
"delete",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"CLI",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"code",
"-",
"block",
"::",
" ",
"bash",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"salt",
" ",
"'*",
"'",
" ",
"kap",
"aci",
"tor",
".",
"delete",
"\\u",
"task",
" ",
"cpu",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u",
"run",
"\\u",
"cmd_",
"(_",
"'",
"kap",
"aci",
"tor",
" ",
"delete",
" ",
"task",
"s",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"enable",
"\\u",
"task_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Enable",
" ",
"a",
" ",
"kap",
"aci",
"tor",
" ",
"task",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"task",
" ",
"to",
" ",
"enable",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"CLI",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"code",
"-",
"block",
"::",
" ",
"bash",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"salt",
" ",
"'*",
"'",
" ",
"kap",
"aci",
"tor",
".",
"enable",
"\\u",
"task",
" ",
"cpu",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u",
"run",
"\\u",
"cmd_",
"(_",
"'",
"kap",
"aci",
"tor",
" ",
"enable",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"name_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"disable",
"\\u",
"task_",
"(_",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Disa",
"ble",
" ",
"a",
" ",
"kap",
"aci",
"tor",
" ",
"task",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Name",
" ",
"of",
" ",
"the",
" ",
"task",
" ",
"to",
" ",
"disable",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"CLI",
" ",
"Exam",
"ple",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"..",
" ",
"code",
"-",
"block",
"::",
" ",
"bash",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"salt",
" ",
"'*",
"'",
" ",
"kap",
"aci",
"tor",
".",
"disable",
"\\u",
"task",
" ",
"cpu",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u",
"run",
"\\u",
"cmd_",
"(_",
"'",
"kap",
"aci",
"tor",
" ",
"disable",
" ",
"{",
"0",
"}'_",
"._",
"format_",
"(_",
"name_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | AppScale/appscale/AppServer/google/net/proto/message_set.py | [
{
"content": " def Parse(self, message_class):\n\n if self.message_class is not None:\n return 1\n\n try:\n message_obj = message_class()\n message_obj.MergePartialFromString(self.message)\n self.message = message_obj\n self.message_class = message_class\n return 1\n except ProtocolBuffer.ProtocolBufferDecodeError:\n logging.warn(\"Parse error in message inside MessageSet. Tried \"\n \"to parse as: \" + message_class.__name__)\n return 0",
"metadata": "root.Item.Parse",
"header": "['class', 'Item', ':', '___EOS___']",
"index": 58
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Item_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"Parse_",
"(_",
"self_",
",_",
"message",
"\\u",
"class_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"message",
"\\u",
"class_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"message",
"\\u",
"obj_",
"=_",
"message",
"\\u",
"class_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"obj_",
"._",
"Merge",
"Parti",
"al",
"Fro",
"m",
"String_",
"(_",
"self_",
"._",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"message_",
"=_",
"message",
"\\u",
"obj_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"message",
"\\u",
"class_",
"=_",
"message",
"\\u",
"class_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Proto",
"col",
"Buffer_",
"._",
"Proto",
"col",
"Buffer",
"Decode",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"warn_",
"(_",
"\"",
"Pars",
"e",
" ",
"error",
" ",
"in",
" ",
"message",
" ",
"insi",
"de",
" ",
"Messag",
"e",
"Set",
".",
" ",
" ",
"Trie",
"d",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"to",
" ",
"parse",
" ",
"as",
":",
" ",
"\"_",
"+_",
"message",
"\\u",
"class_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/colors.py | [
{
"content": "class ColorMapping(Serialisable):\n\n tagname = \"clrMapOvr\"\n\n bg1 = Set(values=_COLOR_SET)\n tx1 = Set(values=_COLOR_SET)\n bg2 = Set(values=_COLOR_SET)\n tx2 = Set(values=_COLOR_SET)\n accent1 = Set(values=_COLOR_SET)\n accent2 = Set(values=_COLOR_SET)\n accent3 = Set(values=_COLOR_SET)\n accent4 = Set(values=_COLOR_SET)\n accent5 = Set(values=_COLOR_SET)\n accent6 = Set(values=_COLOR_SET)\n hlink = Set(values=_COLOR_SET)\n folHlink = Set(values=_COLOR_SET)\n extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True)\n",
"metadata": "root.ColorMapping",
"header": "['module', '___EOS___']",
"index": 262
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Color",
"Mapping_",
"(_",
"Seriali",
"sab",
"le_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tagname_",
"=_",
"\"",
"clr",
"Map",
"Ov",
"r",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"bg",
"1_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tx",
"1_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bg",
"2_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tx",
"2_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"accent",
"1_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"accent",
"2_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"accent",
"3_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"accent",
"4_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"accent",
"5_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"accent",
"6_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"hli",
"nk_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fol",
"Hl",
"ink_",
"=_",
"Set_",
"(_",
"values_",
"=_",
"\\u",
"COLOR",
"\\u",
"SET_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ext",
"Lst_",
"=_",
"Type",
"d_",
"(_",
"expected",
"\\u",
"type_",
"=_",
"Office",
"Art",
"Ext",
"ensi",
"on",
"List_",
",_",
"allow",
"\\u",
"none_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | omab/python-social-auth/social/backends/changetip.py | [
{
"content": " def get_user_details(self, response):\n \"\"\"Return user details from ChangeTip account\"\"\"\n return {\n 'username': response['username'],\n 'email': response.get('email', ''),\n 'first_name': '',\n 'last_name': '',\n }",
"metadata": "root.ChangeTipOAuth2.get_user_details",
"header": "['class', 'ChangeTipOAuth2', '(', 'BaseOAuth2', ')', ':', '___EOS___']",
"index": 13
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Change",
"Tip",
"OA",
"uth",
"2_",
"(_",
"Base",
"OA",
"uth",
"2_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"get",
"\\u",
"user",
"\\u",
"details_",
"(_",
"self_",
",_",
"response_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Return",
" ",
"user",
" ",
"deta",
"il",
"s",
" ",
"from",
" ",
"Change",
"Tip",
" ",
"account",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"name",
"'_",
":_",
"response_",
"[_",
"'",
"user",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"email",
"'_",
":_",
"response_",
"._",
"get_",
"(_",
"'",
"email",
"'_",
",_",
"''_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"first",
"\\u",
"name",
"'_",
":_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"last",
"\\u",
"name",
"'_",
":_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | weblabdeusto/weblabdeusto/server/src/test/unit/experiments/ud_logic/test_server.py | [
{
"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2005 onwards University of Deusto\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as part of this distribution.\n#\n# This software consists of contributions made by many individuals,\n# listed below:\n#\n# Author: Pablo Orduña <[email protected]>\n#\nfrom __future__ import print_function, unicode_literals\nimport unittest\nimport test.unit.configuration as configuration_module\n\nimport voodoo.configuration as ConfigurationManager\nimport experiments.logic.server as LogicExperiment\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class CircuitGeneratorTestCase(unittest.TestCase):\n\n",
"metadata": "root.CircuitGeneratorTestCase",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": " def test_switch(self):\n switch = LogicExperiment.Switch()\n self.assertFalse(switch.turned)\n switch.set_turned(True)\n self.assertTrue(switch.turned)",
"metadata": "root.CircuitGeneratorTestCase.test_switch",
"header": "['class', 'CircuitGeneratorTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 22
},
{
"content": " def test_gate(self):\n\n switch1 = LogicExperiment.Switch()\n switch2 = LogicExperiment.Switch()\n switch3 = LogicExperiment.Switch()\n switch4 = LogicExperiment.Switch()\n\n gate2 = LogicExperiment.Gate('and', switch1, switch2)\n gate3 = LogicExperiment.Gate('and', switch3, switch4)\n gate1 = LogicExperiment.Gate('or', gate2, gate3)\n\n self.assertFalse(gate1.turned)\n switch1.set_turned(True)\n self.assertFalse(gate1.turned)\n switch2.set_turned(True)\n self.assertTrue(gate1.turned)\n switch2.set_turned(False)\n self.assertFalse(gate1.turned)\n switch3.set_turned(True)\n self.assertFalse(gate1.turned)\n switch4.set_turned(True)\n self.assertTrue(gate1.turned)",
"metadata": "root.CircuitGeneratorTestCase.test_gate",
"header": "['class', 'CircuitGeneratorTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def test_generator(self):\n cg = LogicExperiment.CircuitGenerator()\n for _ in xrange(50):\n circuit = cg.generate()\n self.assertTrue(circuit.is_correct_sample())",
"metadata": "root.CircuitGeneratorTestCase.test_generator",
"header": "['class', 'CircuitGeneratorTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 51
},
{
"content": "class WrappedLogicExperiment(LogicExperiment.LogicExperiment):",
"metadata": "root.WrappedLogicExperiment",
"header": "['module', '___EOS___']",
"index": 57
},
{
"content": " def turn_off(self, *args):\n pass",
"metadata": "root.WrappedLogicExperiment.turn_off",
"header": "['class', 'WrappedLogicExperiment', '(', 'LogicExperiment', '.', 'LogicExperiment', ')', ':', '___EOS___']",
"index": 58
},
{
"content": " def send(self, *args):\n pass",
"metadata": "root.WrappedLogicExperiment.send",
"header": "['class', 'WrappedLogicExperiment', '(', 'LogicExperiment', '.', 'LogicExperiment', ')', ':', '___EOS___']",
"index": 60
},
{
"content": "class LogicExperimentTestCase(unittest.TestCase):\n\n\n",
"metadata": "root.LogicExperimentTestCase",
"header": "['module', '___EOS___']",
"index": 63
},
{
"content": " def setUp(self):\n cfg_manager = ConfigurationManager.ConfigurationManager()\n cfg_manager.append_module(configuration_module)\n\n self.experiment = WrappedLogicExperiment(None, None, cfg_manager)\n self.experiment.do_start_experiment(\"{}\",\"{}\")",
"metadata": "root.LogicExperimentTestCase.setUp",
"header": "['class', 'LogicExperimentTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 64
},
{
"content": " def test_get_circuit(self):\n circuit1a = self.experiment.do_send_command_to_device('GET_CIRCUIT')\n circuit1b = self.experiment.do_send_command_to_device('GET_CIRCUIT')\n self.assertEquals(circuit1a, circuit1b)\n\n any_ok = False\n for _ in xrange(10):\n for operation in LogicExperiment.Gate.operations:\n result = self.experiment.do_send_command_to_device('SOLVE %s' % operation)\n if result.startswith('OK'):\n self.assertEquals(result, 'OK: 1')\n any_ok = True\n break\n if any_ok:\n break\n\n self.assertTrue(any_ok)\n circuit2 = self.experiment.do_send_command_to_device('GET_CIRCUIT')\n self.assertNotEquals(circuit1a, circuit2)",
"metadata": "root.LogicExperimentTestCase.test_get_circuit",
"header": "['class', 'LogicExperimentTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 71
},
{
"content": " def test_invalid_command(self):\n response = self.experiment.do_send_command_to_device('foo')\n self.assertTrue(response.startswith('Error'))",
"metadata": "root.LogicExperimentTestCase.test_invalid_command",
"header": "['class', 'LogicExperimentTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 91
},
{
"content": " def test_invalid_operation(self):\n response = self.experiment.do_send_command_to_device('SOLVE foo')\n self.assertTrue(response.startswith('Error'))",
"metadata": "root.LogicExperimentTestCase.test_invalid_operation",
"header": "['class', 'LogicExperimentTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 95
},
{
"content": "def suite():\n return unittest.TestSuite((\n unittest.makeSuite(CircuitGeneratorTestCase),\n unittest.makeSuite(LogicExperimentTestCase)\n ))",
"metadata": "root.suite",
"header": "['module', '___EOS___']",
"index": 99
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2005",
" ",
"on",
"ward",
"s",
" ",
"Univers",
"it",
"y",
" ",
"of",
" ",
"De",
"ust",
"o_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"rights",
" ",
"reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"software",
" ",
"is",
" ",
"license",
"d",
" ",
"as",
" ",
"descri",
"bed",
" ",
"in",
" ",
"the",
" ",
"file",
" ",
"COPY",
"ING",
",",
" ",
"which_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"shou",
"ld",
" ",
"have",
" ",
"receive",
"d",
" ",
"as",
" ",
"part",
" ",
"of",
" ",
"this",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Thi",
"s",
" ",
"software",
" ",
"consi",
"sts",
" ",
"of",
" ",
"contributions",
" ",
"made",
" ",
"by",
" ",
"many",
" ",
"individual",
"s",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"liste",
"d",
" ",
"belo",
"w",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Author",
":",
" ",
"Pa",
"blo",
" ",
"Ord",
"u",
"\\",
"241",
";",
"a",
" ",
"<",
"pab",
"lo",
"@",
"ord",
"un",
"ya",
".",
"com",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"print",
"\\u",
"function_",
",_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"test_",
"._",
"unit_",
"._",
"configuration_",
"as_",
"configura",
"tion",
"\\u",
"module_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"vo",
"odoo_",
"._",
"configuration_",
"as_",
"Configura",
"tion",
"Manager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"experiments_",
"._",
"logic_",
"._",
"server_",
"as_",
"Logi",
"c",
"Experiment_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"unittest_",
"._",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Circuit",
"Generat",
"or",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Circuit",
"Generat",
"or",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"switch_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"switch_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Switch_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"switch_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch_",
"._",
"set\\u",
"turn",
"ed_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"switch_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Circuit",
"Generat",
"or",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"gate_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"switch",
"1_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Switch_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"2_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Switch_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"3_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Switch_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"4_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Switch_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"gate",
"2_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Gate_",
"(_",
"'",
"and",
"'_",
",_",
"switch",
"1_",
",_",
"switch",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"gate",
"3_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Gate_",
"(_",
"'",
"and",
"'_",
",_",
"switch",
"3_",
",_",
"switch",
"4_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"gate",
"1_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Gate_",
"(_",
"'",
"or",
"'_",
",_",
"gate",
"2_",
",_",
"gate",
"3_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"gate",
"1_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"1_",
"._",
"set\\u",
"turn",
"ed_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"gate",
"1_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"2_",
"._",
"set\\u",
"turn",
"ed_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"gate",
"1_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"2_",
"._",
"set\\u",
"turn",
"ed_",
"(_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"gate",
"1_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"3_",
"._",
"set\\u",
"turn",
"ed_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"gate",
"1_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"switch",
"4_",
"._",
"set\\u",
"turn",
"ed_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"gate",
"1_",
"._",
"turn",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Circuit",
"Generat",
"or",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"generator_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cg_",
"=_",
"Logi",
"c",
"Experiment_",
"._",
"Circuit",
"Generator_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"\\u_",
"in_",
"xrange_",
"(_",
"50_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"circuit_",
"=_",
"cg_",
"._",
"generate_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"circuit_",
"._",
"is",
"\\u",
"correct",
"\\u",
"sample_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Wrapp",
"ed",
"Logi",
"c",
"Experiment_",
"(_",
"Logi",
"c",
"Experiment_",
"._",
"Logi",
"c",
"Experiment_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wrapp",
"ed",
"Logi",
"c",
"Experiment_",
"(_",
"Logi",
"c",
"Experiment_",
"._",
"Logi",
"c",
"Experiment_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"turn",
"\\u",
"off_",
"(_",
"self_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Wrapp",
"ed",
"Logi",
"c",
"Experiment_",
"(_",
"Logi",
"c",
"Experiment_",
"._",
"Logi",
"c",
"Experiment_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"send_",
"(_",
"self_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Logi",
"c",
"Experiment",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Logi",
"c",
"Experiment",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"cfg",
"\\u",
"manager_",
"=_",
"Configura",
"tion",
"Manager_",
"._",
"Configura",
"tion",
"Manager_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cfg",
"\\u",
"manager_",
"._",
"append",
"\\u",
"module_",
"(_",
"configura",
"tion",
"\\u",
"module_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"experiment_",
"=_",
"Wrapp",
"ed",
"Logi",
"c",
"Experiment_",
"(_",
"None_",
",_",
"None_",
",_",
"cfg",
"\\u",
"manager_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"start",
"\\u",
"experiment_",
"(_",
"\"{}\"_",
",_",
"\"{}\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Logi",
"c",
"Experiment",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"circuit_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"circuit",
"1a_",
"=_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"send",
"\\u",
"command",
"\\u",
"to",
"\\u",
"device_",
"(_",
"'",
"GET",
"\\u",
"CIR",
"CU",
"IT",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"circuit",
"1b",
"_",
"=_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"send",
"\\u",
"command",
"\\u",
"to",
"\\u",
"device_",
"(_",
"'",
"GET",
"\\u",
"CIR",
"CU",
"IT",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"circuit",
"1a_",
",_",
"circuit",
"1b",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"any",
"\\u",
"ok_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"\\u_",
"in_",
"xrange_",
"(_",
"10_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"operation_",
"in_",
"Logi",
"c",
"Experiment_",
"._",
"Gate_",
"._",
"operations_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"send",
"\\u",
"command",
"\\u",
"to",
"\\u",
"device_",
"(_",
"'",
"SOL",
"VE",
" ",
"%",
"s",
"'_",
"%_",
"operation_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"result_",
"._",
"startswith_",
"(_",
"'",
"OK",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"assert",
"Equals_",
"(_",
"result_",
",_",
"'",
"OK",
":",
" ",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"any",
"\\u",
"ok_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"any",
"\\u",
"ok_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"any",
"\\u",
"ok_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"circuit",
"2_",
"=_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"send",
"\\u",
"command",
"\\u",
"to",
"\\u",
"device_",
"(_",
"'",
"GET",
"\\u",
"CIR",
"CU",
"IT",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Not",
"Equals_",
"(_",
"circuit",
"1a_",
",_",
"circuit",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Logi",
"c",
"Experiment",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"invalid",
"\\u",
"command_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"send",
"\\u",
"command",
"\\u",
"to",
"\\u",
"device_",
"(_",
"'",
"foo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"response_",
"._",
"startswith_",
"(_",
"'",
"Error",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Logi",
"c",
"Experiment",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"invalid",
"\\u",
"operation_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"self_",
"._",
"experiment_",
"._",
"do",
"\\u",
"send",
"\\u",
"command",
"\\u",
"to",
"\\u",
"device_",
"(_",
"'",
"SOL",
"VE",
" ",
"foo",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"response_",
"._",
"startswith_",
"(_",
"'",
"Error",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"suite_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"unittest_",
"._",
"Test",
"Suite_",
"(_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"unittest_",
"._",
"make",
"Suite_",
"(_",
"Circuit",
"Generat",
"or",
"Test",
"Case_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unittest_",
"._",
"make",
"Suite_",
"(_",
"Logi",
"c",
"Experiment",
"Test",
"Case_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Module is imported more than once | ellmetha/django-machina/machina/apps/forum_member/abstract_models.py | [
{
"content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom machina.conf import settings as machina_settings\nfrom machina.core import validators\nfrom machina.models.fields import ExtendedImageField\nfrom machina.models.fields import MarkupTextField\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"more_",
"than_",
"once_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"encoding_",
"import_",
"python",
"\\u",
"2",
"\\u",
"unicode",
"\\u",
"compatible_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"uge",
"ttext",
"\\u",
"lazy_",
"as_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"mach",
"ina",
"_",
"._",
"conf_",
"import_",
"settings_",
"as_",
"mach",
"ina",
"\\u",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mach",
"ina",
"_",
"._",
"core_",
"import_",
"validators_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mach",
"ina",
"_",
"._",
"models_",
"._",
"fields_",
"import_",
"Extend",
"ed",
"Image",
"Field_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"mach",
"ina",
"_",
"._",
"models_",
"._",
"fields_",
"import_",
"Mark",
"up",
"Text",
"Field_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Imprecise assert | openstack/sahara/sahara/tests/unit/db/migration/test_migrations.py | [
{
"content": " def _data_001(self, engine, data):\n datasize = 512 * 1024 # 512kB\n data = os.urandom(datasize)\n t = db_utils.get_table(engine, 'job_binary_internal')\n engine.execute(t.insert(), data=data, id='123', name='name')\n new_data = engine.execute(t.select()).fetchone().data\n self.assertEqual(data, new_data)\n engine.execute(t.delete())",
"metadata": "root.SaharaMigrationsCheckers._data_001",
"header": "['class', 'SaharaMigrationsCheckers', '(', 'object', ')', ':', '___EOS___']",
"index": 317
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Sa",
"hara",
"Migrat",
"ion",
"s",
"Check",
"ers_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"data\\u",
"001_",
"(_",
"self_",
",_",
"engine_",
",_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"datas",
"ize_",
"=_",
"512_",
"*_",
"1024_",
"#",
" ",
"512",
"k",
"B_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"os_",
"._",
"urandom_",
"(_",
"datas",
"ize_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"t_",
"=_",
"db",
"\\u",
"utils_",
"._",
"get",
"\\u",
"table_",
"(_",
"engine_",
",_",
"'",
"job",
"\\u",
"binar",
"y",
"\\u",
"internal",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"engine_",
"._",
"execute_",
"(_",
"t_",
"._",
"insert_",
"(_",
")_",
",_",
"data_",
"=_",
"data_",
",_",
"id_",
"=_",
"'",
"123",
"'_",
",_",
"name_",
"=_",
"'",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"data_",
"=_",
"engine_",
"._",
"execute_",
"(_",
"t_",
"._",
"select_",
"(_",
")_",
")_",
"._",
"fetchone_",
"(_",
")_",
"._",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"data_",
",_",
"new",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"engine_",
"._",
"execute_",
"(_",
"t_",
"._",
"delete_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Insecure temporary file | giampaolo/psutil/setup.py | [
{
"content": " def get_ethtool_macro():\n # see: https://github.com/giampaolo/psutil/issues/659\n from distutils.unixccompiler import UnixCCompiler\n from distutils.errors import CompileError\n\n with tempfile.NamedTemporaryFile(\n suffix='.c', delete=False, mode=\"wt\") as f:\n f.write(\"#include <linux/ethtool.h>\")\n\n @atexit.register\n def on_exit():\n try:\n os.remove(f.name)\n except OSError:\n pass\n\n compiler = UnixCCompiler()\n try:\n with silenced_output('stderr'):\n with silenced_output('stdout'):\n compiler.compile([f.name])\n except CompileError:\n return (\"PSUTIL_ETHTOOL_MISSING_TYPES\", 1)\n else:\n return None",
"metadata": "root.get_ethtool_macro",
"header": "['module', '___EOS___']",
"index": 168
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Inse",
"cure",
"_",
"temporar",
"y_",
"file_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"get",
"\\u",
"eth",
"tool",
"\\u",
"macro_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"see",
":",
" ",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"gia",
"mpa",
"olo",
"/",
"psu",
"til",
"/",
"issue",
"s",
"/",
"659",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"distutils_",
"._",
"unix",
"cco",
"mpi",
"ler_",
"import_",
"Uni",
"x",
"CC",
"omp",
"iler",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"distutils_",
"._",
"errors_",
"import_",
"Compil",
"e",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"tempfile_",
"._",
"Name",
"d",
"Tempora",
"ry",
"File_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"suffix_",
"=_",
"'.",
"c",
"'_",
",_",
"delete_",
"=_",
"False_",
",_",
"mode_",
"=_",
"\"",
"wt",
"\"_",
")_",
"as_",
"f_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"f_",
"._",
"write_",
"(_",
"\"#",
"include",
" ",
"<",
"linux",
"/",
"eth",
"tool",
".",
"h",
">\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"atexit_",
"._",
"register_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"on",
"\\u",
"exit_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"os_",
"._",
"remove_",
"(_",
"f_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"OSE",
"rror_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"compiler_",
"=_",
"Uni",
"x",
"CC",
"omp",
"iler",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"silence",
"d\\u",
"output_",
"(_",
"'",
"std",
"err",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"silence",
"d\\u",
"output_",
"(_",
"'",
"stdout",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"compiler_",
"._",
"compile_",
"(_",
"[_",
"f_",
"._",
"name_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Compil",
"e",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"(_",
"\"",
"PS",
"UTIL",
"\\u",
"ETH",
"TOOL",
"\\u",
"MISSING",
"\\u",
"TYPES",
"\"_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | scikit-beam/scikit-beam/skbeam/core/fitting/models.py | [
{
"content": "class Lorentzian2Model(Model):\n\n __doc__ = _gen_class_docs(lorentzian2)\n",
"metadata": "root.Lorentzian2Model",
"header": "['module', '___EOS___']",
"index": 131
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Lore",
"ntz",
"ian",
"2",
"Model_",
"(_",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\\u\\u",
"doc\\u\\u_",
"=_",
"\\u",
"gen",
"\\u",
"class",
"\\u",
"docs_",
"(_",
"lore",
"ntz",
"ian",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | dimagi/commcare-hq/corehq/apps/cleanup/management/commands/reprocess_error_forms.py | [
{
"content": "import datetime\nimport warnings\n\nfrom casexml.apps.case.models import CommCareCase\nfrom casexml.apps.case.signals import case_post_save\nfrom casexml.apps.case.xform import get_and_check_xform_domain, process_cases_with_casedb\nfrom collections import defaultdict\nfrom couchforms.models import XFormInstance\nfrom dimagi.utils.parsing import string_to_datetime\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError, LabelCommand\nfrom optparse import make_option\n\nfrom corehq.apps.cleanup.xforms import iter_problem_forms\nfrom corehq.form_processor.backends.couch.casedb import CaseDbCacheCouch\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def _process_cases(xform, config=None):\n \"\"\"\n Creates or updates case objects which live outside of the form.\n\n If reconcile is true it will perform an additional step of\n reconciling the case update history after the case is processed.\n \"\"\"\n warnings.warn(\n 'This function is deprecated. You should be using SubmissionPost.',\n DeprecationWarning,\n )\n\n assert getattr(settings, 'UNIT_TESTING', False)\n domain = get_and_check_xform_domain(xform)\n\n with CaseDbCacheCouch(domain=domain, lock=True, deleted_ok=True) as case_db:\n case_result = process_cases_with_casedb([xform], case_db, config=config)\n\n cases = case_result.cases\n docs = [xform] + cases\n now = datetime.datetime.utcnow()\n for case in cases:\n case.server_modified_on = now\n XFormInstance.get_db().bulk_save(docs)\n\n for case in cases:\n case_post_save.send(CommCareCase, case=case)\n\n case_result.commit_dirtiness_flags()\n return cases",
"metadata": "root._process_cases",
"header": "['module', '___EOS___']",
"index": 17
},
{
"content": "def reprocess_form_cases(form):\n \"\"\"\n For a given form, reprocess all case elements inside it. This operation\n should be a no-op if the form was sucessfully processed, but should\n correctly inject the update into the case history if the form was NOT\n successfully processed.\n \"\"\"\n _process_cases(form)\n # mark cleaned up now that we've reprocessed it\n if form.doc_type != 'XFormInstance':\n form = XFormInstance.get(form._id)\n form.doc_type = 'XFormInstance'\n form.save()",
"metadata": "root.reprocess_form_cases",
"header": "['module', '___EOS___']",
"index": 49
},
{
"content": "class Command(BaseCommand):\n args = '<domain> <since>'\n help = ('Reprocesses all documents tagged as errors and tries to '\n 'regenerate the appropriate case blocks for them. Can pass in '\n 'a domain and date to process forms received after that date or '\n 'just a domain to process all problem forms in the domain.')\n option_list = LabelCommand.option_list + \\\n (make_option('--dryrun', action='store_true', dest='dryrun', default=False,\n help=\"Don't do the actual reprocessing, just print the ids that would be affected\"),)\n",
"metadata": "root.Command",
"header": "['module', '___EOS___']",
"index": 64
},
{
"content": " def handle(self, *args, **options):\n domain = since = None\n if len(args) == 1:\n domain = args[0]\n elif len(args) == 2:\n domain = args[0]\n since = string_to_datetime(args[1])\n else:\n raise CommandError('Usage: %s\\n%s' % (self.args, self.help))\n\n succeeded = []\n failed = []\n error_messages = defaultdict(lambda: 0)\n for form in iter_problem_forms(domain, since):\n print \"%s\\t%s\\t%s\\t%s\\t%s\" % (form._id, form.received_on,\n form.xmlns,\n form.get_data('form/meta/username'),\n form.problem.strip())\n if not options[\"dryrun\"]:\n try:\n reprocess_form_cases(form)\n except Exception, e:\n failed.append(form._id)\n error_messages[str(e)] += 1\n else:\n succeeded.append(form._id)\n\n print \"%s / %s forms successfully processed, %s failures\" % \\\n (len(succeeded), len(succeeded) + len(failed), len(failed))\n if error_messages:\n print \"The following errors were seen: \\n%s\" % \\\n (\"\\n\".join(\"%s: %s\" % (v, k) for k, v in error_messages.items()))",
"metadata": "root.Command.handle",
"header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']",
"index": 74
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"warnings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"case",
"xml_",
"._",
"apps_",
"._",
"case_",
"._",
"models_",
"import_",
"Comm",
"Care",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"case",
"xml_",
"._",
"apps_",
"._",
"case_",
"._",
"signals_",
"import_",
"case",
"\\u",
"post",
"\\u",
"save_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"case",
"xml_",
"._",
"apps_",
"._",
"case_",
"._",
"xform_",
"import_",
"get",
"\\u",
"and",
"\\u",
"check",
"\\u",
"xform",
"\\u",
"domain_",
",_",
"process",
"\\u",
"case",
"s",
"\\u",
"with",
"\\u",
"case",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"collections_",
"import_",
"defaultdict_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"couch",
"forms_",
"._",
"models_",
"import_",
"XF",
"orm",
"Instance_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"dim",
"agi",
"_",
"._",
"utils_",
"._",
"parsing_",
"import_",
"string",
"\\u",
"to",
"\\u",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"management_",
"._",
"base_",
"import_",
"Base",
"Command_",
",_",
"Command",
"Error_",
",_",
"Label",
"Command_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"optparse_",
"import_",
"make",
"\\u",
"option_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"core",
"hq",
"_",
"._",
"apps_",
"._",
"cleanup_",
"._",
"xform",
"s_",
"import_",
"iter",
"\\u",
"problem",
"\\u",
"forms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core",
"hq",
"_",
"._",
"form",
"\\u",
"processor_",
"._",
"backends_",
"._",
"couch",
"_",
"._",
"case",
"db_",
"import_",
"Case",
"Db",
"Cache",
"Cou",
"ch_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u",
"process",
"\\u",
"cases_",
"(_",
"xform_",
",_",
"config_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Creat",
"es",
" ",
"or",
" ",
"update",
"s",
" ",
"case",
" ",
"object",
"s",
" ",
"whi",
"ch",
" ",
"live",
" ",
"outsi",
"de",
" ",
"of",
" ",
"the",
" ",
"form",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"reconcile",
" ",
"is",
" ",
"true",
" ",
"it",
" ",
"will",
" ",
"perform",
" ",
"an",
" ",
"addition",
"al",
" ",
"step",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"recon",
"cil",
"ing",
" ",
"the",
" ",
"case",
" ",
"update",
" ",
"histo",
"ry",
" ",
"after",
" ",
"the",
" ",
"case",
" ",
"is",
" ",
"process",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"warnings_",
"._",
"warn_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Thi",
"s",
" ",
"function",
" ",
"is",
" ",
"depre",
"cated",
".",
" ",
"You",
" ",
"shou",
"ld",
" ",
"be",
" ",
"usi",
"ng",
" ",
"Subm",
"ission",
"Post",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Dep",
"reca",
"tion",
"Warning_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert_",
"getattr_",
"(_",
"settings_",
",_",
"'",
"UNIT",
"\\u",
"TESTING",
"'_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"domain_",
"=_",
"get",
"\\u",
"and",
"\\u",
"check",
"\\u",
"xform",
"\\u",
"domain_",
"(_",
"xform_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"with_",
"Case",
"Db",
"Cache",
"Cou",
"ch_",
"(_",
"domain_",
"=_",
"domain_",
",_",
"lock_",
"=_",
"True_",
",_",
"delete",
"d\\u",
"ok_",
"=_",
"True_",
")_",
"as_",
"case",
"\\u",
"db_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"case",
"\\u",
"result_",
"=_",
"process",
"\\u",
"case",
"s",
"\\u",
"with",
"\\u",
"case",
"db_",
"(_",
"[_",
"xform_",
"]_",
",_",
"case",
"\\u",
"db_",
",_",
"config_",
"=_",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cases_",
"=_",
"case",
"\\u",
"result_",
"._",
"cases_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"docs_",
"=_",
"[_",
"xform_",
"]_",
"+_",
"cases_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"now_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"case_",
"in_",
"cases_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"case_",
"._",
"server",
"\\u",
"modifi",
"ed",
"\\u",
"on_",
"=_",
"now_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"XF",
"orm",
"Instance_",
"._",
"get",
"\\u",
"db_",
"(_",
")_",
"._",
"bul",
"k",
"\\u",
"save_",
"(_",
"docs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"case_",
"in_",
"cases_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"case",
"\\u",
"post",
"\\u",
"save_",
"._",
"send_",
"(_",
"Comm",
"Care",
"Case_",
",_",
"case_",
"=_",
"case_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"case",
"\\u",
"result_",
"._",
"commit",
"\\u",
"dir",
"tin",
"ess",
"\\u",
"flags_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"cases_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"repro",
"cess",
"\\u",
"form",
"\\u",
"cases_",
"(_",
"form_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"For",
" ",
"a",
" ",
"give",
"n",
" ",
"form",
",",
" ",
"repro",
"cess",
" ",
"all",
" ",
"case",
" ",
"element",
"s",
" ",
"insi",
"de",
" ",
"it",
".",
" ",
"Thi",
"s",
" ",
"operati",
"on",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"shou",
"ld",
" ",
"be",
" ",
"a",
" ",
"no",
"-",
"op",
" ",
"if",
" ",
"the",
" ",
"form",
" ",
"was",
" ",
"suce",
"ss",
"full",
"y",
" ",
"process",
"ed",
",",
" ",
"but",
" ",
"shou",
"ld",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"correct",
"ly",
" ",
"inject",
" ",
"the",
" ",
"update",
" ",
"int",
"o",
" ",
"the",
" ",
"case",
" ",
"histo",
"ry",
" ",
"if",
" ",
"the",
" ",
"form",
" ",
"was",
" ",
"NOT",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"success",
"full",
"y",
" ",
"process",
"ed",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"process",
"\\u",
"cases_",
"(_",
"form_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"mark",
" ",
"clean",
"ed",
" ",
"up",
" ",
"now",
" ",
"tha",
"t",
" ",
"we",
"'",
"ve",
" ",
"repro",
"cess",
"ed",
" ",
"it_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"form_",
"._",
"doc",
"\\u",
"type_",
"!=_",
"'",
"XF",
"orm",
"Insta",
"nce",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"form_",
"=_",
"XF",
"orm",
"Instance_",
"._",
"get_",
"(_",
"form_",
"._",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"form_",
"._",
"doc",
"\\u",
"type_",
"=_",
"'",
"XF",
"orm",
"Insta",
"nce",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"form_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Command_",
"(_",
"Base",
"Command_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"args_",
"=_",
"'<",
"domain",
">",
" ",
"<",
"sinc",
"e",
">'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"help_",
"=_",
"(_",
"'",
"Repr",
"oce",
"sses",
" ",
"all",
" ",
"document",
"s",
" ",
"tagg",
"ed",
" ",
"as",
" ",
"error",
"s",
" ",
"and",
" ",
"trie",
"s",
" ",
"to",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"regenerate",
" ",
"the",
" ",
"appropr",
"iate",
" ",
"case",
" ",
"blocks",
" ",
"for",
" ",
"them",
".",
" ",
"Can",
" ",
"pass",
" ",
"in",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"a",
" ",
"domain",
" ",
"and",
" ",
"date",
" ",
"to",
" ",
"process",
" ",
"forms",
" ",
"receive",
"d",
" ",
"after",
" ",
"tha",
"t",
" ",
"date",
" ",
"or",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"just",
" ",
"a",
" ",
"domain",
" ",
"to",
" ",
"process",
" ",
"all",
" ",
"problem",
" ",
"forms",
" ",
"in",
" ",
"the",
" ",
"domain",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"option",
"\\u",
"list_",
"=_",
"Label",
"Command_",
"._",
"option",
"\\u",
"list_",
"+_",
"(_",
"make",
"\\u",
"option_",
"(_",
"'--",
"dry",
"run",
"'_",
",_",
"action_",
"=_",
"'",
"store",
"\\u",
"true",
"'_",
",_",
"dest_",
"=_",
"'",
"dry",
"run",
"'_",
",_",
"default_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Don",
"'",
"t",
" ",
"do",
" ",
"the",
" ",
"actual",
" ",
"repro",
"cess",
"ing",
",",
" ",
"just",
" ",
"print",
" ",
"the",
" ",
"ids",
" ",
"tha",
"t",
" ",
"wou",
"ld",
" ",
"be",
" ",
"affect",
"ed",
"\"_",
")_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Command_",
"(_",
"Base",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"handle_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"options_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"domain_",
"=_",
"since_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"len_",
"(_",
"args_",
")_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"domain_",
"=_",
"args_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"len_",
"(_",
"args_",
")_",
"==_",
"2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"domain_",
"=_",
"args_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"since_",
"=_",
"string",
"\\u",
"to",
"\\u",
"datetime_",
"(_",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Command",
"Error_",
"(_",
"'",
"Us",
"age",
":",
" ",
"%",
"s",
"\\\\",
"n",
"%",
"s",
"'_",
"%_",
"(_",
"self_",
"._",
"args_",
",_",
"self_",
"._",
"help_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"succeeded_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"failed_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"error",
"\\u",
"messages_",
"=_",
"defaultdict_",
"(_",
"lambda_",
":_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"form_",
"in_",
"iter",
"\\u",
"problem",
"\\u",
"forms_",
"(_",
"domain_",
",_",
"since_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"%",
"s",
"\\\\",
"t",
"%",
"s",
"\\\\",
"t",
"%",
"s",
"\\\\",
"t",
"%",
"s",
"\\\\",
"t",
"%",
"s",
"\"_",
"%_",
"(_",
"form_",
"._",
"\\u",
"id_",
",_",
"form_",
"._",
"receive",
"d\\u",
"on_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"form_",
"._",
"xmlns_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"form_",
"._",
"get",
"\\u",
"data_",
"(_",
"'",
"form",
"/",
"meta",
"/",
"user",
"name",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"form_",
"._",
"problem_",
"._",
"strip_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"options_",
"[_",
"\"",
"dry",
"run",
"\"_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"repro",
"cess",
"\\u",
"form",
"\\u",
"cases_",
"(_",
"form_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"failed_",
"._",
"append_",
"(_",
"form_",
"._",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"error",
"\\u",
"messages_",
"[_",
"str_",
"(_",
"e_",
")_",
"]_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"succeeded_",
"._",
"append_",
"(_",
"form_",
"._",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"print_",
"\"%",
"s",
" ",
"/",
" ",
"%",
"s",
" ",
"forms",
" ",
"success",
"full",
"y",
" ",
"process",
"ed",
",",
" ",
"%",
"s",
" ",
"fail",
"ure",
"s",
"\"_",
"%_",
"(_",
"len_",
"(_",
"succeeded_",
")_",
",_",
"len_",
"(_",
"succeeded_",
")_",
"+_",
"len_",
"(_",
"failed_",
")_",
",_",
"len_",
"(_",
"failed_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"error",
"\\u",
"messages_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"\"",
"The",
" ",
"follow",
"ing",
" ",
"error",
"s",
" ",
"wer",
"e",
" ",
"see",
"n",
":",
" ",
"\\\\",
"n",
"%",
"s",
"\"_",
"%_",
"(_",
"\"\\\\",
"n",
"\"_",
"._",
"join_",
"(_",
"\"%",
"s",
":",
" ",
"%",
"s",
"\"_",
"%_",
"(_",
"v_",
",_",
"k_",
")_",
"for_",
"k_",
",_",
"v_",
"in_",
"error",
"\\u",
"messages_",
"._",
"items_",
"(_",
")_",
")_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/samba/external/testtools/testresult/__init__.py | [
{
"content": "# Copyright (c) 2009 testtools developers. See LICENSE for details.\n\n\"\"\"Test result objects.\"\"\"\n\n__all__ = [\n 'ExtendedToOriginalDecorator',\n 'MultiTestResult',\n 'TestResult',\n 'TextTestResult',\n 'ThreadsafeForwardingResult',\n ]\n\nfrom testtools.testresult.real import (\n ExtendedToOriginalDecorator,\n MultiTestResult,\n TestResult,\n TextTestResult,\n ThreadsafeForwardingResult,\n )\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
" ",
"200",
"9",
" ",
"testt",
"ool",
"s",
" ",
"developer",
"s",
".",
" ",
"See",
" ",
"LICENSE",
" ",
"for",
" ",
"deta",
"il",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Test",
" ",
"result",
" ",
"object",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u",
"all\\u\\u_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Extend",
"ed",
"To",
"Origina",
"l",
"Decorat",
"or",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Multi",
"Test",
"Result",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Test",
"Result",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Text",
"Test",
"Result",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Thread",
"safe",
"Forward",
"ing",
"Result",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"testtools_",
"._",
"testre",
"sult_",
"._",
"real_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Extend",
"ed",
"To",
"Origina",
"l",
"Decorator_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Multi",
"Test",
"Result_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Test",
"Result_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Text",
"Test",
"Result_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Thread",
"safe",
"Forward",
"ing",
"Result_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | openstack/freezer-web-ui/disaster_recovery/jobs/workflows/update_actions.py | [
{
"content": "# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\n\nfrom django import shortcuts\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom horizon import exceptions\nfrom horizon import forms\nfrom horizon import workflows\n\nimport disaster_recovery.api.api as freezer_api\n\n\nLOG = logging.getLogger(__name__)\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class ActionsConfigurationAction(workflows.Action):\n actions = forms.CharField(\n required=False)\n\n job_id = forms.CharField(\n required=False)\n\n class Meta(object):\n name = _(\"Actions\")\n slug = \"actions\"\n help_text_template = \"disaster_recovery/jobs\" \\\n \"/_actions.html\"",
"metadata": "root.ActionsConfigurationAction",
"header": "['module', '___EOS___']",
"index": 29
},
{
"content": "class ActionsConfiguration(workflows.Step):\n action_class = ActionsConfigurationAction\n contributes = ('actions', 'job_id')",
"metadata": "root.ActionsConfiguration",
"header": "['module', '___EOS___']",
"index": 43
},
{
"content": "class UpdateActions(workflows.Workflow):\n slug = \"update_actions\"\n name = _(\"Update Actions\")\n finalize_button_name = _(\"Save\")\n success_message = _('Actions updated correctly.')\n failure_message = _('Unable to update actions.')\n success_url = \"horizon:disaster_recovery:jobs:index\"\n default_steps = (ActionsConfiguration,)\n",
"metadata": "root.UpdateActions",
"header": "['module', '___EOS___']",
"index": 48
},
{
"content": " def handle(self, request, context):\n try:\n if context['job_id'] != '':\n freezer_api.Job(request).update_actions(context['job_id'],\n context['actions'])\n return shortcuts.redirect('horizon:disaster_recovery:jobs:index')\n except Exception:\n exceptions.handle(request)\n return False",
"metadata": "root.UpdateActions.handle",
"header": "['class', 'UpdateActions', '(', 'workflows', '.', 'Workflow', ')', ':', '___EOS___']",
"index": 57
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"(",
"c",
")",
" ",
"Copy",
"right",
" ",
"2014",
",",
"201",
"5",
" ",
"He",
"wle",
"tt",
"-",
"Packa",
"rd",
" ",
"Dev",
"elo",
"pme",
"nt",
" ",
"Compa",
"ny",
",",
" ",
"L",
".",
"P",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"import_",
"shortcuts_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"uge",
"ttext",
"\\u",
"lazy_",
"as_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"exceptions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"forms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"horizon_",
"import_",
"workflows_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"disas",
"ter",
"\\u",
"recover",
"y_",
"._",
"api_",
"._",
"api_",
"as_",
"freez",
"er",
"\\u",
"api_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"LOG_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Action",
"s",
"Configura",
"tion",
"Action_",
"(_",
"workflows_",
"._",
"Action_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"actions_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"job",
"\\u",
"id_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Meta_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"\\u_",
"(_",
"\"",
"Action",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slug_",
"=_",
"\"",
"action",
"s",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"help",
"\\u",
"text",
"\\u",
"template_",
"=_",
"\"",
"disas",
"ter",
"\\u",
"recover",
"y",
"/",
"jobs",
"\"_",
"\"/",
"\\u",
"action",
"s",
".",
"html",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Action",
"s",
"Configuration_",
"(_",
"workflows_",
"._",
"Step_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"action",
"\\u",
"class_",
"=_",
"Action",
"s",
"Configura",
"tion",
"Action_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"contribute",
"s_",
"=_",
"(_",
"'",
"action",
"s",
"'_",
",_",
"'",
"job",
"\\u",
"id",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Update",
"Actions_",
"(_",
"workflows_",
"._",
"Workflow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"slug_",
"=_",
"\"",
"update",
"\\u",
"action",
"s",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"name_",
"=_",
"\\u_",
"(_",
"\"",
"Update",
" ",
"Action",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"finalize",
"\\u",
"button",
"\\u",
"name_",
"=_",
"\\u_",
"(_",
"\"",
"Save",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"success",
"\\u",
"message_",
"=_",
"\\u_",
"(_",
"'",
"Action",
"s",
" ",
"update",
"d",
" ",
"correct",
"ly",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fail",
"ure",
"\\u",
"message_",
"=_",
"\\u_",
"(_",
"'",
"Una",
"ble",
" ",
"to",
" ",
"update",
" ",
"action",
"s",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"success",
"\\u",
"url_",
"=_",
"\"",
"horizon",
":",
"disas",
"ter",
"\\u",
"recover",
"y",
":",
"jobs",
":",
"index",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"default",
"\\u",
"steps_",
"=_",
"(_",
"Action",
"s",
"Configuration_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Update",
"Actions_",
"(_",
"workflows_",
"._",
"Workflow_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"handle_",
"(_",
"self_",
",_",
"request_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"context_",
"[_",
"'",
"job",
"\\u",
"id",
"'_",
"]_",
"!=_",
"''_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"freez",
"er",
"\\u",
"api_",
"._",
"Job_",
"(_",
"request_",
")_",
"._",
"update",
"\\u",
"actions_",
"(_",
"context_",
"[_",
"'",
"job",
"\\u",
"id",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"[_",
"'",
"action",
"s",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"shortcuts_",
"._",
"redirect_",
"(_",
"'",
"horizon",
":",
"disas",
"ter",
"\\u",
"recover",
"y",
":",
"jobs",
":",
"index",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exceptions_",
"._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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Testing equality to None | what-studio/profiling/test/test_tracing.py | [
{
"content": "def test_setprofile():\n profiler = TracingProfiler()\n assert sys.getprofile() is None\n with profiler:\n assert sys.getprofile() == profiler._profile\n assert sys.getprofile() is None\n sys.setprofile(lambda *x: x)\n with pytest.raises(RuntimeError):\n profiler.start()\n sys.setprofile(None)",
"metadata": "root.test_setprofile",
"header": "['module', '___EOS___']",
"index": 15
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"setp",
"rofile",
"_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"profiler_",
"=_",
"Trac",
"ing",
"Profiler",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"sys_",
"._",
"getpr",
"ofile_",
"(_",
")_",
"is_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"profiler_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"sys_",
"._",
"getpr",
"ofile_",
"(_",
")_",
"==_",
"profiler_",
"._",
"\\u",
"profile_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"assert_",
"sys_",
"._",
"getpr",
"ofile_",
"(_",
")_",
"is_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"setp",
"rofile",
"_",
"(_",
"lambda_",
"*_",
"x_",
":_",
"x_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"pytest_",
"._",
"raises_",
"(_",
"Run",
"time",
"Error_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"profiler_",
"._",
"start_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sys_",
"._",
"setp",
"rofile",
"_",
"(_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | ambitioninc/django-query-builder/querybuilder/tests/migrations/0001_initial.py | [
{
"content": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.1 on 2016-02-12 19:03\nfrom __future__ import unicode_literals\n\n# These migrations should only be run during tests and not in your installed app.\ntry:\n import django.contrib.postgres.fields.jsonb\n json_field = django.contrib.postgres.fields.jsonb.JSONField()\nexcept ImportError:\n import jsonfield.fields\n json_field = jsonfield.fields.JSONField()\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Generate",
"d",
" ",
"by",
" ",
"Dj",
"ang",
"o",
" ",
"1.9",
".1",
" ",
"on",
" ",
"2016",
"-0",
"2",
"-1",
"2",
" ",
"1",
"9",
":",
"03_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
"se",
" ",
"migrati",
"ons",
" ",
"shou",
"ld",
" ",
"only",
" ",
"be",
" ",
"run",
" ",
"dur",
"ing",
" ",
"tests",
" ",
"and",
" ",
"not",
" ",
"in",
" ",
"your",
" ",
"install",
"ed",
" ",
"app",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"django_",
"._",
"contrib_",
"._",
"postgres_",
"._",
"fields_",
"._",
"json",
"b_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"json",
"\\u",
"field_",
"=_",
"django_",
"._",
"contrib_",
"._",
"postgres_",
"._",
"fields_",
"._",
"json",
"b_",
"._",
"JSO",
"NF",
"ield_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"jsonfi",
"eld_",
"._",
"fields_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"json",
"\\u",
"field_",
"=_",
"jsonfi",
"eld_",
"._",
"fields_",
"._",
"JSO",
"NF",
"ield_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"import_",
"migrations_",
",_",
"models_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"django_",
"._",
"db_",
"._",
"models_",
"._",
"deletion_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | pydata/xarray/xarray/backends/h5netcdf_.py | [
{
"content": " def get_dimensions(self):\n return self.ds.dimensions",
"metadata": "root.H5NetCDFStore.get_dimensions",
"header": "['class', 'H5NetCDFStore', '(', 'WritableCFDataStore', ')', ':', '___EOS___']",
"index": 74
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"H",
"5",
"Net",
"CD",
"FS",
"tore_",
"(_",
"Writ",
"able",
"CF",
"Data",
"Store_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"dimensions_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"ds_",
"._",
"dimensions_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | CGATOxford/cgat/scripts/expression2expression.py | [
{
"content": "'''expression2expression.py - RNAseq filtering and normalisation\n=============================================================\n\n:Author: Mike Morgan\n:Release: $Id$\n:Date: |today|\n:Tags: Python\n\nPurpose\n-------\n\nScript for normalisation and transformation of RNAseq timeseries data.\n\nScript functions are:\n* Normalise RNAseq libraries using DESeq size factors\n* Transform counts tables by variance stablising transformation\n* filter expression data on sum of absolute covariance\n* fit polynomial model to data with significance testing\n* calculate average expression over replicates for transformed time series\nexpression data\n\nUsage\n-----\n\n::\n # applying library size normalisation and variance stabilising transformation\n head input_counts.tsv\n\n # zero-values and genes with mean counts <10 are filtered out\n gene_id LPS.000.R1 LPS.000.R2 LPS.000.R3 LPS.001.R1 LPS.001.R2\n ENSMUSG00000000544 0 0 0 0 0\n ENSMUSG00000000817 13 8 12 5 20\n ENSMUSG00000001138 3878 3868 2484 1340 1266\n ENSMUSG00000001143 2891 2668 1573 931 1041\n\n python timeseries_analysis.py --task=deseq --replicates=R1,R2,R3\n --time=0,1,3,6,12,24,48 input_counts.tsv > output_file.tsv\n\n head output_file.tsv\n\n gene_id LPS.000.R1 LPS.000.R2 LPS.000.R3 LPS.001.R1 LPS.001.R2\n ENSMUSG00000001138 11.20 11.06 11.16 10.73 10.35\n ENSMUSG00000001143 10.78 10.53 10.50 10.21 10.07\n\n\nInput files is provided as the final argument to the script. The exact form\n and nature of the input file is dependent on the task to be performed.\n\nOptions\n-------\n\nEach set of options is dependent on the task applied. Not all options\nare appropriate for all tasks. Please see details below for the exact\nintended usage of these options.\n\ntask::\n\n The task to perform on the input. This will determine which options will\n be functional.\n\n Choices are::\n ``deseq`` - perform library size normalisation and variance\n stabilising transformation on expression count data.\n Active options:\n --time - comma separated list of time points measured,\n in numerical order\n --replicates - comma separated list of labels associated\n with each replicate\n\n ``masigpro`` - fit polynomial model to timeseries data to select\n differentially expressed genes across the timeseries.\n See maSigPro documentation for more details.\n Active options::\n --orders - order of polynomial model to fit\n --fdr - false discovery rate for calling DEGs\n --padjust - multiple testing correction to apply\n --stepwise - stepwise regression to apply. forwards\n or backwards\n --pinclude - largest p-value required for inclusion\n in the model by stepwise regression\n --rsquared - variance explained cut-off for DEGs\n --vargroup - variable group to report. Either `each`,\n all` or `group`.\n\n ``sumcovar`` - filter genes on the sum of their absolute covariance\n Active options::\n --reps - comma-separated list of replicate IDs\n --timepoints - comma-separated list of time points\n --quantile - quantile threshold to apply for filtering\n\n ``average_expression`` - calculate average expression over replicates\n at each time point\n\n\nType::\n\n python expression2expression.py --help\n\nfor command line help.\n\nCommand line options\n--------------------\n\n'''\n\nimport sys\nimport CGAT.Experiment as E\nimport CGAT.Timeseries as TS\n\n\n\nif __name__ == \"__main__\":\n sys.exit(main(sys.argv))\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def main(argv=None):\n \"\"\"script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n \"\"\"\n\n if argv is None:\n argv = sys.argv\n\n # setup command line parser\n parser = E.OptionParser(version=\"%prog version: $Id$\",\n usage=globals()[\"__doc__\"])\n\n parser.add_option(\"-t\", \"--test\", dest=\"test\", type=\"string\",\n help=\"supply help\")\n\n parser.add_option(\"--time\", dest=\"timepoints\", type=\"string\",\n help=\"a comma-separated list of time points measured\")\n\n parser.add_option(\"--replicates\", dest=\"reps\", type=\"string\",\n help=\"a comma-separated list of replicate IDs\")\n\n parser.add_option(\"--conditions\", dest=\"conditions\", type=\"string\",\n help=\"a comma-separated list of experimental conditions\")\n\n parser.add_option(\"--orders\", dest=\"orders\", type=\"int\",\n help=\"order of polynomial terms to include in\"\n \"maSigPro linear model\")\n\n parser.add_option(\"--fdr\", dest=\"fdr\", type=\"string\",\n help=\"FDR for calling DEGs\")\n\n parser.add_option(\"--padjust\", dest=\"padjust\", type=\"string\",\n help=\"multiple testing correction to apply to\"\n \"control FDR\")\n\n parser.add_option(\"--stepwise\", dest=\"stepwise\", type=\"string\",\n help=\"stepwise regression to use\")\n\n parser.add_option(\"--pinclude\", dest=\"pinclude\", type=\"string\",\n help=\"p-value for inclusion in stepwise regression\")\n\n parser.add_option(\"--rsquared\", dest=\"rsquared\", type=\"string\",\n help=\"rsquared cut-off for DEG reporting\")\n\n parser.add_option(\"--var-group\", dest=\"vargroup\", type=\"string\",\n help=\"variable group reporting. each, all or\"\n \"group\")\n\n parser.add_option(\"--task\", dest=\"task\", type=\"string\",\n help=\"analysis task to be executed\")\n\n parser.add_option(\"--infile\", dest=\"infile\", type=\"string\",\n help=\"input file path\")\n\n parser.add_option(\"--quantile\", dest=\"quantile\", type=\"int\",\n help=\"see pipeline.ini for explanation\")\n\n# add common options (-h/--help, ...) and parse command line\n\n (options, args) = E.Start(parser, argv=argv)\n\n infile = argv[-1]\n\n parser.set_defaults(cutHeight=0,\n conditions=None,\n split=False,\n cluster_size=30)\n\n if options.task == \"deseq\":\n timepoints = [int(x) for x in options.timepoints.split(\",\")]\n timepoints.sort()\n reps = [x for x in options.reps.split(\",\")]\n if not options.conditions:\n conditions = None\n else:\n conditions = [x for x in options.conditions.split(\",\")]\n\n data_frame = TS.deseqNormalize(infile=infile,\n time_points=timepoints,\n reps=reps,\n conditions=conditions)\n\n elif options.task == \"masigpro\":\n data_frame = TS.maSigPro(infile=infile,\n order_terms=int(options.orders),\n fdr=float(options.fdr),\n adjust=options.padjust,\n stepwise=options.stepwise,\n include_p=float(options.pinclude),\n rsq=float(options.rsquared),\n var_group=options.vargroup)\n\n elif options.task == \"sumcovar\":\n timepoints = [int(x) for x in options.timepoints.split(\",\")]\n reps = [x for x in options.reps.split(\",\")]\n data_frame = TS.covarFilter(infile=infile,\n time_points=timepoints,\n replicates=reps,\n quantile=int(options.quantile))\n\n elif options.task == \"average_expression\":\n data_frame = TS.avTimeExpression(infile)\n\n else:\n pass\n\n data_frame.to_csv(options.stdout,\n sep=\"\\t\",\n header=True,\n index_label=\"gene_id\")\n\n # Write footer and output benchmark information.\n E.Stop()",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 110
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"'''",
"express",
"ion",
"2e",
"xpr",
"ession",
".",
"py",
" ",
"-",
" ",
"RNA",
"seq",
" ",
"filtering",
" ",
"and",
" ",
"normali",
"sation",
"\\",
"10",
";",
"==============",
"==============",
"==============",
"==============",
"=====",
"\\",
"10",
";",
"\\",
"10",
";",
":",
"Author",
":",
" ",
"Mik",
"e",
" ",
"Mor",
"gan",
"\\",
"10",
";",
":",
"Release",
":",
" ",
"$",
"Id",
"$",
"\\",
"10",
";",
":",
"Date",
":",
" ",
"|",
"toda",
"y",
"|",
"\\",
"10",
";",
":",
"Ta",
"gs",
":",
" ",
"Pyth",
"on",
"\\",
"10",
";",
"\\",
"10",
";",
"Pur",
"pose",
"\\",
"10",
";",
"-------",
"\\",
"10",
";",
"\\",
"10",
";",
"Script",
" ",
"for",
" ",
"normali",
"sation",
" ",
"and",
" ",
"transformation",
" ",
"of",
" ",
"RNA",
"seq",
" ",
"times",
"eries",
" ",
"data",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Script",
" ",
"function",
"s",
" ",
"are",
":",
"\\",
"10",
";",
"*",
" ",
"Normal",
"ise",
" ",
"RNA",
"seq",
" ",
"librar",
"ies",
" ",
"usi",
"ng",
" ",
"DES",
"eq",
" ",
"size",
" ",
"factor",
"s",
"\\",
"10",
";",
"*",
" ",
"Transform",
" ",
"count",
"s",
" ",
"tables",
" ",
"by",
" ",
"varian",
"ce",
" ",
"stab",
"lis",
"ing",
" ",
"transformation",
"\\",
"10",
";",
"*",
" ",
"filter",
" ",
"express",
"ion",
" ",
"data",
" ",
"on",
" ",
"sum",
" ",
"of",
" ",
"abs",
"olute",
" ",
"covariance",
"\\",
"10",
";",
"*",
" ",
"fit",
" ",
"polynomial",
" ",
"model",
" ",
"to",
" ",
"data",
" ",
"with",
" ",
"significan",
"ce",
" ",
"testi",
"ng",
"\\",
"10",
";",
"*",
" ",
"calcul",
"ate",
" ",
"averag",
"e",
" ",
"express",
"ion",
" ",
"over",
" ",
"replicate",
"s",
" ",
"for",
" ",
"transforme",
"d",
" ",
"time",
" ",
"series",
"\\",
"10",
";",
"express",
"ion",
" ",
"data",
"\\",
"10",
";",
"\\",
"10",
";",
"Us",
"age",
"\\",
"10",
";",
"-----",
"\\",
"10",
";",
"\\",
"10",
";",
"::",
"\\",
"10",
";",
" ",
" ",
" ",
"#",
" ",
"appl",
"ying",
" ",
"librar",
"y",
" ",
"size",
" ",
"normali",
"sation",
" ",
"and",
" ",
"varian",
"ce",
" ",
"stab",
"ilis",
"ing",
" ",
"transformation",
"\\",
"10",
";",
" ",
" ",
" ",
"head",
" ",
"input",
"\\u",
"count",
"s",
".",
"tsv",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
"#",
" ",
"zero",
"-",
"values",
" ",
"and",
" ",
"gene",
"s",
" ",
"with",
" ",
"mean",
" ",
"count",
"s",
" ",
"<",
"10",
" ",
"are",
" ",
"filter",
"ed",
" ",
"out",
"\\",
"10",
";",
" ",
" ",
" ",
"gene",
"\\u",
"id",
" ",
" ",
" ",
" ",
"LP",
"S",
".00",
"0.",
"R1",
" ",
" ",
"LP",
"S",
".00",
"0.",
"R2",
" ",
" ",
"LP",
"S",
".00",
"0.",
"R3",
" ",
" ",
"LP",
"S",
".00",
"1",
".",
"R1",
" ",
" ",
"LP",
"S",
".00",
"1",
".",
"R2",
"\\",
"10",
";",
" ",
" ",
" ",
"ENS",
"MUS",
"G",
"00000000",
"544",
" ",
"0",
" ",
" ",
" ",
"0",
" ",
" ",
" ",
"0",
" ",
" ",
" ",
"0",
" ",
" ",
" ",
"0",
"\\",
"10",
";",
" ",
" ",
" ",
"ENS",
"MUS",
"G",
"00000000",
"817",
" ",
"13",
" ",
" ",
"8",
" ",
" ",
" ",
"1",
"2",
" ",
" ",
"5",
" ",
" ",
" ",
"20",
"\\",
"10",
";",
" ",
" ",
" ",
"ENS",
"MUS",
"G",
"00000001",
"138",
" ",
"387",
"8",
" ",
" ",
" ",
" ",
"386",
"8",
" ",
" ",
" ",
" ",
"248",
"4",
" ",
" ",
" ",
" ",
"134",
"0",
" ",
" ",
" ",
" ",
"126",
"6",
"\\",
"10",
";",
" ",
" ",
" ",
"ENS",
"MUS",
"G",
"00000001",
"143",
" ",
"289",
"1",
" ",
" ",
" ",
" ",
"266",
"8",
" ",
" ",
" ",
" ",
"157",
"3",
" ",
" ",
" ",
" ",
"931",
" ",
" ",
" ",
" ",
" ",
"104",
"1",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
"python",
" ",
"times",
"eries",
"\\u",
"analys",
"is",
".",
"py",
" ",
"--",
"task",
"=",
"dese",
"q",
" ",
"--",
"replicate",
"s",
"=",
"R1",
",",
"R2",
",",
"R3",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"--",
"time",
"=",
"0",
",",
"1",
",",
"3",
",",
"6",
",",
"1",
"2",
",",
"24",
",",
"4",
"8",
" ",
"input",
"\\u",
"count",
"s",
".",
"tsv",
" ",
">",
" ",
"output",
"\\u",
"file",
".",
"tsv",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
"head",
" ",
"output",
"\\u",
"file",
".",
"tsv",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
"gene",
"\\u",
"id",
" ",
" ",
" ",
" ",
"LP",
"S",
".00",
"0.",
"R1",
" ",
" ",
"LP",
"S",
".00",
"0.",
"R2",
" ",
" ",
"LP",
"S",
".00",
"0.",
"R3",
" ",
" ",
"LP",
"S",
".00",
"1",
".",
"R1",
" ",
" ",
"LP",
"S",
".00",
"1",
".",
"R2",
"\\",
"10",
";",
" ",
" ",
" ",
"ENS",
"MUS",
"G",
"00000001",
"138",
" ",
"11.",
"20",
" ",
" ",
" ",
"11.",
"0",
"6",
" ",
" ",
" ",
"11.",
"16",
" ",
" ",
" ",
"10.",
"7",
"3",
" ",
" ",
" ",
"10.",
"3",
"5",
"\\",
"10",
";",
" ",
" ",
" ",
"ENS",
"MUS",
"G",
"00000001",
"143",
" ",
"10.",
"7",
"8",
" ",
" ",
" ",
"10.5",
"3",
" ",
" ",
" ",
"10.5",
"0",
" ",
" ",
" ",
"10.2",
"1",
" ",
" ",
" ",
"10.",
"0",
"7",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Inp",
"ut",
" ",
"files",
" ",
"is",
" ",
"provided",
" ",
"as",
" ",
"the",
" ",
"final",
" ",
"argu",
"ment",
" ",
"to",
" ",
"the",
" ",
"script",
".",
" ",
" ",
"The",
" ",
"exact",
" ",
"form",
"\\",
"10",
";",
" ",
"and",
" ",
"natur",
"e",
" ",
"of",
" ",
"the",
" ",
"input",
" ",
"file",
" ",
"is",
" ",
"dependent",
" ",
"on",
" ",
"the",
" ",
"task",
" ",
"to",
" ",
"be",
" ",
"perform",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Optio",
"ns",
"\\",
"10",
";",
"-------",
"\\",
"10",
";",
"\\",
"10",
";",
"Ea",
"ch",
" ",
"set",
" ",
"of",
" ",
"options",
" ",
"is",
" ",
"dependent",
" ",
"on",
" ",
"the",
" ",
"task",
" ",
"applied",
".",
" ",
" ",
"Not",
" ",
"all",
" ",
"options",
"\\",
"10",
";",
"are",
" ",
"appropr",
"iate",
" ",
"for",
" ",
"all",
" ",
"task",
"s",
".",
" ",
" ",
"Ple",
"ase",
" ",
"see",
" ",
"deta",
"il",
"s",
" ",
"belo",
"w",
" ",
"for",
" ",
"the",
" ",
"exact",
"\\",
"10",
";",
"inten",
"ded",
" ",
"usage",
" ",
"of",
" ",
"these",
" ",
"options",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"task",
"::",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"The",
" ",
"task",
" ",
"to",
" ",
"perform",
" ",
"on",
" ",
"the",
" ",
"input",
".",
" ",
" ",
"Thi",
"s",
" ",
"will",
" ",
"dete",
"rmin",
"e",
" ",
"whi",
"ch",
" ",
"options",
" ",
"will",
"\\",
"10",
";",
" ",
" ",
"be",
" ",
"functional",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
"Choi",
"ces",
" ",
"are",
"::",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"dese",
"q",
"``",
" ",
"-",
" ",
"perform",
" ",
"librar",
"y",
" ",
"size",
" ",
"normali",
"sation",
" ",
"and",
" ",
"varian",
"ce",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"stab",
"ilis",
"ing",
" ",
"transformation",
" ",
"on",
" ",
"express",
"ion",
" ",
"count",
" ",
"data",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Activ",
"e",
" ",
"options",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"--",
"time",
" ",
"-",
" ",
"comma",
" ",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"time",
" ",
"points",
" ",
"measure",
"d",
",",
"\\",
"10",
";",
" ",
"in",
" ",
"numerical",
" ",
"order",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"--",
"replicate",
"s",
" ",
"-",
" ",
"comma",
" ",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"labels",
" ",
"associate",
"d",
"\\",
"10",
";",
" ",
"with",
" ",
"each",
" ",
"replicate",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"mas",
"ig",
"pro",
"``",
" ",
"-",
" ",
"fit",
" ",
"polynomial",
" ",
"model",
" ",
"to",
" ",
"times",
"eries",
" ",
"data",
" ",
"to",
" ",
"select",
"\\",
"10",
";",
" ",
"differential",
"ly",
" ",
"express",
"ed",
" ",
"gene",
"s",
" ",
"acro",
"ss",
" ",
"the",
" ",
"times",
"eries",
".",
"\\",
"10",
";",
" ",
"See",
" ",
"ma",
"Sig",
"Pro",
" ",
"documentation",
" ",
"for",
" ",
"more",
" ",
"deta",
"il",
"s",
".",
"\\",
"10",
";",
" ",
"Activ",
"e",
" ",
"options",
"::",
"\\",
"10",
";",
" ",
" ",
"--",
"order",
"s",
" ",
"-",
" ",
"order",
" ",
"of",
" ",
"polynomial",
" ",
"model",
" ",
"to",
" ",
"fit",
"\\",
"10",
";",
" ",
" ",
"--",
"fd",
"r",
" ",
"-",
" ",
"fal",
"se",
" ",
"discove",
"ry",
" ",
"rate",
" ",
"for",
" ",
"calling",
" ",
"DEG",
"s",
"\\",
"10",
";",
" ",
" ",
"--",
"pad",
"just",
" ",
"-",
" ",
"multiple",
" ",
"testi",
"ng",
" ",
"correcti",
"on",
" ",
"to",
" ",
"appl",
"y",
"\\",
"10",
";",
" ",
" ",
"--",
"step",
"wis",
"e",
" ",
"-",
" ",
"step",
"wis",
"e",
" ",
"regress",
"ion",
" ",
"to",
" ",
"appl",
"y",
".",
" ",
"forward",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"or",
" ",
"back",
"ward",
"s",
"\\",
"10",
";",
" ",
" ",
"--",
"pin",
"clu",
"de",
" ",
"-",
" ",
"large",
"st",
" ",
"p",
"-",
"value",
" ",
"require",
"d",
" ",
"for",
" ",
"inclusion",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"in",
" ",
"the",
" ",
"model",
" ",
"by",
" ",
"step",
"wis",
"e",
" ",
"regress",
"ion",
"\\",
"10",
";",
" ",
" ",
"--",
"rs",
"quare",
"d",
" ",
"-",
" ",
"varian",
"ce",
" ",
"explaine",
"d",
" ",
"cut",
"-",
"off",
" ",
"for",
" ",
"DEG",
"s",
"\\",
"10",
";",
" ",
" ",
"--",
"var",
"group",
" ",
"-",
" ",
"variab",
"le",
" ",
"group",
" ",
"to",
" ",
"report",
".",
" ",
" ",
"Ei",
"ther",
" ",
"`",
"each",
"`",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"all",
"`",
" ",
"or",
" ",
"`",
"group",
"`.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"sum",
"covar",
"``",
" ",
"-",
" ",
"filter",
" ",
"gene",
"s",
" ",
"on",
" ",
"the",
" ",
"sum",
" ",
"of",
" ",
"thei",
"r",
" ",
"abs",
"olute",
" ",
"covariance",
"\\",
"10",
";",
" ",
"Activ",
"e",
" ",
"options",
"::",
"\\",
"10",
";",
" ",
" ",
"--",
"reps",
" ",
"-",
" ",
"comma",
"-",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"replicate",
" ",
"ID",
"s",
"\\",
"10",
";",
" ",
" ",
"--",
"timepo",
"ints",
" ",
"-",
" ",
"comma",
"-",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"time",
" ",
"points",
"\\",
"10",
";",
" ",
" ",
"--",
"quantile",
" ",
"-",
" ",
"quantile",
" ",
"threshol",
"d",
" ",
"to",
" ",
"appl",
"y",
" ",
"for",
" ",
"filtering",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"averag",
"e\\u",
"express",
"ion",
"``",
" ",
"-",
" ",
"calcul",
"ate",
" ",
"averag",
"e",
" ",
"express",
"ion",
" ",
"over",
" ",
"replicate",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
"at",
" ",
"each",
" ",
"time",
" ",
"point",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Type",
"::",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
"python",
" ",
"express",
"ion",
"2e",
"xpr",
"ession",
".",
"py",
" ",
"--",
"help",
"\\",
"10",
";",
"\\",
"10",
";",
"for",
" ",
"command",
" ",
"line",
" ",
"help",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Command",
" ",
"line",
" ",
"options",
"\\",
"10",
";",
"--------------",
"------",
"\\",
"10",
";",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"CGA",
"T_",
"._",
"Experiment_",
"as_",
"E_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"CGA",
"T_",
"._",
"Times",
"eries",
"_",
"as_",
"TS_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"exit_",
"(_",
"main_",
"(_",
"sys_",
"._",
"argv_",
")_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"main_",
"(_",
"argv_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"script",
" ",
"main",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"parse",
"s",
" ",
"command",
" ",
"line",
" ",
"options",
" ",
"in",
" ",
"sys",
".",
"argv",
",",
" ",
"unl",
"ess",
" ",
"*",
"argv",
"*",
" ",
"is",
" ",
"give",
"n",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"argv_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"argv_",
"=_",
"sys_",
"._",
"argv_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"setup",
" ",
"command",
" ",
"line",
" ",
"parser_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"parser_",
"=_",
"E_",
"._",
"Optio",
"n",
"Parser_",
"(_",
"version_",
"=_",
"\"%",
"prog",
" ",
"version",
":",
" ",
"$",
"Id",
"$\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"usage_",
"=_",
"globals_",
"(_",
")_",
"[_",
"\"\\u\\u",
"doc",
"\\u\\u\"_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"-",
"t",
"\"_",
",_",
"\"--",
"test",
"\"_",
",_",
"dest_",
"=_",
"\"",
"test",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"supply",
" ",
"help",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"time",
"\"_",
",_",
"dest_",
"=_",
"\"",
"timepo",
"ints",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"a",
" ",
"comma",
"-",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"time",
" ",
"points",
" ",
"measure",
"d",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"replicate",
"s",
"\"_",
",_",
"dest_",
"=_",
"\"",
"reps",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"a",
" ",
"comma",
"-",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"replicate",
" ",
"ID",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"condition",
"s",
"\"_",
",_",
"dest_",
"=_",
"\"",
"condition",
"s",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"a",
" ",
"comma",
"-",
"separate",
"d",
" ",
"list",
" ",
"of",
" ",
"experimental",
" ",
"condition",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"order",
"s",
"\"_",
",_",
"dest_",
"=_",
"\"",
"order",
"s",
"\"_",
",_",
"type_",
"=_",
"\"",
"int",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"order",
" ",
"of",
" ",
"polynomial",
" ",
"term",
"s",
" ",
"to",
" ",
"include",
" ",
"in",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"ma",
"Sig",
"Pro",
" ",
"linear",
" ",
"model",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"fd",
"r",
"\"_",
",_",
"dest_",
"=_",
"\"",
"fd",
"r",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"FD",
"R",
" ",
"for",
" ",
"calling",
" ",
"DEG",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"pad",
"just",
"\"_",
",_",
"dest_",
"=_",
"\"",
"pad",
"just",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"multiple",
" ",
"testi",
"ng",
" ",
"correcti",
"on",
" ",
"to",
" ",
"appl",
"y",
" ",
"to",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"control",
" ",
"FD",
"R",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"step",
"wis",
"e",
"\"_",
",_",
"dest_",
"=_",
"\"",
"step",
"wis",
"e",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"step",
"wis",
"e",
" ",
"regress",
"ion",
" ",
"to",
" ",
"use",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"pin",
"clu",
"de",
"\"_",
",_",
"dest_",
"=_",
"\"",
"pin",
"clu",
"de",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"p",
"-",
"value",
" ",
"for",
" ",
"inclusion",
" ",
"in",
" ",
"step",
"wis",
"e",
" ",
"regress",
"ion",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"rs",
"quare",
"d",
"\"_",
",_",
"dest_",
"=_",
"\"",
"rs",
"quare",
"d",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"rs",
"quare",
"d",
" ",
"cut",
"-",
"off",
" ",
"for",
" ",
"DEG",
" ",
"reporting",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"var",
"-",
"group",
"\"_",
",_",
"dest_",
"=_",
"\"",
"var",
"group",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"variab",
"le",
" ",
"group",
" ",
"reporting",
".",
" ",
"each",
",",
" ",
"all",
" ",
"or",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"group",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"task",
"\"_",
",_",
"dest_",
"=_",
"\"",
"task",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"analys",
"is",
" ",
"task",
" ",
"to",
" ",
"be",
" ",
"executed",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"infile",
"\"_",
",_",
"dest_",
"=_",
"\"",
"infile",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"input",
" ",
"file",
" ",
"path",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"--",
"quantile",
"\"_",
",_",
"dest_",
"=_",
"\"",
"quantile",
"\"_",
",_",
"type_",
"=_",
"\"",
"int",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"see",
" ",
"pipeline",
".",
"ini",
" ",
"for",
" ",
"expl",
"anat",
"ion",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"common",
" ",
"options",
" ",
"(-",
"h",
"/--",
"help",
",",
" ",
"...)",
" ",
"and",
" ",
"parse",
" ",
"command",
" ",
"line_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"options_",
",_",
"args_",
")_",
"=_",
"E_",
"._",
"Start_",
"(_",
"parser_",
",_",
"argv_",
"=_",
"argv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"infile_",
"=_",
"argv_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"._",
"set\\u",
"defaults_",
"(_",
"cut",
"Height_",
"=_",
"0_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"conditions_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"split_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"cluster",
"\\u",
"size_",
"=_",
"30_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"options_",
"._",
"task_",
"==_",
"\"",
"dese",
"q",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"timepo",
"ints_",
"=_",
"[_",
"int_",
"(_",
"x_",
")_",
"for_",
"x_",
"in_",
"options_",
"._",
"timepo",
"ints_",
"._",
"split_",
"(_",
"\",\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"timepo",
"ints_",
"._",
"sort_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reps_",
"=_",
"[_",
"x_",
"for_",
"x_",
"in_",
"options_",
"._",
"reps_",
"._",
"split_",
"(_",
"\",\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"options_",
"._",
"conditions_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"conditions_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"conditions_",
"=_",
"[_",
"x_",
"for_",
"x_",
"in_",
"options_",
"._",
"conditions_",
"._",
"split_",
"(_",
"\",\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data\\u",
"frame_",
"=_",
"TS_",
"._",
"dese",
"q",
"Normalize",
"_",
"(_",
"infile_",
"=_",
"infile_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"time",
"\\u",
"points_",
"=_",
"timepo",
"ints_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"reps_",
"=_",
"reps_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"conditions_",
"=_",
"conditions_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"options_",
"._",
"task_",
"==_",
"\"",
"mas",
"ig",
"pro",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"frame_",
"=_",
"TS_",
"._",
"ma",
"Sig",
"Pro",
"_",
"(_",
"infile_",
"=_",
"infile_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"order",
"\\u",
"terms_",
"=_",
"int_",
"(_",
"options_",
"._",
"orders_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"fd",
"r_",
"=_",
"float_",
"(_",
"options_",
"._",
"fd",
"r_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"adjust_",
"=_",
"options_",
"._",
"pad",
"just",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"step",
"wise_",
"=_",
"options_",
"._",
"step",
"wise_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"include",
"\\u",
"p_",
"=_",
"float_",
"(_",
"options_",
"._",
"pin",
"clu",
"de_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"rs",
"q_",
"=_",
"float_",
"(_",
"options_",
"._",
"rs",
"quare",
"d_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"var",
"\\u",
"group_",
"=_",
"options_",
"._",
"var",
"group_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"options_",
"._",
"task_",
"==_",
"\"",
"sum",
"covar",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"timepo",
"ints_",
"=_",
"[_",
"int_",
"(_",
"x_",
")_",
"for_",
"x_",
"in_",
"options_",
"._",
"timepo",
"ints_",
"._",
"split_",
"(_",
"\",\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reps_",
"=_",
"[_",
"x_",
"for_",
"x_",
"in_",
"options_",
"._",
"reps_",
"._",
"split_",
"(_",
"\",\"_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data\\u",
"frame_",
"=_",
"TS_",
"._",
"covar",
"Filter_",
"(_",
"infile_",
"=_",
"infile_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"time",
"\\u",
"points_",
"=_",
"timepo",
"ints_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"replicate",
"s_",
"=_",
"reps_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"quantile",
"_",
"=_",
"int_",
"(_",
"options_",
"._",
"quantile",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"options_",
"._",
"task_",
"==_",
"\"",
"averag",
"e\\u",
"express",
"ion",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data\\u",
"frame_",
"=_",
"TS_",
"._",
"av",
"Time",
"Expression_",
"(_",
"infile_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"data\\u",
"frame_",
"._",
"to",
"\\u",
"csv_",
"(_",
"options_",
"._",
"stdout_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sep_",
"=_",
"\"\\\\",
"t",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"header_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index",
"\\u",
"label_",
"=_",
"\"",
"gene",
"\\u",
"id",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Write",
" ",
"footer",
" ",
"and",
" ",
"output",
" ",
"bench",
"mark",
" ",
"informati",
"on",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"E_",
"._",
"Stop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | openzoom/deepzoom.py/examples/helloworld/helloworld.py | [
{
"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport deepzoom\n\n# Specify your source image\nSOURCE = \"helloworld.jpg\"\n\n# Create Deep Zoom Image creator with weird parameters\ncreator = deepzoom.ImageCreator(tile_size=128, tile_overlap=2, tile_format=\"png\",\n image_quality=0.8, resize_filter=\"bicubic\")\n\n# Create Deep Zoom image pyramid from source\ncreator.create(SOURCE, \"helloworld.dzi\")\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"deep",
"zoom_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Speci",
"fy",
" ",
"your",
" ",
"source",
" ",
"image_",
"\\u\\u\\uNL\\u\\u\\u_",
"SOURCE_",
"=_",
"\"",
"hellow",
"orl",
"d",
".",
"jp",
"g",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"De",
"ep",
" ",
"Zoom",
" ",
"Image",
" ",
"creat",
"or",
" ",
"with",
" ",
"weird",
" ",
"parameters_",
"\\u\\u\\uNL\\u\\u\\u_",
"creator_",
"=_",
"deep",
"zoom_",
"._",
"Image",
"Creator_",
"(_",
"tile",
"\\u",
"size_",
"=_",
"128_",
",_",
"tile",
"\\u",
"overlap_",
"=_",
"2_",
",_",
"tile",
"\\u",
"format_",
"=_",
"\"",
"png",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"image",
"\\u",
"quality_",
"=_",
"0.8_",
",_",
"resiz",
"e\\u",
"filter_",
"=_",
"\"",
"bic",
"ubi",
"c",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Creat",
"e",
" ",
"De",
"ep",
" ",
"Zoom",
" ",
"image",
" ",
"pyram",
"id",
" ",
"from",
" ",
"source_",
"\\u\\u\\uNL\\u\\u\\u_",
"creator_",
"._",
"create_",
"(_",
"SOURCE_",
",_",
"\"",
"hellow",
"orl",
"d",
".",
"dz",
"i",
"\"_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Import of deprecated module | coreemu/core/daemon/examples/netns/wlanemanetests.py | [
{
"content": "#!/usr/bin/python\n\n# Copyright (c)2011-2014 the Boeing Company.\n# See the LICENSE file included in this distribution.\n#\n# author: Jeff Ahrenholz <[email protected]>\n#\n'''\nwlanemanetests.py - This script tests the performance of the WLAN device in\nCORE by measuring various metrics:\n - delay experienced when pinging end-to-end\n - maximum TCP throughput achieved using iperf end-to-end\n - the CPU used and loss experienced when running an MGEN flow of UDP traffic\n\nAll MANET nodes are arranged in a row, so that any given node can only \ncommunicate with the node to its right or to its left. Performance is measured\nusing traffic that travels across each hop in the network. Static /32 routing\nis used instead of any dynamic routing protocol.\n\nVarious underlying network types are tested:\n - bridged (the CORE default, uses ebtables)\n - bridged with netem (add link effects to the bridge using tc queues)\n - EMANE bypass - the bypass model just forwards traffic\n - EMANE RF-PIPE - the bandwidth (bitrate) is set very high / no restrictions\n - EMANE RF-PIPE - bandwidth is set similar to netem case\n - EMANE RF-PIPE - default connectivity is off and pathloss events are\n generated to connect the nodes in a line\n\nResults are printed/logged in CSV format.\n\n'''\n\nimport os, sys, time, optparse, datetime, math\nfrom string import Template\ntry:\n from core import pycore\nexcept ImportError:\n # hack for Fedora autoconf that uses the following pythondir:\n if \"/usr/lib/python2.6/site-packages\" in sys.path:\n sys.path.append(\"/usr/local/lib/python2.6/site-packages\")\n if \"/usr/lib64/python2.6/site-packages\" in sys.path:\n sys.path.append(\"/usr/local/lib64/python2.6/site-packages\")\n if \"/usr/lib/python2.7/site-packages\" in sys.path:\n sys.path.append(\"/usr/local/lib/python2.7/site-packages\")\n if \"/usr/lib64/python2.7/site-packages\" in sys.path:\n sys.path.append(\"/usr/local/lib64/python2.7/site-packages\")\n from core import pycore\nfrom core.misc import ipaddr\nfrom core.misc.utils import mutecall\nfrom core.constants import QUAGGA_STATE_DIR\nfrom core.emane.emane import Emane\nfrom core.emane.bypass import EmaneBypassModel\nfrom core.emane.rfpipe import EmaneRfPipeModel\n\ntry:\n import emaneeventservice\n import emaneeventpathloss\nexcept Exception, e:\n try:\n from emanesh.events import EventService\n from emanesh.events import PathlossEvent\n except Exception, e2:\n raise ImportError, \"failed to import EMANE Python bindings:\\n%s\\n%s\" % \\\n (e, e2)\n\n# global Experiment object (for interaction with 'python -i')\nexp = None\n\n# move these to core.misc.utils\n\n\n\n\n# end move these to core.misc.utils\n\n\n\n\n\n\n \n\n\n\n\nif __name__ == \"__main__\":\n exp = main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Import_",
"of_",
"deprecated_",
"module_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"(",
"c",
")",
"2011",
"-",
"2014",
" ",
"the",
" ",
"Bo",
"ein",
"g",
" ",
"Compa",
"ny",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"LICENSE",
" ",
"file",
" ",
"include",
"d",
" ",
"in",
" ",
"this",
" ",
"distribu",
"tion",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"author",
":",
" ",
"Je",
"ff",
" ",
"Ah",
"ren",
"hol",
"z",
" ",
"<",
"je",
"ff",
"rey",
".",
"m",
".",
"ah",
"ren",
"hol",
"z",
"@",
"bo",
"ein",
"g",
".",
"com",
">_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"'''",
"\\",
"10",
";",
"wlan",
"eman",
"ete",
"sts",
".",
"py",
" ",
"-",
" ",
"Thi",
"s",
" ",
"script",
" ",
"tests",
" ",
"the",
" ",
"perform",
"anc",
"e",
" ",
"of",
" ",
"the",
" ",
"WL",
"AN",
" ",
"device",
" ",
"in",
"\\",
"10",
";",
"CORE",
" ",
"by",
" ",
"meas",
"uri",
"ng",
" ",
"vari",
"ous",
" ",
"metric",
"s",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"dela",
"y",
" ",
"experience",
"d",
" ",
"whe",
"n",
" ",
"ping",
"ing",
" ",
"end",
"-",
"to",
"-",
"end",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"maxim",
"um",
" ",
"TC",
"P",
" ",
"throughput",
" ",
"achieve",
"d",
" ",
"usi",
"ng",
" ",
"iper",
"f",
" ",
"end",
"-",
"to",
"-",
"end",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"the",
" ",
"CPU",
" ",
"used",
" ",
"and",
" ",
"loss",
" ",
"experience",
"d",
" ",
"whe",
"n",
" ",
"runn",
"ing",
" ",
"an",
" ",
"MG",
"EN",
" ",
"flow",
" ",
"of",
" ",
"UD",
"P",
" ",
"traffic",
"\\",
"10",
";",
"\\",
"10",
";",
"All",
" ",
"MAN",
"ET",
" ",
"nodes",
" ",
"are",
" ",
"arrange",
"d",
" ",
"in",
" ",
"a",
" ",
"row",
",",
" ",
"so",
" ",
"tha",
"t",
" ",
"any",
" ",
"give",
"n",
" ",
"node",
" ",
"can",
" ",
"only",
" ",
"\\",
"10",
";",
"communi",
"cate",
" ",
"with",
" ",
"the",
" ",
"node",
" ",
"to",
" ",
"its",
" ",
"right",
" ",
"or",
" ",
"to",
" ",
"its",
" ",
"left",
".",
" ",
"Perform",
"anc",
"e",
" ",
"is",
" ",
"measure",
"d",
"\\",
"10",
";",
"usi",
"ng",
" ",
"traffic",
" ",
"tha",
"t",
" ",
"travel",
"s",
" ",
"acro",
"ss",
" ",
"each",
" ",
"hop",
" ",
"in",
" ",
"the",
" ",
"network",
".",
" ",
"Static",
" ",
"/",
"32",
" ",
"routin",
"g",
"\\",
"10",
";",
"is",
" ",
"used",
" ",
"inst",
"ead",
" ",
"of",
" ",
"any",
" ",
"dynami",
"c",
" ",
"routin",
"g",
" ",
"protoc",
"ol",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Vari",
"ous",
" ",
"underl",
"ying",
" ",
"network",
" ",
"types",
" ",
"are",
" ",
"tested",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"bridge",
"d",
" ",
"(",
"the",
" ",
"CORE",
" ",
"default",
",",
" ",
"use",
"s",
" ",
"eb",
"tables",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"bridge",
"d",
" ",
"with",
" ",
"net",
"em",
" ",
"(",
"add",
" ",
"link",
" ",
"effect",
"s",
" ",
"to",
" ",
"the",
" ",
"bridge",
" ",
"usi",
"ng",
" ",
"tc",
" ",
"queue",
"s",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"EMA",
"NE",
" ",
"bypass",
" ",
"-",
" ",
"the",
" ",
"bypass",
" ",
"model",
" ",
"just",
" ",
"forward",
"s",
" ",
"traffic",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"EMA",
"NE",
" ",
"RF",
"-",
"PIPE",
" ",
"-",
" ",
"the",
" ",
"bandwi",
"dth",
" ",
"(",
"bit",
"rate",
")",
" ",
"is",
" ",
"set",
" ",
"very",
" ",
"high",
" ",
"/",
" ",
"no",
" ",
"restriction",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"EMA",
"NE",
" ",
"RF",
"-",
"PIPE",
" ",
"-",
" ",
"bandwi",
"dth",
" ",
"is",
" ",
"set",
" ",
"similar",
" ",
"to",
" ",
"net",
"em",
" ",
"case",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-",
" ",
"EMA",
"NE",
" ",
"RF",
"-",
"PIPE",
" ",
"-",
" ",
"default",
" ",
"connecti",
"vity",
" ",
"is",
" ",
"off",
" ",
"and",
" ",
"path",
"loss",
" ",
"events",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"generat",
"ed",
" ",
"to",
" ",
"connect",
" ",
"the",
" ",
"nodes",
" ",
"in",
" ",
"a",
" ",
"line",
"\\",
"10",
";",
"\\",
"10",
";",
"Result",
"s",
" ",
"are",
" ",
"printed",
"/",
"logged",
" ",
"in",
" ",
"CSV",
" ",
"format",
".",
"\\",
"10",
";",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
",_",
"sys_",
",_",
"time_",
",_",
"optparse_",
",_",
"datetime_",
",_",
"math_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"string_",
"import_",
"Template_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"core_",
"import_",
"pyco",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"hack",
" ",
"for",
" ",
"Fe",
"dor",
"a",
" ",
"autocon",
"f",
" ",
"tha",
"t",
" ",
"use",
"s",
" ",
"the",
" ",
"follow",
"ing",
" ",
"python",
"dir",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"\"/",
"usr",
"/",
"lib",
"/",
"python",
"2.6",
"/",
"site",
"-",
"package",
"s",
"\"_",
"in_",
"sys_",
"._",
"path_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"path_",
"._",
"append_",
"(_",
"\"/",
"usr",
"/",
"local",
"/",
"lib",
"/",
"python",
"2.6",
"/",
"site",
"-",
"package",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"/",
"usr",
"/",
"lib",
"64",
"/",
"python",
"2.6",
"/",
"site",
"-",
"package",
"s",
"\"_",
"in_",
"sys_",
"._",
"path_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"path_",
"._",
"append_",
"(_",
"\"/",
"usr",
"/",
"local",
"/",
"lib",
"64",
"/",
"python",
"2.6",
"/",
"site",
"-",
"package",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"/",
"usr",
"/",
"lib",
"/",
"python",
"2.7",
"/",
"site",
"-",
"package",
"s",
"\"_",
"in_",
"sys_",
"._",
"path_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"path_",
"._",
"append_",
"(_",
"\"/",
"usr",
"/",
"local",
"/",
"lib",
"/",
"python",
"2.7",
"/",
"site",
"-",
"package",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\"/",
"usr",
"/",
"lib",
"64",
"/",
"python",
"2.7",
"/",
"site",
"-",
"package",
"s",
"\"_",
"in_",
"sys_",
"._",
"path_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"path_",
"._",
"append_",
"(_",
"\"/",
"usr",
"/",
"local",
"/",
"lib",
"64",
"/",
"python",
"2.7",
"/",
"site",
"-",
"package",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"core_",
"import_",
"pyco",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"from_",
"core_",
"._",
"misc_",
"import_",
"ipaddr_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core_",
"._",
"misc_",
"._",
"utils_",
"import_",
"mute",
"call_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core_",
"._",
"constants_",
"import_",
"QUA",
"GGA",
"\\u",
"STATE",
"\\u",
"DIR_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core_",
"._",
"eman",
"e_",
"._",
"eman",
"e_",
"import_",
"Ema",
"ne_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core_",
"._",
"eman",
"e_",
"._",
"bypass",
"_",
"import_",
"Ema",
"ne",
"By",
"pass",
"Model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core_",
"._",
"eman",
"e_",
"._",
"rf",
"pipe_",
"import_",
"Ema",
"ne",
"Rf",
"Pipe",
"Model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"eman",
"ee",
"vent",
"service_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"eman",
"ee",
"vent",
"path",
"loss_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
",_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"eman",
"esh",
"_",
"._",
"events_",
"import_",
"Event",
"Service_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"eman",
"esh",
"_",
"._",
"events_",
"import_",
"Path",
"loss",
"Event_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
",_",
"e2_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Import",
"Error_",
",_",
"\"",
"fail",
"ed",
" ",
"to",
" ",
"import",
" ",
"EMA",
"NE",
" ",
"Pyth",
"on",
" ",
"bindi",
"ngs",
":\\\\",
"n",
"%",
"s",
"\\\\",
"n",
"%",
"s",
"\"_",
"%_",
"(_",
"e_",
",_",
"e2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"global",
" ",
"Experiment",
" ",
"object",
" ",
"(",
"for",
" ",
"interacti",
"on",
" ",
"with",
" ",
"'",
"python",
" ",
"-",
"i",
"')",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"exp_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"move",
" ",
"these",
" ",
"to",
" ",
"core",
".",
"misc",
".",
"utils_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"end",
" ",
"move",
" ",
"these",
" ",
"to",
" ",
"core",
".",
"misc",
".",
"utils_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"\"\\u\\u",
"main",
"\\u\\u\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exp_",
"=_",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | coleifer/walrus/walrus/rate_limit.py | [
{
"content": "import hashlib\nimport pickle\nimport time\nfrom functools import wraps\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class RateLimitException(Exception):\n pass",
"metadata": "root.RateLimitException",
"header": "['module', '___EOS___']",
"index": 6
},
{
"content": "class RateLimit(object):\n \"\"\"\n Rate limit implementation. Allows up to `number` of events every `per`\n seconds.\n \"\"\"\n\n",
"metadata": "root.RateLimit",
"header": "['module', '___EOS___']",
"index": 10
},
{
"content": " def __init__(self, database, name, limit=5, per=60, debug=False):\n \"\"\"\n :param database: :py:class:`Database` instance.\n :param name: Namespace for this cache.\n :param int limit: Number of events allowed during a given time period.\n :param int per: Time period the ``limit` applies to, in seconds.\n :param debug: Disable rate-limit for debugging purposes. All events\n will appear to be allowed and valid.\n \"\"\"\n self.database = database\n self.name = name\n self._limit = limit\n self._per = per\n self._debug = debug",
"metadata": "root.RateLimit.__init__",
"header": "['class', 'RateLimit', '(', 'object', ')', ':', '___EOS___']",
"index": 15
},
{
"content": " def limit(self, key):\n \"\"\"\n Function to log an event with the given key. If the ``key`` has not\n exceeded their alotted events, then the function returns ``False`` to\n indicate that no limit is being imposed.\n\n If the ``key`` has exceeded the number of events, then the function\n returns ``True`` indicating rate-limiting should occur.\n\n :param str key: A key identifying the source of the event.\n :returns: Boolean indicating whether the event should be rate-limited\n or not.\n \"\"\"\n if self._debug:\n return False\n\n counter = self.database.List(self.name + ':' + key)\n n = len(counter)\n is_limited = False\n if n < self._limit:\n counter.prepend(str(time.time()))\n else:\n oldest = float(counter[-1])\n if time.time() - oldest < self._per:\n is_limited = True\n else:\n counter.prepend(str(time.time()))\n del counter[:self._limit]\n counter.pexpire(int(self._per * 2000))\n return is_limited",
"metadata": "root.RateLimit.limit",
"header": "['class', 'RateLimit', '(', 'object', ')', ':', '___EOS___']",
"index": 30
},
{
"content": " def rate_limited(self, key_function=None):\n \"\"\"\n Function or method decorator that will prevent calls to the decorated\n function when the number of events has been exceeded for the given\n time period.\n\n It is probably important that you take care to choose an appropiate\n key function. For instance, if rate-limiting a web-page you might use\n the requesting user's IP as the key.\n\n If the number of allowed events has been exceedd, a\n ``RateLimitException`` will be raised.\n\n :param key_function: Function that accepts the params of the decorated\n function and returns a string key. If not provided, a hash of the\n args and kwargs will be used.\n :returns: If the call is not rate-limited, then the return value will\n be that of the decorated function.\n :raises: ``RateLimitException``.\n \"\"\"\n if key_function is None:\n def key_function(*args, **kwargs):\n data = pickle.dumps((args, sorted(kwargs.items())))\n return hashlib.md5(data).hexdigest()\n\n def decorator(fn):\n @wraps(fn)\n def inner(*args, **kwargs):\n key = key_function(*args, **kwargs)\n if self.limit(key):\n raise RateLimitException(\n 'Call to %s exceeded %s events in %s seconds.' % (\n fn.__name__, self._limit, self._per))\n return fn(*args, **kwargs)\n return inner\n return decorator",
"metadata": "root.RateLimit.rate_limited",
"header": "['class', 'RateLimit', '(', 'object', ')', ':', '___EOS___']",
"index": 61
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"hashlib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"pickle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"functools_",
"import_",
"wraps_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Rat",
"e",
"Limit",
"Exception_",
"(_",
"Exception_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Rat",
"e",
"Limit_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Rat",
"e",
" ",
"limit",
" ",
"implementation",
".",
" ",
"All",
"ow",
"s",
" ",
"up",
" ",
"to",
" ",
"`",
"number",
"`",
" ",
"of",
" ",
"events",
" ",
"every",
" ",
"`",
"per",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"second",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Rat",
"e",
"Limit_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"database_",
",_",
"name_",
",_",
"limit_",
"=_",
"5_",
",_",
"per_",
"=_",
"60_",
",_",
"debug_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"databa",
"se",
":",
" ",
":",
"py",
":",
"class",
":`",
"Databa",
"se",
"`",
" ",
"instance",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"name",
":",
" ",
"Names",
"pace",
" ",
"for",
" ",
"this",
" ",
"cache",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"int",
" ",
"limit",
":",
" ",
"Number",
" ",
"of",
" ",
"events",
" ",
"allow",
"ed",
" ",
"dur",
"ing",
" ",
"a",
" ",
"give",
"n",
" ",
"time",
" ",
"period",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"int",
" ",
"per",
":",
" ",
"Time",
" ",
"period",
" ",
"the",
" ",
"``",
"limit",
"`",
" ",
"appli",
"es",
" ",
"to",
",",
" ",
"in",
" ",
"second",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"debug",
":",
" ",
"Disa",
"ble",
" ",
"rate",
"-",
"limit",
" ",
"for",
" ",
"debugg",
"ing",
" ",
"purpose",
"s",
".",
" ",
"All",
" ",
"events",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"will",
" ",
"appear",
" ",
"to",
" ",
"be",
" ",
"allow",
"ed",
" ",
"and",
" ",
"valid",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"database_",
"=_",
"database_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"name_",
"=_",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"limit_",
"=_",
"limit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"per_",
"=_",
"per_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"debug_",
"=_",
"debug_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Rat",
"e",
"Limit_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"limit_",
"(_",
"self_",
",_",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Function",
" ",
"to",
" ",
"log",
" ",
"an",
" ",
"event",
" ",
"with",
" ",
"the",
" ",
"give",
"n",
" ",
"key",
".",
" ",
"If",
" ",
"the",
" ",
"``",
"key",
"``",
" ",
"has",
" ",
"not",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exceed",
"ed",
" ",
"thei",
"r",
" ",
"alo",
"tted",
" ",
"events",
",",
" ",
"then",
" ",
"the",
" ",
"function",
" ",
"return",
"s",
" ",
"``",
"Fal",
"se",
"``",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"indicat",
"e",
" ",
"tha",
"t",
" ",
"no",
" ",
"limit",
" ",
"is",
" ",
"bei",
"ng",
" ",
"impos",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"``",
"key",
"``",
" ",
"has",
" ",
"exceed",
"ed",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"events",
",",
" ",
"then",
" ",
"the",
" ",
"function",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"return",
"s",
" ",
"``",
"Tru",
"e",
"``",
" ",
"indicati",
"ng",
" ",
"rate",
"-",
"limit",
"ing",
" ",
"shou",
"ld",
" ",
"occur",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"str",
" ",
"key",
":",
" ",
"A",
" ",
"key",
" ",
"identify",
"ing",
" ",
"the",
" ",
"source",
" ",
"of",
" ",
"the",
" ",
"event",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
"s",
":",
" ",
"Boo",
"lean",
" ",
"indicati",
"ng",
" ",
"whe",
"ther",
" ",
"the",
" ",
"event",
" ",
"shou",
"ld",
" ",
"be",
" ",
"rate",
"-",
"limited",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"or",
" ",
"not",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"debug_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"counter_",
"=_",
"self_",
"._",
"database_",
"._",
"List_",
"(_",
"self_",
"._",
"name_",
"+_",
"':'_",
"+_",
"key_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"n_",
"=_",
"len_",
"(_",
"counter_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"is",
"\\u",
"limited",
"_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"n_",
"<_",
"self_",
"._",
"\\u",
"limit_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"counter_",
"._",
"prepend",
"_",
"(_",
"str_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"oldest",
"_",
"=_",
"float_",
"(_",
"counter_",
"[_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"time_",
"._",
"time_",
"(_",
")_",
"-_",
"oldest",
"_",
"<_",
"self_",
"._",
"\\u",
"per_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"is",
"\\u",
"limited",
"_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"counter_",
"._",
"prepend",
"_",
"(_",
"str_",
"(_",
"time_",
"._",
"time_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"del_",
"counter_",
"[_",
":_",
"self_",
"._",
"\\u",
"limit_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"counter_",
"._",
"pex",
"pir",
"e_",
"(_",
"int_",
"(_",
"self_",
"._",
"\\u",
"per_",
"*_",
"2000_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"is",
"\\u",
"limited",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Rat",
"e",
"Limit_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"rate",
"\\u",
"limited",
"_",
"(_",
"self_",
",_",
"key",
"\\u",
"function_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Function",
" ",
"or",
" ",
"method",
" ",
"decorat",
"or",
" ",
"tha",
"t",
" ",
"will",
" ",
"prevent",
" ",
"calls",
" ",
"to",
" ",
"the",
" ",
"decorated",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"function",
" ",
"whe",
"n",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"events",
" ",
"has",
" ",
"bee",
"n",
" ",
"exceed",
"ed",
" ",
"for",
" ",
"the",
" ",
"give",
"n",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"time",
" ",
"period",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"It",
" ",
"is",
" ",
"probab",
"ly",
" ",
"importa",
"nt",
" ",
"tha",
"t",
" ",
"you",
" ",
"take",
" ",
"care",
" ",
"to",
" ",
"choose",
" ",
"an",
" ",
"appro",
"pia",
"te",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"key",
" ",
"function",
".",
" ",
"For",
" ",
"instance",
",",
" ",
"if",
" ",
"rate",
"-",
"limit",
"ing",
" ",
"a",
" ",
"web",
"-",
"page",
" ",
"you",
" ",
"mig",
"ht",
" ",
"use",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"request",
"ing",
" ",
"user",
"'",
"s",
" ",
"IP",
" ",
"as",
" ",
"the",
" ",
"key",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"allow",
"ed",
" ",
"events",
" ",
"has",
" ",
"bee",
"n",
" ",
"exceed",
"d",
",",
" ",
"a",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"``",
"Rat",
"e",
"Limit",
"Except",
"ion",
"``",
" ",
"will",
" ",
"be",
" ",
"raise",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"key",
"\\u",
"function",
":",
" ",
"Function",
" ",
"tha",
"t",
" ",
"accepts",
" ",
"the",
" ",
"params",
" ",
"of",
" ",
"the",
" ",
"decorated",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"function",
" ",
"and",
" ",
"return",
"s",
" ",
"a",
" ",
"string",
" ",
"key",
".",
" ",
"If",
" ",
"not",
" ",
"provided",
",",
" ",
"a",
" ",
"hash",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"args",
" ",
"and",
" ",
"kwarg",
"s",
" ",
"will",
" ",
"be",
" ",
"used",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
"s",
":",
" ",
"If",
" ",
"the",
" ",
"call",
" ",
"is",
" ",
"not",
" ",
"rate",
"-",
"limited",
",",
" ",
"then",
" ",
"the",
" ",
"return",
" ",
"value",
" ",
"will",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"tha",
"t",
" ",
"of",
" ",
"the",
" ",
"decorated",
" ",
"function",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"raise",
"s",
":",
" ",
"``",
"Rat",
"e",
"Limit",
"Except",
"ion",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"key",
"\\u",
"function_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"key",
"\\u",
"function_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"pickle_",
"._",
"dumps_",
"(_",
"(_",
"args_",
",_",
"sorted_",
"(_",
"kwargs_",
"._",
"items_",
"(_",
")_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"hashlib_",
"._",
"md5_",
"(_",
"data_",
")_",
"._",
"hexdigest_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"decorator_",
"(_",
"fn_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"wraps_",
"(_",
"fn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"inner_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"key",
"\\u",
"function_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"limit_",
"(_",
"key_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Rat",
"e",
"Limit",
"Exception_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Call",
" ",
"to",
" ",
"%",
"s",
" ",
"exceed",
"ed",
" ",
"%",
"s",
" ",
"events",
" ",
"in",
" ",
"%",
"s",
" ",
"second",
"s",
".'_",
"%_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"fn_",
"._",
"\\u\\u",
"name\\u\\u_",
",_",
"self_",
"._",
"\\u",
"limit_",
",_",
"self_",
"._",
"\\u",
"per_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"fn_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"inner_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"decorator_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | spulec/moto/moto/sns/models.py | [
{
"content": " def publish(self, arn, message):\n try:\n topic = self.get_topic(arn)\n message_id = topic.publish(message)\n except SNSNotFoundError:\n endpoint = self.get_endpoint(arn)\n message_id = endpoint.publish(message)\n return message_id",
"metadata": "root.SNSBackend.publish",
"header": "['class', 'SNSBackend', '(', 'BaseBackend', ')', ':', '___EOS___']",
"index": 200
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"SN",
"SB",
"acke",
"nd_",
"(_",
"Base",
"Backend_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"publish_",
"(_",
"self_",
",_",
"arn_",
",_",
"message_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"topic_",
"=_",
"self_",
"._",
"get",
"\\u",
"topic_",
"(_",
"arn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"id_",
"=_",
"topic_",
"._",
"publish_",
"(_",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"SN",
"SN",
"ot",
"Foun",
"d",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"endpoint_",
"=_",
"self_",
"._",
"get",
"\\u",
"endpoint_",
"(_",
"arn_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message",
"\\u",
"id_",
"=_",
"endpoint_",
"._",
"publish_",
"(_",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"message",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Testing equality to None | binaryage/firelogger.py/gprof2dot.py | [
{
"content": " def translate(self, mo):\n \"\"\"Extract a structure from a match object, while translating the types in the process.\"\"\"\n attrs = {}\n groupdict = mo.groupdict()\n for name, value in groupdict.iteritems():\n if value is None:\n value = None\n elif self._int_re.match(value):\n value = int(value)\n elif self._float_re.match(value):\n value = float(value)\n attrs[name] = (value)\n return Struct(attrs)",
"metadata": "root.GprofParser.translate",
"header": "['class', 'GprofParser', '(', 'Parser', ')', ':', '___EOS___']",
"index": 792
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Test",
"ing_",
"equality",
"_",
"to_",
"None_",
"[SEP]_",
"class_",
"Gp",
"rof",
"Parser_",
"(_",
"Parser_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"translate_",
"(_",
"self_",
",_",
"mo_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Extract",
" ",
"a",
" ",
"structure",
" ",
"from",
" ",
"a",
" ",
"match",
" ",
"object",
",",
" ",
"whi",
"le",
" ",
"translat",
"ing",
" ",
"the",
" ",
"types",
" ",
"in",
" ",
"the",
" ",
"process",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"attrs_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"groupdict_",
"=_",
"mo_",
"._",
"groupdict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"name_",
",_",
"value_",
"in_",
"groupdict_",
"._",
"iteritems_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"value_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"\\u",
"int\\u",
"re_",
"._",
"match_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"int_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"self_",
"._",
"\\u",
"float",
"\\u",
"re_",
"._",
"match_",
"(_",
"value_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"value_",
"=_",
"float_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"attrs_",
"[_",
"name_",
"]_",
"=_",
"(_",
"value_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Struct_",
"(_",
"attrs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | YelpArchive/pushmanager/pushmanager/tests/test_servlet_addrequest.py | [
{
"content": "import types\nimport urllib\nfrom contextlib import nested\n\nimport mock\nimport testify as T\nfrom pushmanager.core import db\nfrom pushmanager.core.util import get_servlet_urlspec\nfrom pushmanager.servlets.addrequest import AddRequestServlet\nfrom pushmanager.testing.mocksettings import MockedSettings\nfrom pushmanager.testing.testservlet import ServletTestMixin\n\n\n\n\nif __name__ == '__main__':\n T.run()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class AddRequestServletTest(T.TestCase, ServletTestMixin):\n\n\n\n\n\n\n\n\n",
"metadata": "root.AddRequestServletTest",
"header": "['module', '___EOS___']",
"index": 13
},
{
"content": " @T.class_setup_teardown\n def mock_servlet_env(self):\n self.results = []\n with nested(\n mock.patch.dict(db.Settings, MockedSettings),\n mock.patch.object(\n AddRequestServlet,\n \"get_current_user\",\n return_value=\"testuser\"\n )\n ):\n yield",
"metadata": "root.AddRequestServletTest.mock_servlet_env",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 15
},
{
"content": " def record_pushcontents(self, success, db_results):\n assert success\n self.results = []\n self.results.extend(db_results.fetchall())",
"metadata": "root.AddRequestServletTest.record_pushcontents",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 28
},
{
"content": " def get_handlers(self):\n return [get_servlet_urlspec(AddRequestServlet)]",
"metadata": "root.AddRequestServletTest.get_handlers",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " def test_add_existing_request(self):\n db.execute_cb(db.push_pushcontents.select(), self.record_pushcontents)\n num_results_before = len(self.results)\n\n request = {'request': 1, 'push': 1}\n response = self.fetch(\n '/addrequest',\n method='POST',\n body=urllib.urlencode(request)\n )\n T.assert_equal(response.error, None)\n\n db.execute_cb(db.push_pushcontents.select(), self.record_pushcontents)\n num_results_after = len(self.results)\n T.assert_equal(num_results_after, num_results_before, \"Add existing request failed.\")",
"metadata": "root.AddRequestServletTest.test_add_existing_request",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 36
},
{
"content": " def test_add_new_request(self):\n db.execute_cb(db.push_pushcontents.select(), self.record_pushcontents)\n num_results_before = len(self.results)\n\n request = {'request': 2, 'push': 1}\n response = self.fetch(\n '/addrequest',\n method='POST',\n body=urllib.urlencode(request)\n )\n T.assert_equal(response.error, None)\n\n db.execute_cb(db.push_pushcontents.select(), self.record_pushcontents)\n num_results_after = len(self.results)\n T.assert_equal(num_results_after, num_results_before + 1, \"Add new request failed.\")",
"metadata": "root.AddRequestServletTest.test_add_new_request",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 52
},
{
"content": " @mock.patch('pushmanager.core.db.execute_transaction_cb')\n def test_pushcontent_insert_ignore(self, mock_transaction):\n request = {'request': 1, 'push': 1}\n response = self.fetch(\n '/addrequest',\n method='POST',\n body=urllib.urlencode(request)\n )\n T.assert_equal(response.error, None)\n T.assert_equal(mock_transaction.call_count, 1)\n\n # Extract the string of the prefix of the insert query\n insert_ignore_clause = mock_transaction.call_args[0][0][0]\n T.assert_is(type(insert_ignore_clause), db.InsertIgnore)",
"metadata": "root.AddRequestServletTest.test_pushcontent_insert_ignore",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 68
},
{
"content": " def call_on_db_complete(self):\n mocked_self = mock.Mock()\n mocked_self.current_user = 'fake_pushmaster'\n mocked_self.pushid = 0\n mocked_self.check_db_results = mock.Mock(return_value=None)\n\n mocked_self.on_db_complete = types.MethodType(AddRequestServlet.on_db_complete.im_func, mocked_self)\n\n no_watcher_req = {\n 'user': 'testuser',\n 'watchers': None,\n 'repo': 'repo',\n 'branch': 'branch',\n 'title': 'title',\n }\n watched_req = {\n 'user': 'testuser',\n 'watchers': 'testuser1,testuser2',\n 'repo': 'repo',\n 'branch': 'branch',\n 'title': 'title',\n }\n reqs = [no_watcher_req, watched_req]\n\n mocked_self.on_db_complete('success', [None, reqs])",
"metadata": "root.AddRequestServletTest.call_on_db_complete",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 83
},
{
"content": " @mock.patch('pushmanager.core.xmppclient.XMPPQueue.enqueue_user_xmpp')\n @mock.patch('pushmanager.core.mail.MailQueue.enqueue_user_email')\n def test_mailqueue_on_db_complete(self, mailq, _):\n self.call_on_db_complete()\n\n no_watcher_call_args = mailq.call_args_list[0][0]\n T.assert_equal(['testuser'], no_watcher_call_args[0])\n T.assert_in('for testuser', no_watcher_call_args[1])\n T.assert_in('testuser - title', no_watcher_call_args[1])\n T.assert_in('[push] testuser - title', no_watcher_call_args[2])\n\n watched_call_args = mailq.call_args_list[1][0]\n T.assert_equal(['testuser', 'testuser1', 'testuser2'], watched_call_args[0])\n T.assert_in('for testuser (testuser1,testuser2)', watched_call_args[1])\n T.assert_in('testuser (testuser1,testuser2) - title', watched_call_args[1])\n T.assert_in('[push] testuser (testuser1,testuser2) - title', watched_call_args[2])",
"metadata": "root.AddRequestServletTest.test_mailqueue_on_db_complete",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 109
},
{
"content": " @mock.patch('pushmanager.core.mail.MailQueue.enqueue_user_email')\n @mock.patch('pushmanager.core.xmppclient.XMPPQueue.enqueue_user_xmpp')\n def test_xmppqueue_on_db_complete(self, xmppq, _):\n self.call_on_db_complete()\n\n no_watcher_call_args = xmppq.call_args_list[0][0]\n T.assert_equal(['testuser'], no_watcher_call_args[0])\n T.assert_in('for testuser', no_watcher_call_args[1])\n\n watched_call_args = xmppq.call_args_list[1][0]\n T.assert_equal(['testuser', 'testuser1', 'testuser2'], watched_call_args[0])\n T.assert_in('for testuser (testuser1,testuser2)', watched_call_args[1])",
"metadata": "root.AddRequestServletTest.test_xmppqueue_on_db_complete",
"header": "['class', 'AddRequestServletTest', '(', 'T', '.', 'TestCase', ',', 'ServletTestMixin', ')', ':', '___EOS___']",
"index": 126
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"types_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"urllib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"contextlib_",
"import_",
"nested_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"testi",
"fy_",
"as_",
"T_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"push",
"manager_",
"._",
"core_",
"import_",
"db_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"push",
"manager_",
"._",
"core_",
"._",
"util_",
"import_",
"get",
"\\u",
"serv",
"let",
"\\u",
"urls",
"pec_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"push",
"manager_",
"._",
"serv",
"lets",
"_",
"._",
"addre",
"quest_",
"import_",
"Add",
"Request",
"Serv",
"let_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"push",
"manager_",
"._",
"testing_",
"._",
"mock",
"settings_",
"import_",
"Mocke",
"d",
"Settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"push",
"manager_",
"._",
"testing_",
"._",
"tests",
"erv",
"let_",
"import_",
"Serv",
"let",
"Test",
"Mixin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"T_",
"._",
"run_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"@_",
"T_",
"._",
"class",
"\\u",
"setup",
"\\u",
"teardown_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"mock",
"\\u",
"serv",
"let",
"\\u",
"env_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"results_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"nested_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"._",
"patch_",
"._",
"dict_",
"(_",
"db_",
"._",
"Settings_",
",_",
"Mocke",
"d",
"Settings_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Add",
"Request",
"Serv",
"let_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"get",
"\\u",
"current",
"\\u",
"user",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"return",
"\\u",
"value_",
"=_",
"\"",
"testu",
"ser",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"record",
"\\u",
"push",
"contents_",
"(_",
"self_",
",_",
"success_",
",_",
"db",
"\\u",
"results_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"success_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"results_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"results_",
"._",
"extend_",
"(_",
"db",
"\\u",
"results_",
"._",
"fetchall_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"handlers_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"[_",
"get",
"\\u",
"serv",
"let",
"\\u",
"urls",
"pec_",
"(_",
"Add",
"Request",
"Serv",
"let_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"add",
"\\u",
"exist",
"ing",
"\\u",
"request_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"._",
"execute",
"\\u",
"cb_",
"(_",
"db_",
"._",
"push",
"\\u",
"push",
"contents_",
"._",
"select_",
"(_",
")_",
",_",
"self_",
"._",
"record",
"\\u",
"push",
"contents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"results",
"\\u",
"before_",
"=_",
"len_",
"(_",
"self_",
"._",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
"=_",
"{_",
"'",
"request",
"'_",
":_",
"1_",
",_",
"'",
"push",
"'_",
":_",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"fetch_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'/",
"addre",
"quest",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"urllib_",
"._",
"urlencode_",
"(_",
"request_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"response_",
"._",
"error_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"execute",
"\\u",
"cb_",
"(_",
"db_",
"._",
"push",
"\\u",
"push",
"contents_",
"._",
"select_",
"(_",
")_",
",_",
"self_",
"._",
"record",
"\\u",
"push",
"contents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"results",
"\\u",
"after_",
"=_",
"len_",
"(_",
"self_",
"._",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"num",
"\\u",
"results",
"\\u",
"after_",
",_",
"num",
"\\u",
"results",
"\\u",
"before_",
",_",
"\"",
"Add",
" ",
"exist",
"ing",
" ",
"request",
" ",
"fail",
"ed",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"add",
"\\u",
"new",
"\\u",
"request_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"db_",
"._",
"execute",
"\\u",
"cb_",
"(_",
"db_",
"._",
"push",
"\\u",
"push",
"contents_",
"._",
"select_",
"(_",
")_",
",_",
"self_",
"._",
"record",
"\\u",
"push",
"contents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"results",
"\\u",
"before_",
"=_",
"len_",
"(_",
"self_",
"._",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"request_",
"=_",
"{_",
"'",
"request",
"'_",
":_",
"2_",
",_",
"'",
"push",
"'_",
":_",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"fetch_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'/",
"addre",
"quest",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"urllib_",
"._",
"urlencode_",
"(_",
"request_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"response_",
"._",
"error_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"db_",
"._",
"execute",
"\\u",
"cb_",
"(_",
"db_",
"._",
"push",
"\\u",
"push",
"contents_",
"._",
"select_",
"(_",
")_",
",_",
"self_",
"._",
"record",
"\\u",
"push",
"contents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"num",
"\\u",
"results",
"\\u",
"after_",
"=_",
"len_",
"(_",
"self_",
"._",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"num",
"\\u",
"results",
"\\u",
"after_",
",_",
"num",
"\\u",
"results",
"\\u",
"before_",
"+_",
"1_",
",_",
"\"",
"Add",
" ",
"new",
" ",
"request",
" ",
"fail",
"ed",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"push",
"manage",
"r",
".",
"core",
".",
"db",
".",
"execute",
"\\u",
"transaction",
"\\u",
"cb",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"push",
"content",
"\\u",
"insert",
"\\u",
"ignore_",
"(_",
"self_",
",_",
"mock",
"\\u",
"transaction_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"request_",
"=_",
"{_",
"'",
"request",
"'_",
":_",
"1_",
",_",
"'",
"push",
"'_",
":_",
"1_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"self_",
"._",
"fetch_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'/",
"addre",
"quest",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"method_",
"=_",
"'",
"POST",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"body_",
"=_",
"urllib_",
"._",
"urlencode_",
"(_",
"request_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"response_",
"._",
"error_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"mock",
"\\u",
"transaction_",
"._",
"call",
"\\u",
"count_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Extract",
" ",
"the",
" ",
"string",
" ",
"of",
" ",
"the",
" ",
"prefix",
" ",
"of",
" ",
"the",
" ",
"insert",
" ",
"query_",
"\\u\\u\\uNL\\u\\u\\u_",
"insert",
"\\u",
"ignore",
"\\u",
"clause_",
"=_",
"mock",
"\\u",
"transaction_",
"._",
"call",
"\\u",
"args_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"is_",
"(_",
"type_",
"(_",
"insert",
"\\u",
"ignore",
"\\u",
"clause_",
")_",
",_",
"db_",
"._",
"Insert",
"Ignor",
"e_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"call",
"\\u",
"on",
"\\u",
"db",
"\\u",
"complete_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mocked",
"\\u",
"self_",
"=_",
"mock_",
"._",
"Mock_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mocked",
"\\u",
"self_",
"._",
"current",
"\\u",
"user_",
"=_",
"'",
"fake",
"\\u",
"push",
"master",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mocked",
"\\u",
"self_",
"._",
"push",
"id_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mocked",
"\\u",
"self_",
"._",
"check",
"\\u",
"db",
"\\u",
"results_",
"=_",
"mock_",
"._",
"Mock_",
"(_",
"return",
"\\u",
"value_",
"=_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mocked",
"\\u",
"self_",
"._",
"on",
"\\u",
"db",
"\\u",
"complete_",
"=_",
"types_",
"._",
"Meth",
"od",
"Type_",
"(_",
"Add",
"Request",
"Serv",
"let_",
"._",
"on",
"\\u",
"db",
"\\u",
"complete_",
"._",
"im",
"\\u",
"func_",
",_",
"mocked",
"\\u",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"no",
"\\u",
"watcher",
"\\u",
"req_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"'",
"testu",
"ser",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"watcher",
"s",
"'_",
":_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"repo",
"'_",
":_",
"'",
"repo",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"branch",
"'_",
":_",
"'",
"branch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"title",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"watched",
"\\u",
"req_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"user",
"'_",
":_",
"'",
"testu",
"ser",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"watcher",
"s",
"'_",
":_",
"'",
"testu",
"ser",
"1",
",",
"testu",
"ser",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"repo",
"'_",
":_",
"'",
"repo",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"branch",
"'_",
":_",
"'",
"branch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"title",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"reqs_",
"=_",
"[_",
"no",
"\\u",
"watcher",
"\\u",
"req_",
",_",
"watched",
"\\u",
"req_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mocked",
"\\u",
"self_",
"._",
"on",
"\\u",
"db",
"\\u",
"complete_",
"(_",
"'",
"success",
"'_",
",_",
"[_",
"None_",
",_",
"reqs_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"push",
"manage",
"r",
".",
"core",
".",
"xmpp",
"client",
".",
"XMPP",
"Queue",
".",
"enqueue",
"\\u",
"user",
"\\u",
"xmpp",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"push",
"manage",
"r",
".",
"core",
".",
"mail",
".",
"Mail",
"Queue",
".",
"enqueue",
"\\u",
"user",
"\\u",
"email",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"mail",
"queue",
"\\u",
"on",
"\\u",
"db",
"\\u",
"complete_",
"(_",
"self_",
",_",
"mail",
"q_",
",_",
"\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"call",
"\\u",
"on",
"\\u",
"db",
"\\u",
"complete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"=_",
"mail",
"q_",
"._",
"call",
"\\u",
"args",
"\\u",
"list_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"[_",
"'",
"testu",
"ser",
"'_",
"]_",
",_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'",
"for",
" ",
"testu",
"ser",
"'_",
",_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'",
"testu",
"ser",
" ",
"-",
" ",
"title",
"'_",
",_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'[",
"push",
"]",
" ",
"testu",
"ser",
" ",
"-",
" ",
"title",
"'_",
",_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"[_",
"2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"=_",
"mail",
"q_",
"._",
"call",
"\\u",
"args",
"\\u",
"list_",
"[_",
"1_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"[_",
"'",
"testu",
"ser",
"'_",
",_",
"'",
"testu",
"ser",
"1",
"'_",
",_",
"'",
"testu",
"ser",
"2",
"'_",
"]_",
",_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'",
"for",
" ",
"testu",
"ser",
" ",
"(",
"testu",
"ser",
"1",
",",
"testu",
"ser",
"2",
")'_",
",_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'",
"testu",
"ser",
" ",
"(",
"testu",
"ser",
"1",
",",
"testu",
"ser",
"2",
")",
" ",
"-",
" ",
"title",
"'_",
",_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'[",
"push",
"]",
" ",
"testu",
"ser",
" ",
"(",
"testu",
"ser",
"1",
",",
"testu",
"ser",
"2",
")",
" ",
"-",
" ",
"title",
"'_",
",_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"[_",
"2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Add",
"Request",
"Serv",
"let",
"Test_",
"(_",
"T_",
"._",
"Test",
"Case_",
",_",
"Serv",
"let",
"Test",
"Mixin_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"push",
"manage",
"r",
".",
"core",
".",
"mail",
".",
"Mail",
"Queue",
".",
"enqueue",
"\\u",
"user",
"\\u",
"email",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"(_",
"'",
"push",
"manage",
"r",
".",
"core",
".",
"xmpp",
"client",
".",
"XMPP",
"Queue",
".",
"enqueue",
"\\u",
"user",
"\\u",
"xmpp",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"xmpp",
"queue",
"\\u",
"on",
"\\u",
"db",
"\\u",
"complete_",
"(_",
"self_",
",_",
"xmpp",
"q_",
",_",
"\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"call",
"\\u",
"on",
"\\u",
"db",
"\\u",
"complete_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"=_",
"xmpp",
"q_",
"._",
"call",
"\\u",
"args",
"\\u",
"list_",
"[_",
"0_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"[_",
"'",
"testu",
"ser",
"'_",
"]_",
",_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'",
"for",
" ",
"testu",
"ser",
"'_",
",_",
"no",
"\\u",
"watcher",
"\\u",
"call",
"\\u",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"=_",
"xmpp",
"q_",
"._",
"call",
"\\u",
"args",
"\\u",
"list_",
"[_",
"1_",
"]_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"equal_",
"(_",
"[_",
"'",
"testu",
"ser",
"'_",
",_",
"'",
"testu",
"ser",
"1",
"'_",
",_",
"'",
"testu",
"ser",
"2",
"'_",
"]_",
",_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"T_",
"._",
"assert",
"\\u",
"in_",
"(_",
"'",
"for",
" ",
"testu",
"ser",
" ",
"(",
"testu",
"ser",
"1",
",",
"testu",
"ser",
"2",
")'_",
",_",
"watched",
"\\u",
"call",
"\\u",
"args_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | avalente/appmetrics/appmetrics/metrics.py | [
{
"content": "def get_or_create_histogram(name, reservoir_type, *reservoir_args, **reservoir_kwargs):\n \"\"\"\n Will return a histogram matching the given parameters or raise\n DuplicateMetricError if it can't be created due to a name collision\n with another histogram with different parameters.\n \"\"\"\n reservoir = new_reservoir(reservoir_type, *reservoir_args, **reservoir_kwargs)\n\n try:\n hmetric = new_histogram(name, reservoir)\n except DuplicateMetricError:\n hmetric = metric(name)\n if not isinstance(hmetric, histogram.Histogram):\n raise DuplicateMetricError(\n \"Metric {!r} already exists of type {!r}\".format(name, type(hmetric).__name__))\n\n if not hmetric.reservoir.same_kind(reservoir):\n raise DuplicateMetricError(\n \"Metric {!r} already exists with a different reservoir: {}\".format(name, hmetric.reservoir))\n\n return hmetric",
"metadata": "root.get_or_create_histogram",
"header": "['module', '___EOS___']",
"index": 163
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"or",
"\\u",
"create",
"\\u",
"histogram_",
"(_",
"name_",
",_",
"rese",
"rvo",
"ir",
"\\u",
"type_",
",_",
"*_",
"rese",
"rvo",
"ir",
"\\u",
"args_",
",_",
"**_",
"rese",
"rvo",
"ir",
"\\u",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Wil",
"l",
" ",
"return",
" ",
"a",
" ",
"histo",
"gram",
" ",
"matchi",
"ng",
" ",
"the",
" ",
"give",
"n",
" ",
"parameter",
"s",
" ",
"or",
" ",
"raise",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Duplicate",
"Met",
"ric",
"Error",
" ",
"if",
" ",
"it",
" ",
"can",
"'",
"t",
" ",
"be",
" ",
"created",
" ",
"due",
" ",
"to",
" ",
"a",
" ",
"name",
" ",
"colli",
"sion",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"with",
" ",
"anot",
"her",
" ",
"histo",
"gram",
" ",
"with",
" ",
"different",
" ",
"parameter",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rese",
"rvo",
"ir_",
"=_",
"new",
"\\u",
"rese",
"rvo",
"ir_",
"(_",
"rese",
"rvo",
"ir",
"\\u",
"type_",
",_",
"*_",
"rese",
"rvo",
"ir",
"\\u",
"args_",
",_",
"**_",
"rese",
"rvo",
"ir",
"\\u",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"hm",
"etric",
"_",
"=_",
"new",
"\\u",
"histogram_",
"(_",
"name_",
",_",
"rese",
"rvo",
"ir_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Duplicate",
"Met",
"ric",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"hm",
"etric",
"_",
"=_",
"metric_",
"(_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"isinstance_",
"(_",
"hm",
"etric",
"_",
",_",
"histogram_",
"._",
"Histogram",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Duplicate",
"Met",
"ric",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Met",
"ric",
" ",
"{",
"!",
"r",
"}",
" ",
"alr",
"ead",
"y",
" ",
"exist",
"s",
" ",
"of",
" ",
"type",
" ",
"{",
"!",
"r",
"}\"_",
"._",
"format_",
"(_",
"name_",
",_",
"type_",
"(_",
"hm",
"etric",
"_",
")_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"hm",
"etric",
"_",
"._",
"rese",
"rvo",
"ir_",
"._",
"same",
"\\u",
"kind_",
"(_",
"rese",
"rvo",
"ir_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Duplicate",
"Met",
"ric",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Met",
"ric",
" ",
"{",
"!",
"r",
"}",
" ",
"alr",
"ead",
"y",
" ",
"exist",
"s",
" ",
"with",
" ",
"a",
" ",
"different",
" ",
"rese",
"rvo",
"ir",
":",
" ",
"{}\"_",
"._",
"format_",
"(_",
"name_",
",_",
"hm",
"etric",
"_",
"._",
"rese",
"rvo",
"ir_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"hm",
"etric",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | yhat/ggplot/ggplot/components/colors.py | [
{
"content": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nimport numpy as np\nfrom matplotlib.colors import rgb2hex\nfrom ..utils.color import ColorHCL\nfrom .legend import get_labels\nfrom copy import deepcopy\nfrom ..utils.exceptions import GgplotError\nfrom . import palettes\nimport six\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def hue_pal(h=(0 + 15, 360 + 15), c=100, l=65, h_start=0, direction=1):\n \"\"\"\n Utility for making hue palettes for color schemes.\n \"\"\"\n c /= 100.\n l /= 100.\n hcl = ColorHCL()\n def func(n):\n y = deepcopy(h)\n if (y[1] - y[0]) % 360 < 1:\n y = (y[0], y[1] - 360. / n)\n hues = []\n for x in np.linspace(y[0], y[1], n):\n hue = ((x + h_start) % 360) * direction\n hues.append(rgb2hex(hcl(hue, c, l)))\n return hues\n return func",
"metadata": "root.hue_pal",
"header": "['module', '___EOS___']",
"index": 13
},
{
"content": "def color_gen(n_colors, colors=None):\n \"\"\"\n Generator that will infinitely produce colors when asked politely. Colors\n are based on the color wheel and the default colors will be chosen by\n maximizing the distance between each color (based on the color wheel).\n\n Parameters\n ----------\n n_colors: int\n number of colors you need\n colors: list\n a list of colors. can be hex or actual names\n \"\"\"\n while True:\n if colors is None:\n for color in palettes.hls_palette(n_colors=n_colors):\n yield rgb2hex(color)\n else:\n for color in colors:\n yield color",
"metadata": "root.color_gen",
"header": "['module', '___EOS___']",
"index": 32
},
{
"content": "def assign_colors(data, aes, gg, aes_name='color'):\n \"\"\"\n Assigns colors to the given data based on the aes and adds the right legend\n\n We need to take a value an convert it into colors that we can actually\n plot. This means checking to see if we're colorizing a discrete or\n continuous value, checking if their is a colormap, etc.\n\n Parameters\n ----------\n data : DataFrame\n dataframe which should have colors assigned to\n aes : aesthetic\n mapping, including a mapping from color to variable\n gg : ggplot object, which holds information and gets a legend assigned\n aes_name : string\n Which aesthetic needs a color mapping; 'color' | 'fill'\n\n Returns\n -------\n data : DataFrame\n the changed dataframe\n legend_entry : dict\n An entry into the legend dictionary.\n Documented in `components.legend`\n \"\"\"\n legend_entry = dict()\n if aes_name in aes:\n color_col = aes[aes_name]\n labels, scale_type, indices = get_labels(data, color_col)\n if scale_type == \"continuous\" :\n data, legend_entry = assign_continuous_colors(\n data, gg, aes_name, color_col, labels, indices)\n elif scale_type == \"discrete\" :\n data, legend_entry = assign_discrete_colors(\n data, gg, aes_name, color_col, labels)\n else :\n raise GgplotError(\"Unknow scale_type: '%s'\" % scale_type)\n\n return data, legend_entry",
"metadata": "root.assign_colors",
"header": "['module', '___EOS___']",
"index": 54
},
{
"content": "def assign_continuous_colors(data, gg, aes_name, color_col, labels, indices):\n \"\"\"\n Logic to assign colors in the continuous case.\n\n Handle continuous colors here. We're going to use whatever colormap\n is defined to evaluate for each value. We're then going to convert\n each color to HEX so that it can fit in 1 column. This will make it\n much easier when creating layers. We're also going to evaluate the\n quantiles for that particular column to generate legend scales. This\n isn't what ggplot does, but it's good enough for now.\n\n Parameters\n ----------\n data : DataFrame\n dataframe which should have shapes assigned to\n gg : ggplot object\n It holds the colormap\n color_col : The column we are using to color.\n aes_name : string\n Which aesthetic needs a color mapping; 'color' | 'fill'\n labels : [string]\n A list of legend labels\n indices : [int]\n The percentile indices used to generate the labels\n\n Returns\n -------\n data : DataFrame\n the changed dataframe\n legend_entry : dict\n An entry into the legend dictionary.\n Documented in `components.legend`\n \"\"\"\n _mcolumn = ':::%s_mapping:::' % aes_name\n min_val = data[color_col].min()\n max_val = data[color_col].max()\n values = (data[color_col] - min_val) / (max_val - min_val)\n values = values.tolist()\n color_mapping = gg.colormap(values)[::, :3]\n data[_mcolumn] = [rgb2hex(value) for value in color_mapping]\n key_colors = gg.colormap(indices)[::, :3]\n key_colors = [rgb2hex(value) for value in key_colors]\n\n legend_entry = {'column_name': color_col,\n 'dict' : dict(zip(key_colors, labels)),\n 'scale_type': 'continuous'}\n return data, legend_entry",
"metadata": "root.assign_continuous_colors",
"header": "['module', '___EOS___']",
"index": 96
},
{
"content": "def assign_discrete_colors(data, gg, aes_name, color_col, labels):\n \"\"\"\n Logic to assign colors in the discrete case.\n\n We're going to check and see if the user has defined their own color\n palette. If they have then we'll use those colors for mapping. If not,\n then we'll generate some default colors. We also have to be careful here\n because for some odd reason the next() function is different in Python 2.7\n and Python 3.0. Once we've done that we generate the legends based off\n the (color -> value) mapping.\n\n Parameters\n ----------\n data : DataFrame\n dataframe which should have colors assigned to\n gg : ggplot object, which holds information and gets a legend assigned\n color_col : The column we are using to color.\n aes_name : string\n Which aesthetic needs a color mapping; 'color' | 'fill'\n\n Returns\n -------\n data : DataFrame\n the changed dataframe\n legend_entry : dict\n An entry into the legend dict\n Documented in `components.legend`\n \"\"\"\n _mcolumn = ':::%s_mapping:::' % aes_name\n possible_colors = np.unique(data[color_col])\n if gg.manual_color_list:\n color = color_gen(len(possible_colors), gg.manual_color_list)\n else:\n color = color_gen(len(possible_colors))\n color_mapping = dict((value, six.next(color)) for value in possible_colors)\n data[_mcolumn] = data[color_col].apply(lambda x: color_mapping[x])\n\n legend_entry = {'column_name': color_col,\n 'dict': dict((v, k) for k, v in color_mapping.items()),\n 'scale_type': 'discrete'}\n return data, legend_entry",
"metadata": "root.assign_discrete_colors",
"header": "['module', '___EOS___']",
"index": 145
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"(_",
"abs",
"olute",
"\\u",
"import_",
",_",
"division_",
",_",
"print",
"\\u",
"function_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"unicode",
"\\u",
"literals_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"matplotlib_",
"._",
"colors_",
"import_",
"rgb",
"2h",
"ex_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"utils_",
"._",
"color_",
"import_",
"Color",
"HC",
"L_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"legend_",
"import_",
"get",
"\\u",
"labels_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"copy_",
"import_",
"deepcopy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"._",
"utils_",
"._",
"exceptions_",
"import_",
"Gg",
"plot",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"import_",
"palette",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"six_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"hue",
"\\u",
"pal",
"_",
"(_",
"h_",
"=_",
"(_",
"0_",
"+_",
"15_",
",_",
"360_",
"+_",
"15_",
")_",
",_",
"c_",
"=_",
"100_",
",_",
"l_",
"=_",
"65_",
",_",
"h",
"\\u",
"start_",
"=_",
"0_",
",_",
"direction_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Utili",
"ty",
" ",
"for",
" ",
"mak",
"ing",
" ",
"hue",
" ",
"palette",
"s",
" ",
"for",
" ",
"color",
" ",
"schemes",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"/=_",
"100._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"l_",
"/=_",
"100._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"hc",
"l_",
"=_",
"Color",
"HC",
"L_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"func_",
"(_",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"y_",
"=_",
"deepcopy_",
"(_",
"h_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"y_",
"[_",
"1_",
"]_",
"-_",
"y_",
"[_",
"0_",
"]_",
")_",
"%_",
"360_",
"<_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"y_",
"=_",
"(_",
"y_",
"[_",
"0_",
"]_",
",_",
"y_",
"[_",
"1_",
"]_",
"-_",
"360.",
"_",
"/_",
"n_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"hue",
"s_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"x_",
"in_",
"np_",
"._",
"linspace_",
"(_",
"y_",
"[_",
"0_",
"]_",
",_",
"y_",
"[_",
"1_",
"]_",
",_",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"hue_",
"=_",
"(_",
"(_",
"x_",
"+_",
"h",
"\\u",
"start_",
")_",
"%_",
"360_",
")_",
"*_",
"direction_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"hue",
"s_",
"._",
"append_",
"(_",
"rgb",
"2h",
"ex_",
"(_",
"hc",
"l_",
"(_",
"hue_",
",_",
"c_",
",_",
"l_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"hue",
"s_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"func_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"color",
"\\u",
"gen_",
"(_",
"n",
"\\u",
"colors_",
",_",
"colors_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Generat",
"or",
" ",
"tha",
"t",
" ",
"will",
" ",
"infini",
"tel",
"y",
" ",
"produce",
" ",
"colors",
" ",
"whe",
"n",
" ",
"ask",
"ed",
" ",
"poli",
"tel",
"y",
".",
" ",
"Color",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"are",
" ",
"based",
" ",
"on",
" ",
"the",
" ",
"color",
" ",
"wheel",
" ",
"and",
" ",
"the",
" ",
"default",
" ",
"colors",
" ",
"will",
" ",
"be",
" ",
"chosen",
" ",
"by",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"maxim",
"izi",
"ng",
" ",
"the",
" ",
"distance",
" ",
"bet",
"ween",
" ",
"each",
" ",
"color",
" ",
"(",
"based",
" ",
"on",
" ",
"the",
" ",
"color",
" ",
"wheel",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"n",
"\\u",
"colors",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"number",
" ",
"of",
" ",
"colors",
" ",
"you",
" ",
"need",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"colors",
":",
" ",
"list",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"colors",
".",
" ",
"can",
" ",
"be",
" ",
"hex",
" ",
"or",
" ",
"actual",
" ",
"names",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"True_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"colors_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"color_",
"in_",
"palette",
"s_",
"._",
"hls",
"\\u",
"palette_",
"(_",
"n",
"\\u",
"colors_",
"=_",
"n",
"\\u",
"colors_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"rgb",
"2h",
"ex_",
"(_",
"color_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"color_",
"in_",
"colors_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"yield_",
"color_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"assign",
"\\u",
"colors_",
"(_",
"data_",
",_",
"aes",
"_",
",_",
"gg_",
",_",
"aes",
"\\u",
"name_",
"=_",
"'",
"color",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Assign",
"s",
" ",
"colors",
" ",
"to",
" ",
"the",
" ",
"give",
"n",
" ",
"data",
" ",
"based",
" ",
"on",
" ",
"the",
" ",
"aes",
" ",
"and",
" ",
"adds",
" ",
"the",
" ",
"right",
" ",
"legend",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"We",
" ",
"need",
" ",
"to",
" ",
"take",
" ",
"a",
" ",
"value",
" ",
"an",
" ",
"convert",
" ",
"it",
" ",
"int",
"o",
" ",
"colors",
" ",
"tha",
"t",
" ",
"we",
" ",
"can",
" ",
"actual",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"plot",
".",
" ",
"Thi",
"s",
" ",
"means",
" ",
"checking",
" ",
"to",
" ",
"see",
" ",
"if",
" ",
"we",
"'",
"re",
" ",
"coloriz",
"ing",
" ",
"a",
" ",
"discrete",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"continuous",
" ",
"value",
",",
" ",
"checking",
" ",
"if",
" ",
"thei",
"r",
" ",
"is",
" ",
"a",
" ",
"colormap",
",",
" ",
"etc",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"dataframe",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"have",
" ",
"colors",
" ",
"assign",
"ed",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"aes",
" ",
":",
" ",
"aes",
"thet",
"ic",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mapping",
",",
" ",
"inclu",
"ding",
" ",
"a",
" ",
"mapping",
" ",
"from",
" ",
"color",
" ",
"to",
" ",
"variab",
"le",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"gg",
" ",
":",
" ",
"gg",
"plot",
" ",
"object",
",",
" ",
"whi",
"ch",
" ",
"hold",
"s",
" ",
"informati",
"on",
" ",
"and",
" ",
"gets",
" ",
"a",
" ",
"legend",
" ",
"assign",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"aes",
"\\u",
"name",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whi",
"ch",
" ",
"aes",
"thet",
"ic",
" ",
"need",
"s",
" ",
"a",
" ",
"color",
" ",
"mapping",
";",
" ",
"'",
"color",
"'",
" ",
"|",
" ",
"'",
"fill",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"change",
"d",
" ",
"dataframe",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"legend",
"\\u",
"entry",
" ",
":",
" ",
"dict",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"entry",
" ",
"int",
"o",
" ",
"the",
" ",
"legend",
" ",
"dictionar",
"y",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Document",
"ed",
" ",
"in",
" ",
"`",
"component",
"s",
".",
"legend",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"legend",
"\\u",
"entry_",
"=_",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"aes",
"\\u",
"name_",
"in_",
"aes",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"color",
"\\u",
"col_",
"=_",
"aes",
"_",
"[_",
"aes",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"labels_",
",_",
"scale",
"\\u",
"type_",
",_",
"indices_",
"=_",
"get",
"\\u",
"labels_",
"(_",
"data_",
",_",
"color",
"\\u",
"col_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"scale",
"\\u",
"type_",
"==_",
"\"",
"continuous",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
",_",
"legend",
"\\u",
"entry_",
"=_",
"assign",
"\\u",
"continuous",
"\\u",
"colors_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
",_",
"gg_",
",_",
"aes",
"\\u",
"name_",
",_",
"color",
"\\u",
"col_",
",_",
"labels_",
",_",
"indices_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"scale",
"\\u",
"type_",
"==_",
"\"",
"discrete",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
",_",
"legend",
"\\u",
"entry_",
"=_",
"assign",
"\\u",
"discrete",
"\\u",
"colors_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
",_",
"gg_",
",_",
"aes",
"\\u",
"name_",
",_",
"color",
"\\u",
"col_",
",_",
"labels_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Gg",
"plot",
"Error_",
"(_",
"\"",
"Un",
"know",
" ",
"scale",
"\\u",
"type",
":",
" ",
"'%",
"s",
"'\"_",
"%_",
"scale",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"data_",
",_",
"legend",
"\\u",
"entry_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"assign",
"\\u",
"continuous",
"\\u",
"colors_",
"(_",
"data_",
",_",
"gg_",
",_",
"aes",
"\\u",
"name_",
",_",
"color",
"\\u",
"col_",
",_",
"labels_",
",_",
"indices_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Logi",
"c",
" ",
"to",
" ",
"assign",
" ",
"colors",
" ",
"in",
" ",
"the",
" ",
"continuous",
" ",
"case",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Handle",
" ",
"continuous",
" ",
"colors",
" ",
"here",
".",
" ",
"We",
"'",
"re",
" ",
"goi",
"ng",
" ",
"to",
" ",
"use",
" ",
"what",
"ever",
" ",
"colormap",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
" ",
"defin",
"ed",
" ",
"to",
" ",
"evaluate",
" ",
"for",
" ",
"each",
" ",
"value",
".",
" ",
"We",
"'",
"re",
" ",
"then",
" ",
"goi",
"ng",
" ",
"to",
" ",
"convert",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"each",
" ",
"color",
" ",
"to",
" ",
"HEX",
" ",
"so",
" ",
"tha",
"t",
" ",
"it",
" ",
"can",
" ",
"fit",
" ",
"in",
" ",
"1",
" ",
"column",
".",
" ",
"Thi",
"s",
" ",
"will",
" ",
"make",
" ",
"it",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"muc",
"h",
" ",
"easi",
"er",
" ",
"whe",
"n",
" ",
"creati",
"ng",
" ",
"layer",
"s",
".",
" ",
"We",
"'",
"re",
" ",
"als",
"o",
" ",
"goi",
"ng",
" ",
"to",
" ",
"evaluate",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"quantiles",
" ",
"for",
" ",
"tha",
"t",
" ",
"partic",
"ular",
" ",
"column",
" ",
"to",
" ",
"generat",
"e",
" ",
"legend",
" ",
"scale",
"s",
".",
" ",
"Thi",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"isn",
"'",
"t",
" ",
"what",
" ",
"gg",
"plot",
" ",
"doe",
"s",
",",
" ",
"but",
" ",
"it",
"'",
"s",
" ",
"good",
" ",
"eno",
"ugh",
" ",
"for",
" ",
"now",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"dataframe",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"have",
" ",
"shape",
"s",
" ",
"assign",
"ed",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"gg",
" ",
":",
" ",
"gg",
"plot",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"It",
" ",
"hold",
"s",
" ",
"the",
" ",
"colormap",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"color",
"\\u",
"col",
" ",
":",
" ",
"The",
" ",
"column",
" ",
"we",
" ",
"are",
" ",
"usi",
"ng",
" ",
"to",
" ",
"color",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"aes",
"\\u",
"name",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whi",
"ch",
" ",
"aes",
"thet",
"ic",
" ",
"need",
"s",
" ",
"a",
" ",
"color",
" ",
"mapping",
";",
" ",
"'",
"color",
"'",
" ",
"|",
" ",
"'",
"fill",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"labels",
" ",
":",
" ",
"[",
"string",
"]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"legend",
" ",
"labels",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"indice",
"s",
" ",
":",
" ",
"[",
"int",
"]",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"percentile",
" ",
"indice",
"s",
" ",
"used",
" ",
"to",
" ",
"generat",
"e",
" ",
"the",
" ",
"labels",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"change",
"d",
" ",
"dataframe",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"legend",
"\\u",
"entry",
" ",
":",
" ",
"dict",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"entry",
" ",
"int",
"o",
" ",
"the",
" ",
"legend",
" ",
"dictionar",
"y",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Document",
"ed",
" ",
"in",
" ",
"`",
"component",
"s",
".",
"legend",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"mco",
"lum",
"n_",
"=_",
"':",
"::",
"%",
"s",
"\\u",
"mapping",
":::",
"'_",
"%_",
"aes",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"min",
"\\u",
"val_",
"=_",
"data_",
"[_",
"color",
"\\u",
"col_",
"]_",
"._",
"min_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"max",
"\\u",
"val_",
"=_",
"data_",
"[_",
"color",
"\\u",
"col_",
"]_",
"._",
"max_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"values_",
"=_",
"(_",
"data_",
"[_",
"color",
"\\u",
"col_",
"]_",
"-_",
"min",
"\\u",
"val_",
")_",
"/_",
"(_",
"max",
"\\u",
"val_",
"-_",
"min",
"\\u",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"values_",
"=_",
"values_",
"._",
"tolist_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"color",
"\\u",
"mapping_",
"=_",
"gg_",
"._",
"colormap_",
"(_",
"values_",
")_",
"[_",
":_",
":_",
",_",
":_",
"3_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"[_",
"\\u",
"mco",
"lum",
"n_",
"]_",
"=_",
"[_",
"rgb",
"2h",
"ex_",
"(_",
"value_",
")_",
"for_",
"value_",
"in_",
"color",
"\\u",
"mapping_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key",
"\\u",
"colors_",
"=_",
"gg_",
"._",
"colormap_",
"(_",
"indices_",
")_",
"[_",
":_",
":_",
",_",
":_",
"3_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"key",
"\\u",
"colors_",
"=_",
"[_",
"rgb",
"2h",
"ex_",
"(_",
"value_",
")_",
"for_",
"value_",
"in_",
"key",
"\\u",
"colors_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"legend",
"\\u",
"entry_",
"=_",
"{_",
"'",
"column",
"\\u",
"name",
"'_",
":_",
"color",
"\\u",
"col_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dict",
"'_",
":_",
"dict_",
"(_",
"zip_",
"(_",
"key",
"\\u",
"colors_",
",_",
"labels_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"scale",
"\\u",
"type",
"'_",
":_",
"'",
"continuous",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"data_",
",_",
"legend",
"\\u",
"entry_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"assign",
"\\u",
"discrete",
"\\u",
"colors_",
"(_",
"data_",
",_",
"gg_",
",_",
"aes",
"\\u",
"name_",
",_",
"color",
"\\u",
"col_",
",_",
"labels_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Logi",
"c",
" ",
"to",
" ",
"assign",
" ",
"colors",
" ",
"in",
" ",
"the",
" ",
"discrete",
" ",
"case",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"We",
"'",
"re",
" ",
"goi",
"ng",
" ",
"to",
" ",
"check",
" ",
"and",
" ",
"see",
" ",
"if",
" ",
"the",
" ",
"user",
" ",
"has",
" ",
"defin",
"ed",
" ",
"thei",
"r",
" ",
"own",
" ",
"color",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"palette",
".",
" ",
"If",
" ",
"the",
"y",
" ",
"have",
" ",
"then",
" ",
"we",
"'",
"ll",
" ",
"use",
" ",
"tho",
"se",
" ",
"colors",
" ",
"for",
" ",
"mapping",
".",
" ",
"If",
" ",
"not",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"then",
" ",
"we",
"'",
"ll",
" ",
"generat",
"e",
" ",
"some",
" ",
"default",
" ",
"colors",
".",
" ",
"We",
" ",
"als",
"o",
" ",
"have",
" ",
"to",
" ",
"be",
" ",
"care",
"ful",
" ",
"here",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bec",
"aus",
"e",
" ",
"for",
" ",
"some",
" ",
"odd",
" ",
"reason",
" ",
"the",
" ",
"next",
"()",
" ",
"function",
" ",
"is",
" ",
"different",
" ",
"in",
" ",
"Pyth",
"on",
" ",
"2.7",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"Pyth",
"on",
" ",
"3.0",
".",
" ",
"On",
"ce",
" ",
"we",
"'",
"ve",
" ",
"don",
"e",
" ",
"tha",
"t",
" ",
"we",
" ",
"generat",
"e",
" ",
"the",
" ",
"legend",
"s",
" ",
"based",
" ",
"off",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"(",
"color",
" ",
"->",
" ",
"value",
")",
" ",
"mapping",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"dataframe",
" ",
"whi",
"ch",
" ",
"shou",
"ld",
" ",
"have",
" ",
"colors",
" ",
"assign",
"ed",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"gg",
" ",
":",
" ",
"gg",
"plot",
" ",
"object",
",",
" ",
"whi",
"ch",
" ",
"hold",
"s",
" ",
"informati",
"on",
" ",
"and",
" ",
"gets",
" ",
"a",
" ",
"legend",
" ",
"assign",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"color",
"\\u",
"col",
" ",
":",
" ",
"The",
" ",
"column",
" ",
"we",
" ",
"are",
" ",
"usi",
"ng",
" ",
"to",
" ",
"color",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"aes",
"\\u",
"name",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Whi",
"ch",
" ",
"aes",
"thet",
"ic",
" ",
"need",
"s",
" ",
"a",
" ",
"color",
" ",
"mapping",
";",
" ",
"'",
"color",
"'",
" ",
"|",
" ",
"'",
"fill",
"'",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"Data",
"Frame",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"change",
"d",
" ",
"dataframe",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"legend",
"\\u",
"entry",
" ",
":",
" ",
"dict",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"entry",
" ",
"int",
"o",
" ",
"the",
" ",
"legend",
" ",
"dict",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Document",
"ed",
" ",
"in",
" ",
"`",
"component",
"s",
".",
"legend",
"`",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"mco",
"lum",
"n_",
"=_",
"':",
"::",
"%",
"s",
"\\u",
"mapping",
":::",
"'_",
"%_",
"aes",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"possib",
"le",
"\\u",
"colors_",
"=_",
"np_",
"._",
"unique_",
"(_",
"data_",
"[_",
"color",
"\\u",
"col_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"gg_",
"._",
"manu",
"al",
"\\u",
"color",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"color_",
"=_",
"color",
"\\u",
"gen_",
"(_",
"len_",
"(_",
"possib",
"le",
"\\u",
"colors_",
")_",
",_",
"gg_",
"._",
"manu",
"al",
"\\u",
"color",
"\\u",
"list_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"color_",
"=_",
"color",
"\\u",
"gen_",
"(_",
"len_",
"(_",
"possib",
"le",
"\\u",
"colors_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"color",
"\\u",
"mapping_",
"=_",
"dict_",
"(_",
"(_",
"value_",
",_",
"six_",
"._",
"next_",
"(_",
"color_",
")_",
")_",
"for_",
"value_",
"in_",
"possib",
"le",
"\\u",
"colors_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"[_",
"\\u",
"mco",
"lum",
"n_",
"]_",
"=_",
"data_",
"[_",
"color",
"\\u",
"col_",
"]_",
"._",
"apply_",
"(_",
"lambda_",
"x_",
":_",
"color",
"\\u",
"mapping_",
"[_",
"x_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"legend",
"\\u",
"entry_",
"=_",
"{_",
"'",
"column",
"\\u",
"name",
"'_",
":_",
"color",
"\\u",
"col_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dict",
"'_",
":_",
"dict_",
"(_",
"(_",
"v_",
",_",
"k_",
")_",
"for_",
"k_",
",_",
"v_",
"in_",
"color",
"\\u",
"mapping_",
"._",
"items_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"scale",
"\\u",
"type",
"'_",
":_",
"'",
"discrete",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"data_",
",_",
"legend",
"\\u",
"entry_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | openstack/ironic/ironic/tests/unit/db/test_conductor.py | [
{
"content": "# Copyright 2013 Hewlett-Packard Development Company, L.P.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"Tests for manipulating Conductors via the DB API\"\"\"\n\nimport datetime\n\nimport mock\nfrom oslo_utils import timeutils\n\nfrom ironic.common import exception\nfrom ironic.tests.unit.db import base\nfrom ironic.tests.unit.db import utils\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class DbConductorTestCase(base.DbTestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.DbConductorTestCase",
"header": "['module', '___EOS___']",
"index": 27
},
{
"content": " def test_register_conductor_existing_fails(self):\n c = utils.get_test_conductor()\n self.dbapi.register_conductor(c)\n self.assertRaises(\n exception.ConductorAlreadyRegistered,\n self.dbapi.register_conductor,\n c)",
"metadata": "root.DbConductorTestCase.test_register_conductor_existing_fails",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 29
},
{
"content": " def test_register_conductor_override(self):\n c = utils.get_test_conductor()\n self.dbapi.register_conductor(c)\n self.dbapi.register_conductor(c, update_existing=True)",
"metadata": "root.DbConductorTestCase.test_register_conductor_override",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 37
},
{
"content": " def _create_test_cdr(self, **kwargs):\n c = utils.get_test_conductor(**kwargs)\n return self.dbapi.register_conductor(c)",
"metadata": "root.DbConductorTestCase._create_test_cdr",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 42
},
{
"content": " def test_get_conductor(self):\n c1 = self._create_test_cdr()\n c2 = self.dbapi.get_conductor(c1.hostname)\n self.assertEqual(c1.id, c2.id)",
"metadata": "root.DbConductorTestCase.test_get_conductor",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 46
},
{
"content": " def test_get_conductor_not_found(self):\n self._create_test_cdr()\n self.assertRaises(\n exception.ConductorNotFound,\n self.dbapi.get_conductor,\n 'bad-hostname')",
"metadata": "root.DbConductorTestCase.test_get_conductor_not_found",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " def test_unregister_conductor(self):\n c = self._create_test_cdr()\n self.dbapi.unregister_conductor(c.hostname)\n self.assertRaises(\n exception.ConductorNotFound,\n self.dbapi.unregister_conductor,\n c.hostname)",
"metadata": "root.DbConductorTestCase.test_unregister_conductor",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 58
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_touch_conductor(self, mock_utcnow):\n test_time = datetime.datetime(2000, 1, 1, 0, 0)\n mock_utcnow.return_value = test_time\n c = self._create_test_cdr()\n self.assertEqual(test_time, timeutils.normalize_time(c.updated_at))\n\n test_time = datetime.datetime(2000, 1, 1, 0, 1)\n mock_utcnow.return_value = test_time\n self.dbapi.touch_conductor(c.hostname)\n c = self.dbapi.get_conductor(c.hostname)\n self.assertEqual(test_time, timeutils.normalize_time(c.updated_at))",
"metadata": "root.DbConductorTestCase.test_touch_conductor",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 66
},
{
"content": " def test_touch_conductor_not_found(self):\n # A conductor's heartbeat will not create a new record,\n # it will only update existing ones\n self._create_test_cdr()\n self.assertRaises(\n exception.ConductorNotFound,\n self.dbapi.touch_conductor,\n 'bad-hostname')",
"metadata": "root.DbConductorTestCase.test_touch_conductor_not_found",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 79
},
{
"content": " def test_touch_offline_conductor(self):\n # Ensure that a conductor's periodic heartbeat task can make the\n # conductor visible again, even if it was spuriously marked offline\n c = self._create_test_cdr()\n self.dbapi.unregister_conductor(c.hostname)\n self.assertRaises(\n exception.ConductorNotFound,\n self.dbapi.get_conductor,\n c.hostname)\n self.dbapi.touch_conductor(c.hostname)\n self.dbapi.get_conductor(c.hostname)",
"metadata": "root.DbConductorTestCase.test_touch_offline_conductor",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 88
},
{
"content": " def test_clear_node_reservations_for_conductor(self):\n node1 = self.dbapi.create_node({'reservation': 'hostname1'})\n node2 = self.dbapi.create_node({'reservation': 'hostname2'})\n node3 = self.dbapi.create_node({'reservation': None})\n self.dbapi.clear_node_reservations_for_conductor('hostname1')\n node1 = self.dbapi.get_node_by_id(node1.id)\n node2 = self.dbapi.get_node_by_id(node2.id)\n node3 = self.dbapi.get_node_by_id(node3.id)\n self.assertIsNone(node1.reservation)\n self.assertEqual('hostname2', node2.reservation)\n self.assertIsNone(node3.reservation)",
"metadata": "root.DbConductorTestCase.test_clear_node_reservations_for_conductor",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 100
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_active_driver_dict_one_host_no_driver(self, mock_utcnow):\n h = 'fake-host'\n expected = {}\n\n mock_utcnow.return_value = datetime.datetime.utcnow()\n self._create_test_cdr(hostname=h, drivers=[])\n result = self.dbapi.get_active_driver_dict()\n self.assertEqual(expected, result)",
"metadata": "root.DbConductorTestCase.test_get_active_driver_dict_one_host_no_driver",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 112
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_active_driver_dict_one_host_one_driver(self, mock_utcnow):\n h = 'fake-host'\n d = 'fake-driver'\n expected = {d: set([h])}\n\n mock_utcnow.return_value = datetime.datetime.utcnow()\n self._create_test_cdr(hostname=h, drivers=[d])\n result = self.dbapi.get_active_driver_dict()\n self.assertEqual(expected, result)",
"metadata": "root.DbConductorTestCase.test_get_active_driver_dict_one_host_one_driver",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 122
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_active_driver_dict_one_host_many_drivers(self, mock_utcnow):\n h = 'fake-host'\n d1 = 'driver-one'\n d2 = 'driver-two'\n expected = {d1: set([h]), d2: set([h])}\n\n mock_utcnow.return_value = datetime.datetime.utcnow()\n self._create_test_cdr(hostname=h, drivers=[d1, d2])\n result = self.dbapi.get_active_driver_dict()\n self.assertEqual(expected, result)",
"metadata": "root.DbConductorTestCase.test_get_active_driver_dict_one_host_many_drivers",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 133
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_active_driver_dict_many_hosts_one_driver(self, mock_utcnow):\n h1 = 'host-one'\n h2 = 'host-two'\n d = 'fake-driver'\n expected = {d: set([h1, h2])}\n\n mock_utcnow.return_value = datetime.datetime.utcnow()\n self._create_test_cdr(id=1, hostname=h1, drivers=[d])\n self._create_test_cdr(id=2, hostname=h2, drivers=[d])\n result = self.dbapi.get_active_driver_dict()\n self.assertEqual(expected, result)",
"metadata": "root.DbConductorTestCase.test_get_active_driver_dict_many_hosts_one_driver",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 145
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_active_driver_dict_many_hosts_and_drivers(self, mock_utcnow):\n h1 = 'host-one'\n h2 = 'host-two'\n h3 = 'host-three'\n d1 = 'driver-one'\n d2 = 'driver-two'\n expected = {d1: set([h1, h2]), d2: set([h2, h3])}\n\n mock_utcnow.return_value = datetime.datetime.utcnow()\n self._create_test_cdr(id=1, hostname=h1, drivers=[d1])\n self._create_test_cdr(id=2, hostname=h2, drivers=[d1, d2])\n self._create_test_cdr(id=3, hostname=h3, drivers=[d2])\n result = self.dbapi.get_active_driver_dict()\n self.assertEqual(expected, result)",
"metadata": "root.DbConductorTestCase.test_get_active_driver_dict_many_hosts_and_drivers",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 158
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_active_driver_dict_with_old_conductor(self, mock_utcnow):\n past = datetime.datetime(2000, 1, 1, 0, 0)\n present = past + datetime.timedelta(minutes=2)\n\n d = 'common-driver'\n\n h1 = 'old-host'\n d1 = 'old-driver'\n mock_utcnow.return_value = past\n self._create_test_cdr(id=1, hostname=h1, drivers=[d, d1])\n\n h2 = 'new-host'\n d2 = 'new-driver'\n mock_utcnow.return_value = present\n self._create_test_cdr(id=2, hostname=h2, drivers=[d, d2])\n\n # verify that old-host does not show up in current list\n one_minute = 60\n expected = {d: set([h2]), d2: set([h2])}\n result = self.dbapi.get_active_driver_dict(interval=one_minute)\n self.assertEqual(expected, result)\n\n # change the interval, and verify that old-host appears\n two_minute = one_minute * 2\n expected = {d: set([h1, h2]), d1: set([h1]), d2: set([h2])}\n result = self.dbapi.get_active_driver_dict(interval=two_minute)\n self.assertEqual(expected, result)",
"metadata": "root.DbConductorTestCase.test_get_active_driver_dict_with_old_conductor",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 174
},
{
"content": " @mock.patch.object(timeutils, 'utcnow', autospec=True)\n def test_get_offline_conductors(self, mock_utcnow):\n self.config(heartbeat_timeout=60, group='conductor')\n time_ = datetime.datetime(2000, 1, 1, 0, 0)\n\n mock_utcnow.return_value = time_\n c = self._create_test_cdr()\n\n # Only 30 seconds passed since last heartbeat, it's still\n # considered alive\n mock_utcnow.return_value = time_ + datetime.timedelta(seconds=30)\n self.assertEqual([], self.dbapi.get_offline_conductors())\n\n # 61 seconds passed since last heartbeat, it's dead\n mock_utcnow.return_value = time_ + datetime.timedelta(seconds=61)\n self.assertEqual([c.hostname], self.dbapi.get_offline_conductors())",
"metadata": "root.DbConductorTestCase.test_get_offline_conductors",
"header": "['class', 'DbConductorTestCase', '(', 'base', '.', 'DbTestCase', ')', ':', '___EOS___']",
"index": 203
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2013",
" ",
"He",
"wle",
"tt",
"-",
"Packa",
"rd",
" ",
"Dev",
"elo",
"pme",
"nt",
" ",
"Compa",
"ny",
",",
" ",
"L",
".",
"P",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"Test",
"s",
" ",
"for",
" ",
"manipulati",
"ng",
" ",
"Conduct",
"ors",
" ",
"via",
" ",
"the",
" ",
"DB",
" ",
"API",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"mock_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"oslo",
"\\u",
"utils_",
"import_",
"timeutils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"ironic_",
"._",
"common_",
"import_",
"exception_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ironic_",
"._",
"tests_",
"._",
"unit_",
"._",
"db_",
"import_",
"base_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"ironic_",
"._",
"tests_",
"._",
"unit_",
"._",
"db_",
"import_",
"utils_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"register",
"\\u",
"conductor",
"\\u",
"exist",
"ing",
"\\u",
"fails_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"utils_",
"._",
"get",
"\\u",
"test\\u",
"conductor",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"register",
"\\u",
"conductor",
"_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"exception_",
"._",
"Conduct",
"or",
"Al",
"read",
"y",
"Register",
"ed_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"register",
"\\u",
"conductor",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"register",
"\\u",
"conductor",
"\\u",
"override_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"utils_",
"._",
"get",
"\\u",
"test\\u",
"conductor",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"register",
"\\u",
"conductor",
"_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"register",
"\\u",
"conductor",
"_",
"(_",
"c_",
",_",
"update",
"\\u",
"existing_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"self_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"utils_",
"._",
"get",
"\\u",
"test\\u",
"conductor",
"_",
"(_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"dbapi_",
"._",
"register",
"\\u",
"conductor",
"_",
"(_",
"c_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"conductor",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c1_",
"=_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c2_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"conductor",
"_",
"(_",
"c1_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"c1_",
"._",
"id_",
",_",
"c2_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"conductor",
"\\u",
"not",
"\\u",
"found_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"exception_",
"._",
"Conduct",
"or",
"Not",
"Found_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"conductor",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bad",
"-",
"host",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"unregister",
"\\u",
"conductor",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"unregister",
"\\u",
"conductor",
"_",
"(_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"exception_",
"._",
"Conduct",
"or",
"Not",
"Found_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"unregister",
"\\u",
"conductor",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"touch",
"\\u",
"conductor",
"_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"test\\u",
"time_",
"=_",
"datetime_",
"._",
"datetime_",
"(_",
"2000_",
",_",
"1_",
",_",
"1_",
",_",
"0_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"test\\u",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"test\\u",
"time_",
",_",
"timeutils_",
"._",
"normali",
"ze",
"\\u",
"time_",
"(_",
"c_",
"._",
"update",
"d\\u",
"at_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"test\\u",
"time_",
"=_",
"datetime_",
"._",
"datetime_",
"(_",
"2000_",
",_",
"1_",
",_",
"1_",
",_",
"0_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"test\\u",
"time_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"touch",
"\\u",
"conductor",
"_",
"(_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"conductor",
"_",
"(_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"test\\u",
"time_",
",_",
"timeutils_",
"._",
"normali",
"ze",
"\\u",
"time_",
"(_",
"c_",
"._",
"update",
"d\\u",
"at_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"touch",
"\\u",
"conductor",
"\\u",
"not",
"\\u",
"found_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"A",
" ",
"conductor",
"'",
"s",
" ",
"heart",
"beat",
" ",
"will",
" ",
"not",
" ",
"create",
" ",
"a",
" ",
"new",
" ",
"record",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"it",
" ",
"will",
" ",
"only",
" ",
"update",
" ",
"exist",
"ing",
" ",
"ones_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"exception_",
"._",
"Conduct",
"or",
"Not",
"Found_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"touch",
"\\u",
"conductor",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"bad",
"-",
"host",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"touch",
"\\u",
"offline",
"\\u",
"conductor",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Ensur",
"e",
" ",
"tha",
"t",
" ",
"a",
" ",
"conductor",
"'",
"s",
" ",
"periodic",
" ",
"heart",
"beat",
" ",
"task",
" ",
"can",
" ",
"make",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"conductor",
" ",
"visi",
"ble",
" ",
"again",
",",
" ",
"even",
" ",
"if",
" ",
"it",
" ",
"was",
" ",
"spu",
"rio",
"usl",
"y",
" ",
"marked",
" ",
"offline_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"unregister",
"\\u",
"conductor",
"_",
"(_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"exception_",
"._",
"Conduct",
"or",
"Not",
"Found_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"conductor",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"touch",
"\\u",
"conductor",
"_",
"(_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"conductor",
"_",
"(_",
"c_",
"._",
"hostname_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"clear",
"\\u",
"node",
"\\u",
"reserva",
"tion",
"s",
"\\u",
"for",
"\\u",
"conductor",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"node1_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"create",
"\\u",
"node_",
"(_",
"{_",
"'",
"reserva",
"tion",
"'_",
":_",
"'",
"host",
"name",
"1",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node2_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"create",
"\\u",
"node_",
"(_",
"{_",
"'",
"reserva",
"tion",
"'_",
":_",
"'",
"host",
"name2",
"'_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node",
"3_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"create",
"\\u",
"node_",
"(_",
"{_",
"'",
"reserva",
"tion",
"'_",
":_",
"None_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dbapi_",
"._",
"clear",
"\\u",
"node",
"\\u",
"reserva",
"tion",
"s",
"\\u",
"for",
"\\u",
"conductor",
"_",
"(_",
"'",
"host",
"name",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node1_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"node",
"\\u",
"by",
"\\u",
"id_",
"(_",
"node1_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node2_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"node",
"\\u",
"by",
"\\u",
"id_",
"(_",
"node2_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"node",
"3_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"node",
"\\u",
"by",
"\\u",
"id_",
"(_",
"node",
"3_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"None_",
"(_",
"node1_",
"._",
"reservation_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"host",
"name2",
"'_",
",_",
"node2_",
"._",
"reservation_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Is",
"None_",
"(_",
"node",
"3_",
"._",
"reservation_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict",
"\\u",
"one",
"\\u",
"host",
"\\u",
"no",
"\\u",
"driver_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"h_",
"=_",
"'",
"fake",
"-",
"host",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"hostname_",
"=_",
"h_",
",_",
"drivers_",
"=_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict",
"\\u",
"one",
"\\u",
"host",
"\\u",
"one",
"\\u",
"driver_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"h_",
"=_",
"'",
"fake",
"-",
"host",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"'",
"fake",
"-",
"driver",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"d_",
":_",
"set_",
"(_",
"[_",
"h_",
"]_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"hostname_",
"=_",
"h_",
",_",
"drivers_",
"=_",
"[_",
"d_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict",
"\\u",
"one",
"\\u",
"host",
"\\u",
"many",
"\\u",
"drivers_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"h_",
"=_",
"'",
"fake",
"-",
"host",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d1_",
"=_",
"'",
"driver",
"-",
"one",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d2_",
"=_",
"'",
"driver",
"-",
"two",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"d1_",
":_",
"set_",
"(_",
"[_",
"h_",
"]_",
")_",
",_",
"d2_",
":_",
"set_",
"(_",
"[_",
"h_",
"]_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"hostname_",
"=_",
"h_",
",_",
"drivers_",
"=_",
"[_",
"d1_",
",_",
"d2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict",
"\\u",
"many",
"\\u",
"host",
"s",
"\\u",
"one",
"\\u",
"driver_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"h1_",
"=_",
"'",
"host",
"-",
"one",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"h2_",
"=_",
"'",
"host",
"-",
"two",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d_",
"=_",
"'",
"fake",
"-",
"driver",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"d_",
":_",
"set_",
"(_",
"[_",
"h1_",
",_",
"h2_",
"]_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"1_",
",_",
"hostname_",
"=_",
"h1_",
",_",
"drivers_",
"=_",
"[_",
"d_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"2_",
",_",
"hostname_",
"=_",
"h2_",
",_",
"drivers_",
"=_",
"[_",
"d_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict",
"\\u",
"many",
"\\u",
"host",
"s",
"\\u",
"and",
"\\u",
"drivers_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"h1_",
"=_",
"'",
"host",
"-",
"one",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"h2_",
"=_",
"'",
"host",
"-",
"two",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"h3_",
"=_",
"'",
"host",
"-",
"three",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d1_",
"=_",
"'",
"driver",
"-",
"one",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d2_",
"=_",
"'",
"driver",
"-",
"two",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"d1_",
":_",
"set_",
"(_",
"[_",
"h1_",
",_",
"h2_",
"]_",
")_",
",_",
"d2_",
":_",
"set_",
"(_",
"[_",
"h2_",
",_",
"h3_",
"]_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"datetime_",
"._",
"datetime_",
"._",
"utcnow_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"1_",
",_",
"hostname_",
"=_",
"h1_",
",_",
"drivers_",
"=_",
"[_",
"d1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"2_",
",_",
"hostname_",
"=_",
"h2_",
",_",
"drivers_",
"=_",
"[_",
"d1_",
",_",
"d2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"3_",
",_",
"hostname_",
"=_",
"h3_",
",_",
"drivers_",
"=_",
"[_",
"d2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict",
"\\u",
"with",
"\\u",
"old",
"\\u",
"conductor",
"_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"past_",
"=_",
"datetime_",
"._",
"datetime_",
"(_",
"2000_",
",_",
"1_",
",_",
"1_",
",_",
"0_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"present_",
"=_",
"past_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"minutes_",
"=_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"d_",
"=_",
"'",
"common",
"-",
"driver",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"h1_",
"=_",
"'",
"old",
"-",
"host",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d1_",
"=_",
"'",
"old",
"-",
"driver",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"past_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"1_",
",_",
"hostname_",
"=_",
"h1_",
",_",
"drivers_",
"=_",
"[_",
"d_",
",_",
"d1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"h2_",
"=_",
"'",
"new",
"-",
"host",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"d2_",
"=_",
"'",
"new",
"-",
"driver",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"present_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
"id_",
"=_",
"2_",
",_",
"hostname_",
"=_",
"h2_",
",_",
"drivers_",
"=_",
"[_",
"d_",
",_",
"d2_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"verify",
" ",
"tha",
"t",
" ",
"old",
"-",
"host",
" ",
"doe",
"s",
" ",
"not",
" ",
"show",
" ",
"up",
" ",
"in",
" ",
"current",
" ",
"list_",
"\\u\\u\\uNL\\u\\u\\u_",
"one",
"\\u",
"minute_",
"=_",
"60_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"d_",
":_",
"set_",
"(_",
"[_",
"h2_",
"]_",
")_",
",_",
"d2_",
":_",
"set_",
"(_",
"[_",
"h2_",
"]_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
"interval_",
"=_",
"one",
"\\u",
"minute_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"change",
" ",
"the",
" ",
"interval",
",",
" ",
"and",
" ",
"verify",
" ",
"tha",
"t",
" ",
"old",
"-",
"host",
" ",
"appear",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"two",
"\\u",
"minute_",
"=_",
"one",
"\\u",
"minute_",
"*_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"{_",
"d_",
":_",
"set_",
"(_",
"[_",
"h1_",
",_",
"h2_",
"]_",
")_",
",_",
"d1_",
":_",
"set_",
"(_",
"[_",
"h1_",
"]_",
")_",
",_",
"d2_",
":_",
"set_",
"(_",
"[_",
"h2_",
"]_",
")_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"active",
"\\u",
"driver",
"\\u",
"dict_",
"(_",
"interval_",
"=_",
"two",
"\\u",
"minute_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"result_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Db",
"Conduct",
"or",
"Test",
"Case_",
"(_",
"base_",
"._",
"Db",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"timeutils_",
",_",
"'",
"utc",
"now",
"'_",
",_",
"autospec_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"get",
"\\u",
"offline",
"\\u",
"conductor",
"s_",
"(_",
"self_",
",_",
"mock",
"\\u",
"utcnow_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"config_",
"(_",
"heart",
"beat",
"\\u",
"timeout_",
"=_",
"60_",
",_",
"group_",
"=_",
"'",
"conductor",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"time",
"\\u_",
"=_",
"datetime_",
"._",
"datetime_",
"(_",
"2000_",
",_",
"1_",
",_",
"1_",
",_",
"0_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"time",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"=_",
"self_",
"._",
"\\u",
"create",
"\\u",
"test\\u",
"cdr",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"On",
"ly",
" ",
"30",
" ",
"second",
"s",
" ",
"pass",
"ed",
" ",
"sinc",
"e",
" ",
"last",
" ",
"heart",
"beat",
",",
" ",
"it",
"'",
"s",
" ",
"still",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"consider",
"ed",
" ",
"alive_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"time",
"\\u_",
"+_",
"datetime_",
"._",
"timedelta_",
"(_",
"seconds_",
"=_",
"30_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"[_",
"]_",
",_",
"self_",
"._",
"dbapi_",
"._",
"get",
"\\u",
"offline",
"\\u",
"conductor",
"s_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"6",
"1",
" ",
"second",
"s",
" ",
"pass",
"ed",
" ",
"sinc",
"e",
" ",
"last",
" ",
"heart",
"beat",
",",
" ",
"it",
"'",
"s",
" ",
"dead_",
"\\u\\u\\uNL\\u\\u\\u_",
"mock",
"\\u",
"utcnow_",
"._",
"return",
"\\u",
"value_",
"=_",
"time",
"\\u_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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unreachable code | YelpArchive/python-gearman/tests/worker_tests.py | [
{
"content": " def test_registering_functions(self):\n # Tests that the abilities were set on the GearmanWorker AND the GearmanWorkerCommandHandler\n # Does NOT test that commands were actually sent out as that is tested in GearmanWorkerCommandHandlerInterfaceTest.test_set_abilities\n def fake_callback_one(worker_command_handler, current_job):\n pass\n\n def fake_callback_two(worker_command_handler, current_job):\n pass\n\n # Register a single callback\n self.connection_manager.register_task('fake_callback_one', fake_callback_one)\n self.failUnless('fake_callback_one' in self.connection_manager.worker_abilities)\n self.failIf('fake_callback_two' in self.connection_manager.worker_abilities)\n self.assertEqual(self.connection_manager.worker_abilities['fake_callback_one'], fake_callback_one)\n self.assertEqual(self.command_handler._handler_abilities, ['fake_callback_one'])\n\n # Register another callback and make sure the command_handler sees the same functions\n self.connection_manager.register_task('fake_callback_two', fake_callback_two)\n self.failUnless('fake_callback_one' in self.connection_manager.worker_abilities)\n self.failUnless('fake_callback_two' in self.connection_manager.worker_abilities)\n self.assertEqual(self.connection_manager.worker_abilities['fake_callback_one'], fake_callback_one)\n self.assertEqual(self.connection_manager.worker_abilities['fake_callback_two'], fake_callback_two)\n self.assertEqual(self.command_handler._handler_abilities, ['fake_callback_one', 'fake_callback_two'])\n\n # Unregister a callback and make sure the command_handler sees the same functions\n self.connection_manager.unregister_task('fake_callback_one')\n self.failIf('fake_callback_one' in self.connection_manager.worker_abilities)\n self.failUnless('fake_callback_two' in self.connection_manager.worker_abilities)\n self.assertEqual(self.connection_manager.worker_abilities['fake_callback_two'], fake_callback_two)\n self.assertEqual(self.command_handler._handler_abilities, ['fake_callback_two'])",
"metadata": "root.WorkerTest.test_registering_functions",
"header": "['class', 'WorkerTest', '(', '_GearmanAbstractWorkerTest', ')', ':', '___EOS___']",
"index": 49
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Worke",
"r",
"Test_",
"(_",
"\\u",
"Gea",
"rman",
"Abstract",
"Worke",
"r",
"Test_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"test\\u",
"register",
"ing",
"\\u",
"functions_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Test",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"abilit",
"ies",
" ",
"wer",
"e",
" ",
"set",
" ",
"on",
" ",
"the",
" ",
"Gea",
"rman",
"Worke",
"r",
" ",
"AND",
" ",
"the",
" ",
"Gea",
"rman",
"Worke",
"r",
"Command",
"Handler_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Do",
"es",
" ",
"NOT",
" ",
"test",
" ",
"tha",
"t",
" ",
"command",
"s",
" ",
"wer",
"e",
" ",
"actual",
"ly",
" ",
"sent",
" ",
"out",
" ",
"as",
" ",
"tha",
"t",
" ",
"is",
" ",
"tested",
" ",
"in",
" ",
"Gea",
"rman",
"Worke",
"r",
"Command",
"Handle",
"r",
"Interface",
"Test",
".",
"test\\u",
"set\\u",
"abilities_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"fake",
"\\u",
"callback",
"\\u",
"one_",
"(_",
"worker",
"\\u",
"command",
"\\u",
"handler_",
",_",
"current",
"\\u",
"job_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"fake",
"\\u",
"callback",
"\\u",
"two_",
"(_",
"worker",
"\\u",
"command",
"\\u",
"handler_",
",_",
"current",
"\\u",
"job_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Register",
" ",
"a",
" ",
"single",
" ",
"callback_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"register",
"\\u",
"task_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
",_",
"fake",
"\\u",
"callback",
"\\u",
"one_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"Unless_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
"in_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"If_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"in_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
"]_",
",_",
"fake",
"\\u",
"callback",
"\\u",
"one_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"command",
"\\u",
"handler_",
"._",
"\\u",
"handler",
"\\u",
"abilities_",
",_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Register",
" ",
"anot",
"her",
" ",
"callback",
" ",
"and",
" ",
"make",
" ",
"sure",
" ",
"the",
" ",
"command",
"\\u",
"handler",
" ",
"see",
"s",
" ",
"the",
" ",
"same",
" ",
"functions_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"register",
"\\u",
"task_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
",_",
"fake",
"\\u",
"callback",
"\\u",
"two_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"Unless_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
"in_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"Unless_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"in_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
"]_",
",_",
"fake",
"\\u",
"callback",
"\\u",
"one_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"]_",
",_",
"fake",
"\\u",
"callback",
"\\u",
"two_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"command",
"\\u",
"handler_",
"._",
"\\u",
"handler",
"\\u",
"abilities_",
",_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
",_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Unregister",
" ",
"a",
" ",
"callback",
" ",
"and",
" ",
"make",
" ",
"sure",
" ",
"the",
" ",
"command",
"\\u",
"handler",
" ",
"see",
"s",
" ",
"the",
" ",
"same",
" ",
"functions_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"unregister",
"\\u",
"task_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"If_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"one",
"'_",
"in_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"Unless_",
"(_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"in_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"connecti",
"on",
"\\u",
"manager_",
"._",
"worker",
"\\u",
"abilities_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"]_",
",_",
"fake",
"\\u",
"callback",
"\\u",
"two_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"self_",
"._",
"command",
"\\u",
"handler_",
"._",
"\\u",
"handler",
"\\u",
"abilities_",
",_",
"[_",
"'",
"fake",
"\\u",
"callback",
"\\u",
"two",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | QuantEcon/QuantEcon.py/setup.py | [
{
"content": "from distutils.core import setup\nimport os\n\n#-Write Versions File-#\n#~~~~~~~~~~~~~~~~~~~~~#\n\nVERSION = '0.3.2'\n\n\nwrite_version_py() # This is a file used to control the qe.__version__ attribute\n\n#-Meta Information-#\n#~~~~~~~~~~~~~~~~~~#\n\nDESCRIPTION = \"QuantEcon is a package to support all forms of quantitative economic modelling.\" #'Core package of the QuantEcon library'\n\nLONG_DESCRIPTION = \"\"\"\n**QuantEcon** is an organization run by economists for economists with the aim of coordinating\ndistributed development of high quality open source code for all forms of quantitative economic modelling.\n\nThe project website is located at `http://quantecon.org/ <http://quantecon.org/>`_. This website provides\nmore information with regards to the **quantecon** library, documentation, in addition to some resources\nin regards to how you can use and/or contribute to the package.\n\nThe **quantecon** Package\n-------------------------\n\nThe `repository <https://github.com/QuantEcon/QuantEcon.py>`_ includes the Python package ``quantecon``\n\nAssuming you have `pip <https://pypi.python.org/pypi/pip>`_ on your computer --- as will be the case if you've `installed Anaconda <http://quant-econ.net/getting_started.html#installing-anaconda>`_ --- you can install the latest stable release of ``quantecon`` by typing\n\n pip install quantecon\n\nat a terminal prompt\n\nRepository\n----------\n\nThe main repository is hosted on Github `QuantEcon.py <https://github.com/QuantEcon/QuantEcon.py>`_\n\n**Note:** There is also a Julia version available for Julia users `QuantEcon.jl <https://github.com/QuantEcon/QuantEcon.jl>`_\n\nCurrent Build and Coverage Status\n---------------------------------\n\n|Build Status| |Coverage Status|\n\n.. |Build Status| image:: https://travis-ci.org/QuantEcon/QuantEcon.py.svg?branch=master\n :target: https://travis-ci.org/QuantEcon/QuantEcon.py\n.. |Coverage Status| image:: https://coveralls.io/repos/QuantEcon/QuantEcon.py/badge.png\n :target: https://coveralls.io/r/QuantEcon/QuantEcon.py\n\nAdditional Links\n----------------\n\n1. `QuantEcon Course Website <http://quant-econ.net>`_\n\n\"\"\"\n\nLICENSE = \"BSD\"\n\n#-Classifier Strings-#\n#-https://pypi.python.org/pypi?%3Aaction=list_classifiers-#\nCLASSIFIERS = [\n 'Development Status :: 4 - Beta',\n 'Operating System :: OS Independent',\n 'Intended Audience :: Science/Research',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3.5',\n 'Topic :: Scientific/Engineering',\n]\n\n#-Setup-#\n#~~~~~~~#\n\nsetup(name='quantecon',\n packages=['quantecon',\n 'quantecon.game_theory',\n 'quantecon.markov',\n 'quantecon.random',\n 'quantecon.tests',\n 'quantecon.util',\n #-Deprecated-#\n 'quantecon.models',\n ],\n version=VERSION,\n description=DESCRIPTION,\n long_description=LONG_DESCRIPTION,\n license=LICENSE,\n classifiers=CLASSIFIERS,\n author='Thomas J. Sargent and John Stachurski (Project coordinators)',\n author_email='[email protected]',\n url='https://github.com/QuantEcon/QuantEcon.py', # URL to the repo\n keywords=['quantitative', 'economics']\n )\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def write_version_py(filename=None):\n \"\"\"\n This constructs a version file for the project\n \"\"\"\n doc = \"\\\"\\\"\\\"\\nThis is a VERSION file and should NOT be manually altered\\n\\\"\\\"\\\"\"\n doc += \"\\nversion = '%s'\" % VERSION\n\n if not filename:\n filename = os.path.join(os.path.dirname(__file__), 'quantecon', 'version.py')\n\n fl = open(filename, 'w')\n try:\n fl.write(doc)\n finally:\n fl.close()",
"metadata": "root.write_version_py",
"header": "['module', '___EOS___']",
"index": 8
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"distutils_",
"._",
"core_",
"import_",
"setup_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"os_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"Write",
" ",
"Version",
"s",
" ",
"File",
"-",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"~~~~~~~~~~~",
"~~~~~",
"~~~~~",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"VERSION_",
"=_",
"'",
"0.",
"3.2",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"write",
"\\u",
"version",
"\\u",
"py_",
"(_",
")_",
"#",
" ",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"file",
" ",
"used",
" ",
"to",
" ",
"control",
" ",
"the",
" ",
"qe",
".\\u",
"\\u",
"version",
"\\u\\u",
" ",
"attribute_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"Meta",
" ",
"Information",
"-",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"~~~~~~~~~~~",
"~~~~~",
"~~",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"DESCRIPTION_",
"=_",
"\"",
"Quant",
"Econ",
" ",
"is",
" ",
"a",
" ",
"package",
" ",
"to",
" ",
"support",
" ",
"all",
" ",
"forms",
" ",
"of",
" ",
"quanti",
"tative",
" ",
"econom",
"ic",
" ",
"modell",
"ing",
".\"_",
"#'",
"Core",
" ",
"package",
" ",
"of",
" ",
"the",
" ",
"Quant",
"Econ",
" ",
"librar",
"y",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"LONG",
"\\u",
"DESCRIPTION_",
"=_",
"\"\"\"",
"\\",
"10",
";",
"**",
"Quant",
"Econ",
"**",
" ",
"is",
" ",
"an",
" ",
"organization",
" ",
"run",
" ",
"by",
" ",
"econom",
"ists",
" ",
"for",
" ",
"econom",
"ists",
" ",
"with",
" ",
"the",
" ",
"aim",
" ",
"of",
" ",
"coordin",
"ati",
"ng",
"\\",
"10",
";",
"distributed",
" ",
"develop",
"ment",
" ",
"of",
" ",
"high",
" ",
"quali",
"ty",
" ",
"open",
" ",
"source",
" ",
"code",
" ",
"for",
" ",
"all",
" ",
"forms",
" ",
"of",
" ",
"quanti",
"tative",
" ",
"econom",
"ic",
" ",
"modell",
"ing",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"project",
" ",
"webs",
"ite",
" ",
"is",
" ",
"located",
" ",
"at",
" ",
"`",
"http",
"://",
"quant",
"eco",
"n",
".",
"org",
"/",
" ",
"<",
"http",
"://",
"quant",
"eco",
"n",
".",
"org",
"/>",
"`\\u",
".",
" ",
"Thi",
"s",
" ",
"webs",
"ite",
" ",
"provide",
"s",
"\\",
"10",
";",
"more",
" ",
"informati",
"on",
" ",
"with",
" ",
"rega",
"rds",
" ",
"to",
" ",
"the",
" ",
"**",
"quant",
"eco",
"n",
"**",
" ",
"librar",
"y",
",",
" ",
"documentation",
",",
" ",
"in",
" ",
"addition",
" ",
"to",
" ",
"some",
" ",
"resource",
"s",
"\\",
"10",
";",
"in",
" ",
"rega",
"rds",
" ",
"to",
" ",
"how",
" ",
"you",
" ",
"can",
" ",
"use",
" ",
"and",
"/",
"or",
" ",
"contribute",
" ",
"to",
" ",
"the",
" ",
"package",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"**",
"quant",
"eco",
"n",
"**",
" ",
"Packa",
"ge",
"\\",
"10",
";",
"--------------",
"-----------",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"`",
"repos",
"itor",
"y",
" ",
"<",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
">`\\u",
" ",
"include",
"s",
" ",
"the",
" ",
"Pyth",
"on",
" ",
"package",
" ",
"``",
"quant",
"eco",
"n",
"``",
"\\",
"10",
";",
"\\",
"10",
";",
"Assu",
"ming",
" ",
"you",
" ",
"have",
" ",
"`",
"pip",
" ",
"<",
"https",
"://",
"pypi",
".",
"python",
".",
"org",
"/",
"pypi",
"/",
"pip",
">`\\u",
" ",
"on",
" ",
"your",
" ",
"computer",
" ",
"---",
" ",
"as",
" ",
"will",
" ",
"be",
" ",
"the",
" ",
"case",
" ",
"if",
" ",
"you",
"'",
"ve",
" ",
"`",
"install",
"ed",
" ",
"Ana",
"cond",
"a",
" ",
"<",
"http",
"://",
"quant",
"-",
"eco",
"n",
".",
"net",
"/",
"getti",
"ng",
"\\u",
"start",
"ed",
".",
"html",
"#",
"install",
"ing",
"-",
"anaconda",
">`\\u",
" ",
"---",
" ",
"you",
" ",
"can",
" ",
"install",
" ",
"the",
" ",
"late",
"st",
" ",
"stable",
" ",
"release",
" ",
"of",
" ",
"``",
"quant",
"eco",
"n",
"``",
" ",
"by",
" ",
"typ",
"ing",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pip",
" ",
"install",
" ",
"quant",
"eco",
"n",
"\\",
"10",
";",
"\\",
"10",
";",
"at",
" ",
"a",
" ",
"termina",
"l",
" ",
"prompt",
"\\",
"10",
";",
"\\",
"10",
";",
"Repos",
"itor",
"y",
"\\",
"10",
";",
"----------",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
" ",
"main",
" ",
"repos",
"itor",
"y",
" ",
"is",
" ",
"hoste",
"d",
" ",
"on",
" ",
"Git",
"hub",
" ",
"`",
"Quant",
"Econ",
".",
"py",
" ",
"<",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
">`\\u",
"\\",
"10",
";",
"\\",
"10",
";",
"**",
"Not",
"e",
":*",
"*",
" ",
"There",
" ",
"is",
" ",
"als",
"o",
" ",
"a",
" ",
"Juli",
"a",
" ",
"version",
" ",
"avail",
"able",
" ",
"for",
" ",
"Juli",
"a",
" ",
"users",
" ",
"`",
"Quant",
"Econ",
".",
"jl",
" ",
"<",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"jl",
">`\\u",
"\\",
"10",
";",
"\\",
"10",
";",
"Curr",
"ent",
" ",
"Build",
" ",
"and",
" ",
"Coverage",
" ",
"Status",
"\\",
"10",
";",
"--------------",
"--------------",
"-----",
"\\",
"10",
";",
"\\",
"10",
";",
"|",
"Build",
" ",
"Status",
"|",
" ",
"|",
"Coverage",
" ",
"Status",
"|",
"\\",
"10",
";",
"\\",
"10",
";",
"..",
" ",
"|",
"Build",
" ",
"Status",
"|",
" ",
"image",
"::",
" ",
"https",
"://",
"travis",
"-",
"ci",
".",
"org",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
".",
"svg",
"?",
"branch",
"=",
"master",
"\\",
"10",
";",
" ",
" ",
" ",
":",
"target",
":",
" ",
"https",
"://",
"travis",
"-",
"ci",
".",
"org",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
"\\",
"10",
";",
"..",
" ",
"|",
"Coverage",
" ",
"Status",
"|",
" ",
"image",
"::",
" ",
"https",
"://",
"covera",
"lls",
".",
"io",
"/",
"repos",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
"/",
"badge",
".",
"png",
"\\",
"10",
";",
" ",
" ",
" ",
":",
"target",
":",
" ",
"https",
"://",
"covera",
"lls",
".",
"io",
"/",
"r",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
"\\",
"10",
";",
"\\",
"10",
";",
"Addition",
"al",
" ",
"Link",
"s",
"\\",
"10",
";",
"--------------",
"--",
"\\",
"10",
";",
"\\",
"10",
";",
"1",
".",
" ",
"`",
"Quant",
"Econ",
" ",
"Cour",
"se",
" ",
"Webs",
"ite",
" ",
"<",
"http",
"://",
"quant",
"-",
"eco",
"n",
".",
"net",
">`\\u",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"LICENSE",
"_",
"=_",
"\"",
"BS",
"D",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"Classif",
"ier",
" ",
"String",
"s",
"-",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"https",
"://",
"pypi",
".",
"python",
".",
"org",
"/",
"pypi",
"?",
"%",
"3",
"Aa",
"ction",
"=",
"list",
"\\u",
"classif",
"iers",
"-",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"CLASSIF",
"IER",
"S_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Dev",
"elo",
"pme",
"nt",
" ",
"Status",
" ",
"::",
" ",
"4",
" ",
"-",
" ",
"Beta",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Opera",
"ting",
" ",
"System",
" ",
"::",
" ",
"OS",
" ",
"Inde",
"pend",
"ent",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Inten",
"ded",
" ",
"Audi",
"ence",
" ",
"::",
" ",
"Sci",
"ence",
"/",
"Rese",
"arch",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"3",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"2.7",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Programm",
"ing",
" ",
"Lang",
"ua",
"ge",
" ",
"::",
" ",
"Pyth",
"on",
" ",
"::",
" ",
"3.5",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"Topic",
" ",
"::",
" ",
"Sci",
"enti",
"fic",
"/",
"Engine",
"erin",
"g",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"Set",
"up",
"-",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"~~~~~",
"~~",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"setup_",
"(_",
"name_",
"=_",
"'",
"quant",
"eco",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"packages_",
"=_",
"[_",
"'",
"quant",
"eco",
"n",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quant",
"eco",
"n",
".",
"game",
"\\u",
"theory",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quant",
"eco",
"n",
".",
"markov",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quant",
"eco",
"n",
".",
"random",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quant",
"eco",
"n",
".",
"tests",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quant",
"eco",
"n",
".",
"util",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"Dep",
"reca",
"ted",
"-",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"quant",
"eco",
"n",
".",
"model",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"version_",
"=_",
"VERSION_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"description_",
"=_",
"DESCRIPTION_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"long",
"\\u",
"description_",
"=_",
"LONG",
"\\u",
"DESCRIPTION_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"license_",
"=_",
"LICENSE",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"classifiers_",
"=_",
"CLASSIF",
"IER",
"S_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author_",
"=_",
"'",
"Tho",
"mas",
" ",
"J",
".",
" ",
"Sar",
"gent",
" ",
"and",
" ",
"Joh",
"n",
" ",
"Sta",
"chur",
"ski",
" ",
"(",
"Project",
" ",
"coordinator",
"s",
")'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"author",
"\\u",
"email_",
"=_",
"'",
"john",
".",
"sta",
"chur",
"ski",
"@",
"gma",
"il",
".",
"com",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"=_",
"'",
"https",
"://",
"git",
"hub",
".",
"com",
"/",
"Quant",
"Econ",
"/",
"Quant",
"Econ",
".",
"py",
"'_",
",_",
"#",
" ",
"URL",
" ",
"to",
" ",
"the",
" ",
"repo_",
"\\u\\u\\uNL\\u\\u\\u_",
"keywords_",
"=_",
"[_",
"'",
"quanti",
"tative",
"'_",
",_",
"'",
"econom",
"ics",
"'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"write",
"\\u",
"version",
"\\u",
"py_",
"(_",
"filename_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"construct",
"s",
" ",
"a",
" ",
"version",
" ",
"file",
" ",
"for",
" ",
"the",
" ",
"project",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc_",
"=_",
"\"\\\\\"",
"\\\\\"\\\\\"",
"\\\\",
"n",
"Thi",
"s",
" ",
"is",
" ",
"a",
" ",
"VERSI",
"ON",
" ",
"file",
" ",
"and",
" ",
"shou",
"ld",
" ",
"NOT",
" ",
"be",
" ",
"manu",
"ally",
" ",
"alter",
"ed",
"\\\\",
"n",
"\\\\\"\\\\\"",
"\\\\\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc_",
"+=_",
"\"\\\\",
"nve",
"rsi",
"on",
" ",
"=",
" ",
"'%",
"s",
"'\"_",
"%_",
"VERSION_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"filename_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"filename_",
"=_",
"os_",
"._",
"path_",
"._",
"join_",
"(_",
"os_",
"._",
"path_",
"._",
"dirname_",
"(_",
"\\u\\u",
"file\\u\\u_",
")_",
",_",
"'",
"quant",
"eco",
"n",
"'_",
",_",
"'",
"version",
".",
"py",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fl_",
"=_",
"open_",
"(_",
"filename_",
",_",
"'",
"w",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fl_",
"._",
"write_",
"(_",
"doc_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"finally_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fl_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | django-oscar/django-oscar/tests/unit/payment/model_tests.py | [
{
"content": "import datetime\nfrom decimal import Decimal as D\n\nfrom django.test import TestCase\n\nfrom oscar.core.compat import get_user_model\nfrom oscar.apps.payment.models import Bankcard, Source\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestBankcard(TestCase):\n\n\n\n\n",
"metadata": "root.TestBankcard",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": " def test_obfuscates_number_before_saving(self):\n bankcard = Bankcard(number=\"1000011100000004\")\n bankcard.prepare_for_save()\n self.assertEqual(\"XXXX-XXXX-XXXX-0004\", bankcard.number)",
"metadata": "root.TestBankcard.test_obfuscates_number_before_saving",
"header": "['class', 'TestBankcard', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 11
},
{
"content": " def test_determines_bankcard_type(self):\n bankcard = Bankcard(number=\"5500000000000004\")\n self.assertEqual(\"Mastercard\", bankcard.card_type)",
"metadata": "root.TestBankcard.test_determines_bankcard_type",
"header": "['class', 'TestBankcard', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 16
},
{
"content": " def test_provides_start_month_property(self):\n start = datetime.date(day=1, month=1, year=2010)\n bankcard = Bankcard(start_date=start)\n self.assertEqual(\"01/10\", bankcard.start_month())",
"metadata": "root.TestBankcard.test_provides_start_month_property",
"header": "['class', 'TestBankcard', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 20
},
{
"content": " def test_provides_end_month_property(self):\n end = datetime.date(day=1, month=1, year=2010)\n bankcard = Bankcard(expiry_date=end)\n self.assertEqual(\"01/10\", bankcard.expiry_month())",
"metadata": "root.TestBankcard.test_provides_end_month_property",
"header": "['class', 'TestBankcard', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def test_bankcard_card_correct_save(self):\n # issue #1486\n user_klass = get_user_model()\n user = user_klass.objects.create_user('_', '[email protected]', 'pwd')\n end = datetime.date(day=1, month=1, year=2010)\n bankcard = Bankcard.objects.create(\n user=user, number=\"5500000000000004\", expiry_date=end)\n saved_bankcard = Bankcard.objects.get(id=bankcard.id)\n self.assertEqual('Mastercard', saved_bankcard.card_type)",
"metadata": "root.TestBankcard.test_bankcard_card_correct_save",
"header": "['class', 'TestBankcard', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 30
},
{
"content": "class TestSource(TestCase):\n\n\n",
"metadata": "root.TestSource",
"header": "['module', '___EOS___']",
"index": 41
},
{
"content": " def test_calculates_initial_balance_correctly(self):\n source = Source(amount_allocated=D('100'))\n self.assertEqual(D('100'), source.balance)",
"metadata": "root.TestSource.test_calculates_initial_balance_correctly",
"header": "['class', 'TestSource', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 43
},
{
"content": " def test_calculates_balance_correctly(self):\n source = Source(\n amount_allocated=D('100'),\n amount_debited=D('80'),\n amount_refunded=D('20'))\n self.assertEqual(\n D('100') - D('80') + D('20'), source.balance)",
"metadata": "root.TestSource.test_calculates_balance_correctly",
"header": "['class', 'TestSource', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 47
},
{
"content": " def test_calculates_amount_for_refund_correctly(self):\n source = Source(\n amount_allocated=D('100'),\n amount_debited=D('80'),\n amount_refunded=D('20'))\n self.assertEqual(\n D('80') - D('20'), source.amount_available_for_refund)",
"metadata": "root.TestSource.test_calculates_amount_for_refund_correctly",
"header": "['class', 'TestSource', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 55
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"decimal_",
"import_",
"Decimal_",
"as_",
"D_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"test_",
"import_",
"Test",
"Case_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"osc",
"ar_",
"._",
"core_",
"._",
"compat_",
"import_",
"get",
"\\u",
"user",
"\\u",
"model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"osc",
"ar_",
"._",
"apps_",
"._",
"payment_",
"._",
"models_",
"import_",
"Bank",
"card_",
",_",
"Source_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"Bank",
"card_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Bank",
"card_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"obf",
"usc",
"ates",
"\\u",
"number",
"\\u",
"bef",
"ore",
"\\u",
"saving",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bank",
"card_",
"=_",
"Bank",
"card_",
"(_",
"number_",
"=_",
"\"",
"10000",
"1110",
"0000004",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bank",
"card_",
"._",
"prepar",
"e\\u",
"for",
"\\u",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"XXXX",
"-",
"XXXX",
"-",
"XXXX",
"-0",
"004",
"\"_",
",_",
"bank",
"card_",
"._",
"number_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Bank",
"card_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"dete",
"rmin",
"es",
"\\u",
"bank",
"card",
"\\u",
"type_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bank",
"card_",
"=_",
"Bank",
"card_",
"(_",
"number_",
"=_",
"\"",
"5500",
"00000000000",
"4",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"Master",
"card",
"\"_",
",_",
"bank",
"card_",
"._",
"card",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Bank",
"card_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"provide",
"s",
"\\u",
"start",
"\\u",
"month",
"\\u",
"property_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"start_",
"=_",
"datetime_",
"._",
"date_",
"(_",
"day_",
"=_",
"1_",
",_",
"month_",
"=_",
"1_",
",_",
"year_",
"=_",
"2010_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bank",
"card_",
"=_",
"Bank",
"card_",
"(_",
"start",
"\\u",
"date_",
"=_",
"start_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"01",
"/",
"10",
"\"_",
",_",
"bank",
"card_",
"._",
"start",
"\\u",
"month_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Bank",
"card_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"provide",
"s",
"\\u",
"end",
"\\u",
"month",
"\\u",
"property_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"end_",
"=_",
"datetime_",
"._",
"date_",
"(_",
"day_",
"=_",
"1_",
",_",
"month_",
"=_",
"1_",
",_",
"year_",
"=_",
"2010_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bank",
"card_",
"=_",
"Bank",
"card_",
"(_",
"expir",
"y",
"\\u",
"date_",
"=_",
"end_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\"",
"01",
"/",
"10",
"\"_",
",_",
"bank",
"card_",
"._",
"expir",
"y",
"\\u",
"month_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Bank",
"card_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"bank",
"card",
"\\u",
"card",
"\\u",
"correct",
"\\u",
"save_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"issue",
" ",
"#",
"148",
"6_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"user",
"\\u",
"klass_",
"=_",
"get",
"\\u",
"user",
"\\u",
"model_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"user_",
"=_",
"user",
"\\u",
"klass_",
"._",
"objects_",
"._",
"create",
"\\u",
"user_",
"(_",
"'\\u'_",
",_",
"'",
"a",
"@",
"a",
".",
"com",
"'_",
",_",
"'",
"pwd",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"end_",
"=_",
"datetime_",
"._",
"date_",
"(_",
"day_",
"=_",
"1_",
",_",
"month_",
"=_",
"1_",
",_",
"year_",
"=_",
"2010_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bank",
"card_",
"=_",
"Bank",
"card_",
"._",
"objects_",
"._",
"create_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"user_",
"=_",
"user_",
",_",
"number_",
"=_",
"\"",
"5500",
"00000000000",
"4",
"\"_",
",_",
"expir",
"y",
"\\u",
"date_",
"=_",
"end_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"saved",
"\\u",
"bank",
"card_",
"=_",
"Bank",
"card_",
"._",
"objects_",
"._",
"get_",
"(_",
"id_",
"=_",
"bank",
"card_",
"._",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"'",
"Master",
"card",
"'_",
",_",
"saved",
"\\u",
"bank",
"card_",
"._",
"card",
"\\u",
"type_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Test",
"Source_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Source_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"calcul",
"ates",
"\\u",
"initial",
"\\u",
"balance",
"\\u",
"correct",
"ly_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"source_",
"=_",
"Source_",
"(_",
"amo",
"unt",
"\\u",
"allocated",
"_",
"=_",
"D_",
"(_",
"'",
"100",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"D_",
"(_",
"'",
"100",
"'_",
")_",
",_",
"source_",
"._",
"balance_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Source_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"calcul",
"ates",
"\\u",
"balance",
"\\u",
"correct",
"ly_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"source_",
"=_",
"Source_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"unt",
"\\u",
"allocated",
"_",
"=_",
"D_",
"(_",
"'",
"100",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"unt",
"\\u",
"debit",
"ed_",
"=_",
"D_",
"(_",
"'",
"80",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"unt",
"\\u",
"refund",
"ed_",
"=_",
"D_",
"(_",
"'",
"20",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"D_",
"(_",
"'",
"100",
"'_",
")_",
"-_",
"D_",
"(_",
"'",
"80",
"'_",
")_",
"+_",
"D_",
"(_",
"'",
"20",
"'_",
")_",
",_",
"source_",
"._",
"balance_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Source_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"calcul",
"ates",
"\\u",
"amo",
"unt",
"\\u",
"for",
"\\u",
"refund",
"\\u",
"correct",
"ly_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"source_",
"=_",
"Source_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"unt",
"\\u",
"allocated",
"_",
"=_",
"D_",
"(_",
"'",
"100",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"unt",
"\\u",
"debit",
"ed_",
"=_",
"D_",
"(_",
"'",
"80",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"amo",
"unt",
"\\u",
"refund",
"ed_",
"=_",
"D_",
"(_",
"'",
"20",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"D_",
"(_",
"'",
"80",
"'_",
")_",
"-_",
"D_",
"(_",
"'",
"20",
"'_",
")_",
",_",
"source_",
"._",
"amo",
"unt",
"\\u",
"avail",
"able",
"\\u",
"for",
"\\u",
"refund",
"_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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re DMS\nCopyright: Adlibre Pty Ltd 2011\nLicense: See LICENSE for license information\n\"\"\"\n\nfrom django.conf.urls import patterns, url\nfrom api import views\n\n\nurlpatterns = patterns(\n '',\n # Deprecated file handlers:\n # /api/file/ABC1234\n url(\n r'^file/(?P<code>[\\w_-]+)$',\n views.OldFileHandler.as_view(),\n name='api_file_deprecated',\n ),\n # /api/file/ABC1234.pdf\n url(\n r'^file/(?P<code>[\\w_-]+)\\.(?P<suggested_format>[\\w_-]+)$',\n views.OldFileHandler.as_view(),\n name='api_file_deprecated',\n ),\n\n # Working handlers:\n url(\n r'^new_file/$',\n views.FileHandler.as_view(),\n name='api_file',\n ),\n # /api/file/ABC1234\n url(\n r'^new_file/(?P<code>[\\w_-]+)$',\n views.FileHandler.as_view(),\n name='api_file',\n ),\n # /api/file/ABC1234.pdf\n url(\n r'^new_file/(?P<code>[\\w_-]+)\\.(?P<suggested_format>[\\w_-]+)$',\n views.FileHandler.as_view(),\n name='api_file',\n ),\n # /api/file-info/ABC1234\n url(\n r'^file-info/(?P<code>[\\w_-]+)$',\n views.FileInfoHandler.as_view(),\n name='api_file_info',\n ),\n # /api/file-info/ABC1234.pdf\n url(\n r'^file-info/(?P<code>[\\w_-]+)\\.(?P<suggested_format>[\\w_-]+)',\n views.FileInfoHandler.as_view(),\n name='api_file_info',\n ),\n url(\n r'^files/(?P<id_rule>\\d+)/$',\n views.FileListHandler.as_view(),\n name='api_file_list',\n ),\n url(\n r'^revision_count/(?P<document>[\\w_-]+)$',\n views.RevisionCountHandler.as_view(),\n name='api_revision_count',\n ),\n url(\n r'^rules.json$',\n views.RulesHandler.as_view(),\n name='api_rules',\n ),\n url(\n r'^rules/(?P<id_rule>\\d+).json$',\n views.RulesDetailHandler.as_view(),\n name='api_rules_detail',\n ),\n url(\n r'^tags-(?P<id_rule>\\d+)$',\n views.TagsHandler.as_view(),\n name='api_tags',\n ),\n url(\n r'^plugins.json$',\n views.PluginsHandler.as_view(),\n name='api_plugins'\n ),\n url(\n r'^mdt/$',\n views.MetaDataTemplateHandler.as_view(),\n name='api_mdt'\n ),\n url(\n r'^parallel/$',\n views.ParallelKeysHandler.as_view(),\n name='api_parallel',\n ),\n url(\n r'^thumbnail/(?P<code>[\\w_-]+)$',\n views.ThumbnailsHandler.as_view(),\n name='api_thumbnail',\n ),\n url(\n r'^version$',\n views.VersionHandler.as_view(),\n name='api_version'\n ),\n url(\n r'$',\n views.ApiDocs.as_view(),\n name='api_main'\n ),\n)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Modul",
"e",
":",
" ",
"DM",
"S",
" ",
"API",
" ",
"Dj",
"ang",
"o",
" ",
"URL",
"s",
"\\",
"10",
";",
"\\",
"10",
";",
"Project",
":",
" ",
"Ad",
"libre",
" ",
"DM",
"S",
"\\",
"10",
";",
"Copy",
"right",
":",
" ",
"Ad",
"libre",
" ",
"Pt",
"y",
" ",
"Lt",
"d",
" ",
"2011",
"\\",
"10",
";",
"License",
":",
" ",
"See",
" ",
"LICENSE",
" ",
"for",
" ",
"license",
" ",
"informati",
"on",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"import_",
"patterns_",
",_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"api_",
"import_",
"views_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"urlpatterns_",
"=_",
"patterns_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Dep",
"reca",
"ted",
" ",
"file",
" ",
"handler",
"s",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"/",
"api",
"/",
"file",
"/",
"ABC",
"1234_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"file",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Old",
"File",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"\\u",
"depre",
"cated",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"/",
"api",
"/",
"file",
"/",
"ABC",
"1234",
".",
"pdf_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"file",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)\\\\",
".(",
"?",
"P",
"<",
"suggested",
"\\u",
"format",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Old",
"File",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"\\u",
"depre",
"cated",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Work",
"ing",
" ",
"handler",
"s",
":_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"new",
"\\u",
"file",
"/$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"File",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"/",
"api",
"/",
"file",
"/",
"ABC",
"1234_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"new",
"\\u",
"file",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"File",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"/",
"api",
"/",
"file",
"/",
"ABC",
"1234",
".",
"pdf_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"new",
"\\u",
"file",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)\\\\",
".(",
"?",
"P",
"<",
"suggested",
"\\u",
"format",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"File",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"/",
"api",
"/",
"file",
"-",
"info",
"/",
"ABC",
"1234_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"file",
"-",
"info",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"File",
"Info",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"\\u",
"info",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"/",
"api",
"/",
"file",
"-",
"info",
"/",
"ABC",
"1234",
".",
"pdf_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"file",
"-",
"info",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)\\\\",
".(",
"?",
"P",
"<",
"suggested",
"\\u",
"format",
">[",
"\\\\",
"w",
"\\u-]",
"+)'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"File",
"Info",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"\\u",
"info",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"files",
"/(",
"?",
"P",
"<",
"id",
"\\u",
"rule",
">\\\\",
"d",
"+)/$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"File",
"List",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"file",
"\\u",
"list",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"revis",
"ion",
"\\u",
"count",
"/(",
"?",
"P",
"<",
"document",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Revi",
"sion",
"Count",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"revis",
"ion",
"\\u",
"count",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"rule",
"s",
".",
"json",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Rule",
"s",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"rule",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"rule",
"s",
"/(",
"?",
"P",
"<",
"id",
"\\u",
"rule",
">\\\\",
"d",
"+)",
".",
"json",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Rule",
"s",
"Det",
"ail",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"rule",
"s",
"\\u",
"deta",
"il",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"tags",
"-(",
"?",
"P",
"<",
"id",
"\\u",
"rule",
">\\\\",
"d",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Ta",
"gs",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"tags",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"plugin",
"s",
".",
"json",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Plug",
"ins",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"plugin",
"s",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"mdt",
"/$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Meta",
"Data",
"Templa",
"te",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"mdt",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"parall",
"el",
"/$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Parallel",
"Keys",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"parall",
"el",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"thumbnail",
"/(",
"?",
"P",
"<",
"code",
">[",
"\\\\",
"w",
"\\u-]",
"+)$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Thumb",
"nail",
"s",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"thumbnail",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'",
"^",
"version",
"$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Version",
"Handler_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"version",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"r",
"'$'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"views_",
"._",
"Ap",
"i",
"Docs",
"_",
"._",
"as",
"\\u",
"view_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"api",
"\\u",
"main",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_"
] | [
4,
4,
4,
4,
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\n self.assertTrue(False)\n except Exception:\n exc_info = sys.exc_info()\n with mock.patch('traceback.print_exception') as mock_print_exception:\n with mock.patch('pdb.post_mortem') as mock_post_mortem:\n with mock.patch.object(post_mortem_debug,\n 'get_ignored_traceback',\n return_value=mock.Mock()):\n post_mortem_debug.get_exception_handler('pdb')(exc_info)\n\n # traceback will become post_mortem_debug.FilteredTraceback\n filtered_exc_info = (exc_info[0], exc_info[1], mock.ANY)\n mock_print_exception.assert_called_once_with(*filtered_exc_info)\n mock_post_mortem.assert_called_once_with(mock.ANY)",
"metadata": "root.TestTesttoolsExceptionHandler.test_exception_handler",
"header": "['class', 'TestTesttoolsExceptionHandler', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']",
"index": 26
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Test",
"Test",
"tool",
"s",
"Except",
"ion",
"Handler_",
"(_",
"base_",
"._",
"Base",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test\\u",
"exception",
"\\u",
"handler_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"assert",
"True_",
"(_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exc",
"\\u",
"info_",
"=_",
"sys_",
"._",
"exc",
"\\u",
"info_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"with_",
"mock_",
"._",
"patch_",
"(_",
"'",
"traceback",
".",
"print",
"\\u",
"exception",
"'_",
")_",
"as_",
"mock",
"\\u",
"print",
"\\u",
"exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"mock_",
"._",
"patch_",
"(_",
"'",
"pdb",
".",
"post",
"\\u",
"mort",
"em",
"'_",
")_",
"as_",
"mock",
"\\u",
"post",
"\\u",
"mort",
"em_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"mock_",
"._",
"patch_",
"._",
"object_",
"(_",
"post",
"\\u",
"mort",
"em",
"\\u",
"debug_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"get",
"\\u",
"ignore",
"d\\u",
"traceback",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"return",
"\\u",
"value_",
"=_",
"mock_",
"._",
"Mock_",
"(_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"post",
"\\u",
"mort",
"em",
"\\u",
"debug_",
"._",
"get",
"\\u",
"exception",
"\\u",
"handler_",
"(_",
"'",
"pdb",
"'_",
")_",
"(_",
"exc",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"traceback",
" ",
"will",
" ",
"bec",
"ome",
" ",
"post",
"\\u",
"mort",
"em",
"\\u",
"debug",
".",
"Filter",
"ed",
"Trace",
"back_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"filter",
"ed",
"\\u",
"exc",
"\\u",
"info_",
"=_",
"(_",
"exc",
"\\u",
"info_",
"[_",
"0_",
"]_",
",_",
"exc",
"\\u",
"info_",
"[_",
"1_",
"]_",
",_",
"mock_",
"._",
"ANY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"print",
"\\u",
"exception_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"*_",
"filter",
"ed",
"\\u",
"exc",
"\\u",
"info_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mock",
"\\u",
"post",
"\\u",
"mort",
"em_",
"._",
"assert",
"\\u",
"call",
"ed",
"\\u",
"onc",
"e\\u",
"with_",
"(_",
"mock_",
"._",
"ANY_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | PMEAL/OpenPNM/OpenPNM/Algorithms/__Drainage__.py | [
{
"content": "# -*- coding: utf-8 -*-\n\"\"\"\n===============================================================================\nmodule __Drainage__: Capillary Pressure Curve Simulation\n===============================================================================\n\n\"\"\"\n\nimport scipy as sp\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom OpenPNM.Algorithms import GenericAlgorithm\nfrom OpenPNM.Base import logging\nlogger = logging.getLogger(__name__)\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Drainage(GenericAlgorithm):\n r\"\"\"\n Simulates a capillary drainage experiment by applying a list of increasing\n capillary pressures and invading all throats that are accessible and\n invadable at the given pressure.\n\n Parameters\n ----------\n network : OpenPNM Network Object\n The network upon which the simulation will be run\n\n name : string (optional)\n The name to apply to the Algorithm for quick identification\n\n Notes\n -----\n This algorithm creates several arrays and adds them to its own dictionary.\n These include:\n\n **'pore(throat).inv_Pc'** : The applied capillary pressure at which each\n pore(throat) was invaded.\n\n **'pore(throat).inv_Seq'** : The sequence each pore(throat) was filled.\n\n Examples\n --------\n >>> import OpenPNM as op\n >>> pn = op.Network.Cubic(shape=[20, 20, 20], spacing=10)\n >>> pn.add_boundary_pores(pores=pn.pores('top'),\n ... offset=[0, 0, 10],\n ... apply_label='boundary_top')\n >>> geo = op.Geometry.Stick_and_Ball(network=pn, pores=pn.Ps, throats=pn.Ts)\n >>> water = op.Phases.Water(network=pn)\n >>> air = op.Phases.Air(network=pn)\n >>> phys = op.Physics.Standard(network=pn, phase=water, geometry=geo)\n\n Once the basic Core objects are setup, the Algorithm can be created and\n and run as follows:\n\n >>> alg = op.Algorithms.Drainage(network=pn)\n >>> alg.setup(invading_phase=water, defending_phase=air)\n >>> alg.set_inlets(pores=pn.pores('boundary_top'))\n >>> alg.run()\n >>> data = alg.get_drainage_data()\n\n The ``data`` variable is a dictionary containing the numerical values of\n the resultant capillary pressure curve. The available values can be\n inspected by typing ``data.keys()`` at the command line. These values can\n of course be plotted with matplotlib or exported to a graphing program of\n your choice.\n\n The final step is to utilize these results elsewhere in your OpenPNM\n simulation. All Algorithms possess a method called ``return_results``\n which as the name suggests send the results to the correct locations. For\n the 'Drainage Algorithm' this works as follows:\n\n >>> alg.return_results(Pc=5000)\n\n This command determines which pores and throats were filled at the applied\n capillary pressure of 5000, and creates 'pore.occupancy' and\n 'throat.occupancy' arrays on the Phase object that was specfied as the\n 'invading_phase' in the ``setup_method``.\n\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.Drainage",
"header": "['module', '___EOS___']",
"index": 16
},
{
"content": " def __init__(self, network, name=None):\n super().__init__(network=network, name=name)",
"metadata": "root.Drainage.__init__",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 81
},
{
"content": " def setup(self,\n invading_phase,\n defending_phase,\n entry_pressure='throat.capillary_pressure',\n trapping=False,\n pore_filling=None,\n throat_filling=None,\n pore_volume='pore.volume',\n throat_volume='throat.volume'):\n r\"\"\"\n Used to specify necessary arguments to the simulation. This method is\n useful for resetting the Algorithm or applying more explicit control.\n\n Parameters\n ----------\n invading_phase : OpenPNM Phase object\n The Phase object containing the physical properties of the invading\n fluid.\n\n defending_phase : OpenPNM Phase object\n The Phase object containing the physical properties of the defending\n fluid.\n\n entry_pressure : string (optional)\n The dictionary key on the Phase object where the throat entry\n pressure values can be found. The default is\n 'throat.capillary_pressure'.\n\n trapping : boolean (optional)\n Specifies whether defending phase trapping should be included or\n not. The default is False. Note that defending phase outlets can\n be specified using the ``set_outlets`` method. Otherwise it is\n assumed the defending phase has no outlets.\n\n pore_filling and throat_filling: string (optional)\n The dictionary key on the Physics object where the late pore or\n throat filling model is located. The default is None, meaning that\n a pore or throat is completely filled upon penetration.\n\n pore_volume and throat_volume : string (optional)\n The dictionary key on the Geometry object where the pore or throat\n volume data is located. The defaults is 'pore.volume' and\n 'throat.volume'.\n\n \"\"\"\n self['throat.entry_pressure'] = invading_phase[entry_pressure]\n self['pore.inv_Pc'] = sp.inf\n self['throat.inv_Pc'] = sp.inf\n self['pore.trapped'] = sp.inf\n self['throat.trapped'] = sp.inf\n self['pore.inlets'] = False\n self['pore.outlets'] = False\n self['pore.residual'] = False\n self['throat.residual'] = False\n self._inv_phase = invading_phase\n self._def_phase = defending_phase\n self._trapping = trapping\n self._pore_filling = pore_filling\n self._throat_filling = throat_filling\n self._throat_volume = 'throat.volume'\n self._pore_volume = 'pore.volume'",
"metadata": "root.Drainage.setup",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 84
},
{
"content": " def set_inlets(self, pores=None, mode='add'):\n r\"\"\"\n Set the locations from which the invading phase enters the network.\n\n Parameters\n ----------\n pores : array_like\n An array of pore numbers that are initially filled with invading\n phase, and from which clusters of invading phase grow and invade\n into the network.\n\n mode : string\n Controls how the new values are handled. Options are:\n\n **'add'** : (default) Adds the newly recieved locations to any\n existing locations. This is useful for incrementally adding\n inlets.\n\n **'overwrite'** : Deletes any present locations and adds new ones.\n This is useful for fixing mistaken inlets, or rerunning the\n algorithm with different inlet locations.\n\n **'remove'** : Removes the received locations from the list of\n inlet pores.\n\n **'clear'** : Removes the existing inlets and ignores any specified\n locations. This is equivalent to calling the method with a mode\n of 'overwrite' and pores = [] or None.\n\n Notes\n -----\n The 'inlet' pores are initially filled with invading fluid to start the\n simulation. To avoid the capillary pressure curve showing a non-zero\n starting saturation at low pressures, it is necessary to create\n boundary pores that have zero-volume, and set these as the inlets.\n \"\"\"\n Ps = self._parse_locations(pores)\n if mode in ['clear', 'overwrite']:\n self['pore.inlets'] = False\n if sum(self['pore.outlets'][Ps]) > 0:\n raise Exception('Some inlets are already defined as outlets')\n bool_val = True\n if mode is 'remove':\n bool_val = False\n self['pore.inlets'][Ps] = bool_val",
"metadata": "root.Drainage.set_inlets",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 146
},
{
"content": " def set_outlets(self, pores=None, mode='add'):\n r\"\"\"\n Set the locations through which defending phase exits the network.\n This is only necessary if 'trapping'was set to True when setup was\n called.\n\n Parameters\n ----------\n pores : array_like\n An array of pore numbers where defending phase can exit. Any\n defending phase that does not have access to these pores will be\n trapped.\n\n mode : string\n Controls how the new values are handled. Options are:\n\n **'add'** : (default) Adds the newly recieved locations to any\n existing locations. This is useful for incrementally adding\n outlets.\n\n **'overwrite'** : Deletes any present locations and adds new ones.\n This is useful for fixing mistaken outlets, or rerunning the\n algorithm with different outlet locations.\n\n **'remove'** : Removes the received locations from the list of\n outlet pores.\n\n **'clear'** : Removes the existing outlets and ignores any\n specified locations. This is equivalent to calling the method with\n a mode of 'overwrite' and pores = [] or None.\n\n \"\"\"\n if self._trapping is False:\n raise Exception('Setting outlets is meaningless unless trapping ' +\n 'was set to True during setup')\n Ps = self._parse_locations(pores)\n if mode in ['clear', 'overwrite']:\n self['pore.outlets'] = False\n if sum(self['pore.inlets'][Ps]) > 0:\n raise Exception('Some outlets are already defined as inlets')\n bool_val = True\n if mode is 'remove':\n bool_val = False\n self['pore.outlets'][Ps] = bool_val",
"metadata": "root.Drainage.set_outlets",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 192
},
{
"content": " def set_residual(self, pores=None, throats=None, mode='add'):\n r\"\"\"\n Specify locations of the residual invading (nonwetting) phase\n\n Parameters\n ----------\n pores and throats : array_like\n The pore and throat locations that are to be filled with invading\n phase at the beginning of the simulation.\n\n mode : string\n Controls how the new values are handled. Options are:\n\n **'add'** : (default) Adds the newly recieved locations to any\n existing locations. This is useful for incrementally adding\n outlets.\n\n **'overwrite'** : Deletes any present locations and adds new ones.\n This is useful for fixing mistaken outlets, or rerunning the\n algorithm with different outlet locations.\n\n **'remove'** : Removes the received locations from the list of\n residual pores and/or throats. Both can be specified\n simultaneously.\n\n **'clear'** : Removes all existing residual locations. This\n ignores any specified locations and is equivalent to calling the\n method with a mode of 'overwrite' and pores = [] or None.\n\n Notes\n -----\n Setting pores as initially filled only affects the saturation at the\n start of the capillary pressure curve since pre-filled pores do not\n contribute to the invasion process. Setting throats as filled,\n however, has a significant impact on the subsequent invasion since\n these throats act as bridges to the percolation process. Of course,\n they also contribute to the starting saturation as well.\n\n \"\"\"\n bool_val = True\n if mode is 'clear':\n self['pore.residual'] = False\n self['throat.residual'] = False\n return\n if pores is not None:\n Ps = self._parse_locations(pores)\n if mode in ['clear', 'overwrite']:\n self['pore.residual'] = False\n if mode is 'remove':\n bool_val = False\n self['pore.residual'][Ps] = bool_val\n if throats is not None:\n Ts = self._parse_locations(throats)\n if mode in ['clear', 'overwrite']:\n self['throat.residual'] = False\n if mode is 'remove':\n bool_val = False\n self['throat.residual'][Ts] = bool_val",
"metadata": "root.Drainage.set_residual",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 237
},
{
"content": " def set_boundary_conditions(self, bc_type=None, pores=None, throats=None,\n mode='add'):\n r\"\"\"\n Parameters\n ----------\n bc_type : string\n The type of boundary condition to apply. Options are:\n\n **'inlets'** : For specifying where invading phase enters the\n Network\n\n **'outlets'** : For specifying where defending phase exits the\n Network if trapping is to be considered.\n\n **'residual'** : For specifying the pore and throat locations of\n existing residual invading phase in the Network at the start of the\n drainage.\n\n pores and thorats: array_like\n The pore (and throat) locations where the specified boundary\n condition is to be applied. Note that the 'throats' argument\n is only valid for setting 'residual' locations, since 'inlets' and\n 'outlets' locations can only be pores.\n\n mode : string\n Controls how the new values are handled. Options are:\n\n **'add'** : (default) Adds the newly recieved locations to any\n existing locations. This is useful for incrementally adding\n outlets.\n\n **'overwrite'** : Deletes any present locations and adds new ones.\n This is useful for fixing mistaken outlets, or rerunning the\n algorithm with different outlet locations.\n\n **'remove'** : Removes boundary conditions of the specified type\n from the given locations.\n\n **'clear'** : Removes existing conditions of the specified type\n and ignores any specified locations. If 'bc_type' is not specified\n then all conditions are removed.\n\n \"\"\"\n if bc_type is None:\n if mode == 'clear':\n self['pore.inlets'] = False\n self['pore.outlets'] = False\n self['pore.residual'] = False\n self['throat.residual'] = False\n return\n else:\n raise Exception('\\'bc_type\\' cannot be None unless mode \\\n is \\'clear\\'')\n if bc_type == 'residual':\n self.set_residual(pores=pores, throats=throats, mode=mode)\n elif bc_type == 'inlets':\n self.set_inlets(pores=pores, mode=mode)\n elif bc_type == 'outlets':\n self.set_outlets(pores=pores, mode=mode)\n else:\n raise Exception('Unrecognized \\'bc_type\\' specified')",
"metadata": "root.Drainage.set_boundary_conditions",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 296
},
{
"content": " def run(self, npts=25, inv_pressures=None):\n r\"\"\"\n Run the algorithm for specified number of points or at given capillary\n pressures.\n\n Parameters\n ----------\n npts : scalar\n The number of points to obtain on the curve. The points are\n automatically selected to span the range of capillary pressures\n using a logarithmic spacing (more points are lower capillary\n pressure values).\n\n inv_pressures : array_like\n A list of capillary pressures to apply. List should contain\n increasing and unique values.\n \"\"\"\n # If no invasion points are given then generate some\n if inv_pressures is None:\n logger.info('Generating list of invasion pressures')\n min_p = sp.amin(self['throat.entry_pressure']) * 0.98 # nudge down\n max_p = sp.amax(self['throat.entry_pressure']) * 1.02 # bump up\n inv_points = sp.logspace(sp.log10(min_p),\n sp.log10(max_p),\n npts)\n else:\n # Make sure the given invastion points are sensible\n inv_points = sp.unique(inv_pressures)\n self._inv_points = inv_points\n\n # Ensure inlets are set\n if sp.sum(self['pore.inlets']) == 0:\n raise Exception('Inlet pores have not been specified')\n\n # Ensure outlet pores are set if trapping is enabled\n if self._trapping:\n if sp.sum(self['pore.outlets']) == 0:\n raise Exception('Outlet pores have not been specified')\n\n # Generate curve from points\n for inv_val in self._inv_points:\n # Apply one applied pressure and determine invaded pores\n logger.info('Applying capillary pressure: ' + str(inv_val))\n self._apply_percolation(inv_val)\n if self._trapping:\n logger.info('Checking for trapping')\n self._check_trapping(inv_val)\n\n # Find invasion sequence values (to correspond with IP algorithm)\n Pinv = self['pore.inv_Pc']\n self['pore.inv_seq'] = sp.searchsorted(sp.unique(Pinv), Pinv)\n Tinv = self['throat.inv_Pc']\n self['throat.inv_seq'] = sp.searchsorted(sp.unique(Tinv), Tinv)",
"metadata": "root.Drainage.run",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 358
},
{
"content": " def _check_trapping(self, inv_val):\n r\"\"\"\n Determine which pores and throats are trapped by invading phase. This\n method is called by ``run`` if 'trapping' is set to True.\n \"\"\"\n # Generate a list containing boolean values for throat state\n Tinvaded = self['throat.inv_Pc'] < sp.inf\n # Add residual throats, if any, to list of invaded throats\n Tinvaded = Tinvaded + self['throat.residual']\n # Invert logic to find defending throats\n Tdefended = ~Tinvaded\n [pclusters, tclusters] = self._net.find_clusters2(mask=Tdefended,\n t_labels=True)\n # See which outlet pores remain uninvaded\n outlets = self['pore.outlets']*(self['pore.inv_Pc'] == sp.inf)\n # Identify clusters connected to remaining outlet sites\n def_clusters = sp.unique(pclusters[outlets])\n temp = sp.in1d(sp.unique(pclusters), def_clusters, invert=True)\n trapped_clusters = sp.unique(pclusters)[temp]\n trapped_clusters = trapped_clusters[trapped_clusters >= 0]\n\n # Find defending clusters NOT connected to the outlet pores\n pmask = np.in1d(pclusters, trapped_clusters)\n # Store current applied pressure in newly trapped pores\n pinds = (self['pore.trapped'] == sp.inf) * (pmask)\n self['pore.trapped'][pinds] = inv_val\n\n # Find throats on the trapped defending clusters\n tinds = self._net.find_neighbor_throats(pores=pinds,\n mode='intersection')\n self['throat.trapped'][tinds] = inv_val\n self['throat.entry_pressure'][tinds] = 1000000",
"metadata": "root.Drainage._check_trapping",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 412
},
{
"content": " def _apply_percolation(self, inv_val):\n r\"\"\"\n Determine which pores and throats are invaded at a given applied\n capillary pressure. This method is called by ``run``.\n \"\"\"\n # Generate a list containing boolean values for throat state\n Tinvaded = self['throat.entry_pressure'] <= inv_val\n # Add residual throats, if any, to list of invaded throats\n Tinvaded = Tinvaded + self['throat.residual']\n # Find all pores that can be invaded at specified pressure\n [pclusters, tclusters] = self._net.find_clusters2(mask=Tinvaded,\n t_labels=True)\n\n # Identify clusters connected to inlet sites\n inv_clusters = sp.unique(pclusters[self['pore.inlets']])\n inv_clusters = inv_clusters[inv_clusters >= 0]\n\n # Find pores on the invading clusters\n pmask = np.in1d(pclusters, inv_clusters)\n # Store current applied pressure in newly invaded pores\n pinds = (self['pore.inv_Pc'] == sp.inf) * (pmask)\n self['pore.inv_Pc'][pinds] = inv_val\n\n # Find throats on the invading clusters\n tmask = np.in1d(tclusters, inv_clusters)\n # Store current applied pressure in newly invaded throats\n tinds = (self['throat.inv_Pc'] == sp.inf) * (tmask)\n self['throat.inv_Pc'][tinds] = inv_val\n\n # Set residual pores and throats, if any, to invaded\n if sp.any(self['pore.residual']):\n self['pore.inv_Pc'][self['pore.residual']] = 0\n if sp.any(self['throat.residual']):\n self['throat.inv_Pc'][self['throat.residual']] = 0",
"metadata": "root.Drainage._apply_percolation",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 445
},
{
"content": " def get_drainage_data(self):\n r\"\"\"\n Obtain the numerical values of the resultant capillary pressure curve.\n\n Parameters\n ----------\n None\n\n Returns\n -------\n A dictionary containing arrays of applied capillary pressures and\n various phase saturations. The dictionary keys explain the content of\n each array.\n\n Notes\n -----\n This method assumes that the pore and throat volumes are stored under\n the keys 'pore.volume' and 'throat.volume'. This cannot be customized\n at this time.\n \"\"\"\n # Infer list of applied capillary pressures\n PcPoints = self._inv_points\n if PcPoints[-1] == sp.inf: # Remove infinity from PcPoints if present\n PcPoints = PcPoints[:-1]\n # Get pore and throat volumes\n Pvol = self._net[self._pore_volume]\n Tvol = self._net[self._throat_volume]\n Total_vol = sp.sum(Pvol) + sp.sum(Tvol)\n # Find cumulative filled volume at each applied capillary pressure\n Vnwp_t = []\n Vnwp_p = []\n Vnwp_all = []\n for Pc in PcPoints:\n # Calculate filled pore volumes\n p_inv = self['pore.inv_Pc'] <= Pc\n if self._pore_filling is None:\n Vp = sp.sum(Pvol[p_inv])\n else:\n Vp = self._calc_fractional_filling(pressure=Pc,\n element='pore')\n Vp = sp.sum(Vp[p_inv])\n # Calculate filled throat volumes\n t_inv = self['throat.inv_Pc'] <= Pc\n if self._throat_filling is None:\n Vt = sp.sum(Tvol[t_inv])\n else:\n Vt = self._calc_fractional_filling(pressure=Pc,\n element='throat')\n Vt = sp.sum(Vt[t_inv])\n Vnwp_p.append(Vp)\n Vnwp_t.append(Vt)\n Vnwp_all.append(Vp + Vt)\n # Convert volumes to saturations by normalizing with total pore volume\n Snwp_all = [V/Total_vol for V in Vnwp_all]\n data = {}\n data['capillary_pressure'] = PcPoints\n data['invading_phase_saturation'] = Snwp_all\n data['defending_phase_saturation'] = [1-s for s in Snwp_all]\n return data",
"metadata": "root.Drainage.get_drainage_data",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 480
},
{
"content": " def _calc_fractional_filling(self, element, pressure):\n r\"\"\"\n Calculates the fractional filling of each pore or throat as the\n supplied capillary pressure\n\n Parameters\n ----------\n element : string\n Can either be 'pore' or 'throat' indicating which type of element\n to be calculated\n\n pressure : float\n The value of the capillary pressure to apply. This value is sent\n the to Physics model stored in the ``_pore(throat)_filling``\n attribute of the object. This attribute is set during the call\n to ``get_drainage_data``.\n\n Notes\n -----\n The 'pore(throat)_filling' model must accept the applied capillary\n pressure as 'Pc'. This is not customizable at the moment.\n \"\"\"\n if element == 'pore':\n key = self._pore_filling\n vol = self._pore_volume\n elif element == 'throat':\n key = self._throat_filling\n vol = self._throat_volume\n else:\n raise Exception('element must be either \\'pore\\' or \\'throat\\'')\n Snwp = sp.zeros((self._count(element),))\n for phys in self._inv_phase._physics:\n # Update Physics model with current Pc\n temp_Pc = phys.models[key]['Pc'] # Store old Pc\n phys.models[key]['Pc'] = pressure\n # Regenerate Physics model and capture output locally\n Snwp[phys.Pnet] = phys.models[key].run()\n # Re-populate the residual element with the non-wetting phase\n if sp.any(self[element+'.residual']):\n Snwp[self[element+'.residual']] = 1.0\n phys.models[key]['Pc'] = temp_Pc # Return old Pc\n V = self._net[vol]*Snwp\n return V",
"metadata": "root.Drainage._calc_fractional_filling",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 540
},
{
"content": " def plot_drainage_curve(self,\n data=None,\n x_values='capillary_pressure',\n y_values='invading_phase_saturation'):\n r\"\"\"\n Plot the drainage curve as the non-wetting phase saturation vs the\n applied capillary pressure.\n\n Parameters\n ----------\n data : dictionary of arrays\n This dictionary should be obtained from the ``get_drainage_data``\n method.\n\n x_values and y_values : string\n The dictionary keys of the arrays containing the x-values and\n y-values\n\n \"\"\"\n # Begin creating nicely formatted plot\n if data is None:\n data = self.get_drainage_data()\n xdata = data[x_values]\n ydata = data[y_values]\n fig = plt.figure()\n plt.plot(xdata, ydata, 'ko-')\n plt.ylabel(y_values)\n plt.xlabel(x_values)\n plt.grid(True)\n if sp.amax(xdata) <= 1:\n plt.xlim(xmin=0, xmax=1)\n if sp.amax(ydata) <= 1:\n plt.ylim(ymin=0, ymax=1)\n return fig",
"metadata": "root.Drainage.plot_drainage_curve",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 584
},
{
"content": " def return_results(self, Pc):\n r\"\"\"\n This method determines which pores and throats are filled with non-\n wetting phase at the specified capillary pressure, and creates or\n updates 'pore.occupancy' and 'throat.occupancy' arrays on the\n associated Phase objects. Invasion pressure and sequence are also sent\n to the invading phase.\n\n Parameters\n ----------\n Pc : scalar\n The capillary pressure for which an invading phase configuration is\n required.\n\n Returns\n -------\n\n Notes\n -----\n The Phase object that receives the updated occupancy arrays is the\n one that was specified as the 'invading_phase' when ``setup`` was\n called. The defending phase has the opposite occupancy values and\n partial occupancy so that summing occupancy for both phases equals\n 1.0 for every pore.\n \"\"\"\n Psatn = self['pore.inv_Pc'] <= Pc\n Tsatn = self['throat.inv_Pc'] <= Pc\n self._inv_phase['pore.occupancy'] = sp.array(Psatn, dtype=float)\n self._inv_phase['throat.occupancy'] = sp.array(Tsatn, dtype=float)\n self._def_phase['pore.occupancy'] = sp.array(~Psatn, dtype=float)\n self._def_phase['throat.occupancy'] = sp.array(~Tsatn, dtype=float)\n self._inv_phase['pore.inv_Pc'] = self['pore.inv_Pc']\n self._inv_phase['pore.inv_seq'] = self['pore.inv_seq']\n self._inv_phase['throat.inv_Pc'] = self['throat.inv_Pc']\n self._inv_phase['throat.inv_seq'] = self['throat.inv_seq']\n if self._pore_filling:\n Vp = self._calc_fractional_filling(element='pore', pressure=Pc)\n Sp = Vp/self._net[self._pore_volume]\n # For pores that have zero volume (i.e. boundary pores in some cases)\n # fractional filling is meaningless so use the standard occupancy\n zero_ps = self._net[self._pore_volume] == 0.0\n Sp[zero_ps] = self._inv_phase['pore.occupancy'][zero_ps]\n self._inv_phase['pore.partial_occupancy'] = Sp\n self._def_phase['pore.partial_occupancy'] = 1 - Sp\n if self._throat_filling:\n Vt = self._calc_fractional_filling(element='throat', pressure=Pc)\n St = Vt/self._net[self._throat_volume]\n # For throats that have zero volume (i.e. boundary throats in some cases)\n # fractional filling is meaningless so use the standard occupancy\n zero_ts = self._net[self._throat_volume] == 0.0\n St[zero_ts] = self._inv_phase['throat.occupancy'][zero_ts]\n self._inv_phase['throat.partial_occupancy'] = St\n self._def_phase['throat.partial_occupancy'] = 1 - St",
"metadata": "root.Drainage.return_results",
"header": "['class', 'Drainage', '(', 'GenericAlgorithm', ')', ':', '___EOS___']",
"index": 619
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"==============",
"==============",
"==============",
"==============",
"==============",
"=========",
"\\",
"10",
";",
"module",
" ",
"\\u\\u",
"Drain",
"age",
"\\u\\u:",
" ",
"Cap",
"illa",
"ry",
" ",
"Press",
"ure",
" ",
"Curve",
" ",
"Simul",
"ation",
"\\",
"10",
";",
"==============",
"==============",
"==============",
"==============",
"==============",
"=========",
"\\",
"10",
";",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"scipy_",
"as_",
"sp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"matplotlib_",
"._",
"pyplot_",
"as_",
"plt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"Open",
"PN",
"M_",
"._",
"Algorit",
"hms",
"_",
"import_",
"Gene",
"ric",
"Algorithm_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"Open",
"PN",
"M_",
"._",
"Base_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Simulate",
"s",
" ",
"a",
" ",
"capi",
"llar",
"y",
" ",
"drain",
"age",
" ",
"experiment",
" ",
"by",
" ",
"appl",
"ying",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"incr",
"easi",
"ng",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
"s",
" ",
"and",
" ",
"inva",
"ding",
" ",
"all",
" ",
"thro",
"ats",
" ",
"tha",
"t",
" ",
"are",
" ",
"accessible",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inva",
"dable",
" ",
"at",
" ",
"the",
" ",
"give",
"n",
" ",
"press",
"ure",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"network",
" ",
":",
" ",
"Open",
"PN",
"M",
" ",
"Network",
" ",
"Object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"network",
" ",
"upo",
"n",
" ",
"whi",
"ch",
" ",
"the",
" ",
"simulati",
"on",
" ",
"will",
" ",
"be",
" ",
"run",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"name",
" ",
":",
" ",
"string",
" ",
"(",
"option",
"al",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"name",
" ",
"to",
" ",
"appl",
"y",
" ",
"to",
" ",
"the",
" ",
"Algorit",
"hm",
" ",
"for",
" ",
"quick",
" ",
"identifica",
"tion",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"algo",
"rit",
"hm",
" ",
"create",
"s",
" ",
"sever",
"al",
" ",
"arrays",
" ",
"and",
" ",
"adds",
" ",
"them",
" ",
"to",
" ",
"its",
" ",
"own",
" ",
"dictionar",
"y",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
"se",
" ",
"include",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"pore",
"(",
"thro",
"at",
").",
"inv",
"\\u",
"Pc",
"'**",
" ",
":",
" ",
"The",
" ",
"applied",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"at",
" ",
"whi",
"ch",
" ",
"each",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"(",
"thro",
"at",
")",
" ",
"was",
" ",
"inva",
"ded",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"pore",
"(",
"thro",
"at",
").",
"inv",
"\\u",
"Seq",
"'**",
" ",
":",
" ",
"The",
" ",
"sequence",
" ",
"each",
" ",
"pore",
"(",
"thro",
"at",
")",
" ",
"was",
" ",
"filled",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Exam",
"ples",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"--------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"import",
" ",
"Open",
"PN",
"M",
" ",
"as",
" ",
"op",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"pn",
" ",
"=",
" ",
"op",
".",
"Network",
".",
"Cub",
"ic",
"(",
"shape",
"=[",
"20",
",",
" ",
"20",
",",
" ",
"20",
"],",
" ",
"spaci",
"ng",
"=",
"10",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"pn",
".",
"add",
"\\u",
"bound",
"ary",
"\\u",
"pore",
"s",
"(",
"pore",
"s",
"=",
"pn",
".",
"pore",
"s",
"('",
"top",
"')",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
" ",
" ",
" ",
" ",
" ",
"offset",
"=[",
"0",
",",
" ",
"0",
",",
" ",
"10",
"],",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"...",
" ",
" ",
" ",
" ",
" ",
"appl",
"y",
"\\u",
"label",
"='",
"bound",
"ary",
"\\u",
"top",
"')",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"geo",
" ",
"=",
" ",
"op",
".",
"Geometr",
"y",
".",
"Stick",
"\\u",
"and",
"\\u",
"Ball",
"(",
"network",
"=",
"pn",
",",
" ",
"pore",
"s",
"=",
"pn",
".",
"Ps",
",",
" ",
"thro",
"ats",
"=",
"pn",
".",
"Ts",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"water",
" ",
"=",
" ",
"op",
".",
"Phase",
"s",
".",
"Water",
"(",
"network",
"=",
"pn",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"air",
" ",
"=",
" ",
"op",
".",
"Phase",
"s",
".",
"Air",
"(",
"network",
"=",
"pn",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"phys",
" ",
"=",
" ",
"op",
".",
"Phys",
"ics",
".",
"Standard",
"(",
"network",
"=",
"pn",
",",
" ",
"phase",
"=",
"water",
",",
" ",
"geom",
"etry",
"=",
"geo",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"On",
"ce",
" ",
"the",
" ",
"basic",
" ",
"Core",
" ",
"object",
"s",
" ",
"are",
" ",
"setup",
",",
" ",
"the",
" ",
"Algorit",
"hm",
" ",
"can",
" ",
"be",
" ",
"created",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"run",
" ",
"as",
" ",
"follow",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"alg",
" ",
"=",
" ",
"op",
".",
"Algorit",
"hms",
".",
"Drain",
"age",
"(",
"network",
"=",
"pn",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"alg",
".",
"setup",
"(",
"inva",
"ding",
"\\u",
"phase",
"=",
"water",
",",
" ",
"defend",
"ing",
"\\u",
"phase",
"=",
"air",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"alg",
".",
"set\\u",
"inlet",
"s",
"(",
"pore",
"s",
"=",
"pn",
".",
"pore",
"s",
"('",
"bound",
"ary",
"\\u",
"top",
"'))",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"alg",
".",
"run",
"()",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"data",
" ",
"=",
" ",
"alg",
".",
"get",
"\\u",
"drain",
"age",
"\\u",
"data",
"()",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"``",
"data",
"``",
" ",
"variab",
"le",
" ",
"is",
" ",
"a",
" ",
"dictionar",
"y",
" ",
"contain",
"ing",
" ",
"the",
" ",
"numerical",
" ",
"values",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"result",
"ant",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"curve",
".",
" ",
" ",
"The",
" ",
"avail",
"able",
" ",
"values",
" ",
"can",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inspect",
"ed",
" ",
"by",
" ",
"typ",
"ing",
" ",
"``",
"data",
".",
"keys",
"()``",
" ",
"at",
" ",
"the",
" ",
"command",
" ",
"line",
".",
" ",
"The",
"se",
" ",
"values",
" ",
"can",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"course",
" ",
"be",
" ",
"plott",
"ed",
" ",
"with",
" ",
"mat",
"plotlib",
" ",
"or",
" ",
"exported",
" ",
"to",
" ",
"a",
" ",
"graph",
"ing",
" ",
"program",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"your",
" ",
"choice",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"final",
" ",
"step",
" ",
"is",
" ",
"to",
" ",
"utiliz",
"e",
" ",
"these",
" ",
"results",
" ",
"else",
"where",
" ",
"in",
" ",
"your",
" ",
"Open",
"PN",
"M",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"simulati",
"on",
".",
" ",
" ",
"All",
" ",
"Algorit",
"hms",
" ",
"poss",
"ess",
" ",
"a",
" ",
"method",
" ",
"call",
"ed",
" ",
"``",
"return",
"\\u",
"results",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"whi",
"ch",
" ",
"as",
" ",
"the",
" ",
"name",
" ",
"suggest",
"s",
" ",
"send",
" ",
"the",
" ",
"results",
" ",
"to",
" ",
"the",
" ",
"correct",
" ",
"location",
"s",
".",
" ",
" ",
"For",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"'",
"Drain",
"age",
" ",
"Algorit",
"hm",
"'",
" ",
"this",
" ",
"works",
" ",
"as",
" ",
"follow",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
">>>",
" ",
"alg",
".",
"return",
"\\u",
"results",
"(",
"Pc",
"=",
"5000",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"command",
" ",
"dete",
"rmin",
"es",
" ",
"whi",
"ch",
" ",
"pore",
"s",
" ",
"and",
" ",
"thro",
"ats",
" ",
"wer",
"e",
" ",
"filled",
" ",
"at",
" ",
"the",
" ",
"applied",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"of",
" ",
"5000",
",",
" ",
"and",
" ",
"create",
"s",
" ",
"'",
"pore",
".",
"occupancy",
"'",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"thro",
"at",
".",
"occupancy",
"'",
" ",
"arrays",
" ",
"on",
" ",
"the",
" ",
"Phase",
" ",
"object",
" ",
"tha",
"t",
" ",
"was",
" ",
"specf",
"ied",
" ",
"as",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"inva",
"ding",
"\\u",
"phase",
"'",
" ",
"in",
" ",
"the",
" ",
"``",
"setup",
"\\u",
"method",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"network_",
",_",
"name_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"network_",
"=_",
"network_",
",_",
"name_",
"=_",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"setup_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"inva",
"ding",
"\\u",
"phase_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"defend",
"ing",
"\\u",
"phase_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"entry",
"\\u",
"pressure_",
"=_",
"'",
"thro",
"at",
".",
"capi",
"llar",
"y",
"\\u",
"press",
"ure",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"trap",
"ping_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pore",
"\\u",
"filling",
"_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"thro",
"at",
"\\u",
"filling",
"_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"pore",
"\\u",
"volume_",
"=_",
"'",
"pore",
".",
"volume",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"thro",
"at",
"\\u",
"volume_",
"=_",
"'",
"thro",
"at",
".",
"volume",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Us",
"ed",
" ",
"to",
" ",
"speci",
"fy",
" ",
"necessar",
"y",
" ",
"argu",
"ment",
"s",
" ",
"to",
" ",
"the",
" ",
"simulati",
"on",
".",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"usef",
"ul",
" ",
"for",
" ",
"reset",
"ting",
" ",
"the",
" ",
"Algorit",
"hm",
" ",
"or",
" ",
"appl",
"ying",
" ",
"more",
" ",
"explicit",
" ",
"control",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inva",
"ding",
"\\u",
"phase",
" ",
":",
" ",
"Open",
"PN",
"M",
" ",
"Phase",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"Phase",
" ",
"object",
" ",
"contain",
"ing",
" ",
"the",
" ",
"physical",
" ",
"proper",
"ties",
" ",
"of",
" ",
"the",
" ",
"inva",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fluid",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"defend",
"ing",
"\\u",
"phase",
" ",
":",
" ",
"Open",
"PN",
"M",
" ",
"Phase",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"Phase",
" ",
"object",
" ",
"contain",
"ing",
" ",
"the",
" ",
"physical",
" ",
"proper",
"ties",
" ",
"of",
" ",
"the",
" ",
"defend",
"ing",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"fluid",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"entry",
"\\u",
"press",
"ure",
" ",
":",
" ",
"string",
" ",
"(",
"option",
"al",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"dictionar",
"y",
" ",
"key",
" ",
"on",
" ",
"the",
" ",
"Phase",
" ",
"object",
" ",
"where",
" ",
"the",
" ",
"thro",
"at",
" ",
"entry",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"press",
"ure",
" ",
"values",
" ",
"can",
" ",
"be",
" ",
"found",
".",
" ",
" ",
"The",
" ",
"default",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"thro",
"at",
".",
"capi",
"llar",
"y",
"\\u",
"press",
"ure",
"'.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"trap",
"ping",
" ",
":",
" ",
"boolean",
" ",
"(",
"option",
"al",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Specifie",
"s",
" ",
"whe",
"ther",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"trap",
"ping",
" ",
"shou",
"ld",
" ",
"be",
" ",
"include",
"d",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"not",
".",
" ",
"The",
" ",
"default",
" ",
"is",
" ",
"Fal",
"se",
".",
" ",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"outlet",
"s",
" ",
"can",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"be",
" ",
"specified",
" ",
"usi",
"ng",
" ",
"the",
" ",
"``",
"set\\u",
"outlet",
"s",
"``",
" ",
"method",
".",
" ",
" ",
"Ot",
"her",
"wis",
"e",
" ",
"it",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"assume",
"d",
" ",
"the",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"has",
" ",
"no",
" ",
"outlet",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"\\u",
"filling",
" ",
"and",
" ",
"thro",
"at",
"\\u",
"filling",
":",
" ",
"string",
" ",
"(",
"option",
"al",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"dictionar",
"y",
" ",
"key",
" ",
"on",
" ",
"the",
" ",
"Phys",
"ics",
" ",
"object",
" ",
"where",
" ",
"the",
" ",
"late",
" ",
"pore",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"thro",
"at",
" ",
"filling",
" ",
"model",
" ",
"is",
" ",
"located",
".",
" ",
"The",
" ",
"default",
" ",
"is",
" ",
"Non",
"e",
",",
" ",
"meaning",
" ",
"tha",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"pore",
" ",
"or",
" ",
"thro",
"at",
" ",
"is",
" ",
"complete",
"ly",
" ",
"filled",
" ",
"upo",
"n",
" ",
"pene",
"trat",
"ion",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"\\u",
"volume",
" ",
"and",
" ",
"thro",
"at",
"\\u",
"volume",
" ",
":",
" ",
"string",
" ",
"(",
"option",
"al",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"dictionar",
"y",
" ",
"key",
" ",
"on",
" ",
"the",
" ",
"Geometr",
"y",
" ",
"object",
" ",
"where",
" ",
"the",
" ",
"pore",
" ",
"or",
" ",
"thro",
"at",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"volume",
" ",
"data",
" ",
"is",
" ",
"located",
".",
" ",
" ",
"The",
" ",
"default",
"s",
" ",
"is",
" ",
"'",
"pore",
".",
"volume",
"'",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"thro",
"at",
".",
"volume",
"'.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"entry",
"\\u",
"press",
"ure",
"'_",
"]_",
"=_",
"inva",
"ding",
"\\u",
"phase_",
"[_",
"entry",
"\\u",
"pressure_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"=_",
"sp_",
"._",
"inf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"=_",
"sp_",
"._",
"inf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"trap",
"ped",
"'_",
"]_",
"=_",
"sp_",
"._",
"inf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"trap",
"ped",
"'_",
"]_",
"=_",
"sp_",
"._",
"inf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"=_",
"inva",
"ding",
"\\u",
"phase_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"def",
"\\u",
"phase_",
"=_",
"defend",
"ing",
"\\u",
"phase_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"trap",
"ping_",
"=_",
"trap",
"ping_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"filling",
"_",
"=_",
"pore",
"\\u",
"filling",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"filling",
"_",
"=_",
"thro",
"at",
"\\u",
"filling",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"volume_",
"=_",
"'",
"thro",
"at",
".",
"volume",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"volume_",
"=_",
"'",
"pore",
".",
"volume",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set\\u",
"inlet",
"s_",
"(_",
"self_",
",_",
"pore",
"s_",
"=_",
"None_",
",_",
"mode_",
"=_",
"'",
"add",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Set",
" ",
"the",
" ",
"location",
"s",
" ",
"from",
" ",
"whi",
"ch",
" ",
"the",
" ",
"inva",
"ding",
" ",
"phase",
" ",
"enter",
"s",
" ",
"the",
" ",
"network",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"s",
" ",
":",
" ",
"array",
"\\u",
"like",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"array",
" ",
"of",
" ",
"pore",
" ",
"numbers",
" ",
"tha",
"t",
" ",
"are",
" ",
"initially",
" ",
"filled",
" ",
"with",
" ",
"inva",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"phase",
",",
" ",
"and",
" ",
"from",
" ",
"whi",
"ch",
" ",
"cluster",
"s",
" ",
"of",
" ",
"inva",
"ding",
" ",
"phase",
" ",
"grow",
" ",
"and",
" ",
"inva",
"de",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"int",
"o",
" ",
"the",
" ",
"network",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mode",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Control",
"s",
" ",
"how",
" ",
"the",
" ",
"new",
" ",
"values",
" ",
"are",
" ",
"handle",
"d",
".",
" ",
" ",
"Optio",
"ns",
" ",
"are",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"add",
"'**",
" ",
":",
" ",
"(",
"default",
")",
" ",
"Add",
"s",
" ",
"the",
" ",
"newl",
"y",
" ",
"recieve",
"d",
" ",
"location",
"s",
" ",
"to",
" ",
"any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exist",
"ing",
" ",
"location",
"s",
".",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"incremental",
"ly",
" ",
"addin",
"g",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inlet",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"overwrit",
"e",
"'**",
" ",
":",
" ",
"Delete",
"s",
" ",
"any",
" ",
"presen",
"t",
" ",
"location",
"s",
" ",
"and",
" ",
"adds",
" ",
"new",
" ",
"ones",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"fix",
"ing",
" ",
"mist",
"ake",
"n",
" ",
"inlet",
"s",
",",
" ",
"or",
" ",
"rerun",
"ning",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"algo",
"rit",
"hm",
" ",
"with",
" ",
"different",
" ",
"inlet",
" ",
"location",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"remove",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"the",
" ",
"receive",
"d",
" ",
"location",
"s",
" ",
"from",
" ",
"the",
" ",
"list",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inlet",
" ",
"pore",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"clear",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"the",
" ",
"exist",
"ing",
" ",
"inlet",
"s",
" ",
"and",
" ",
"ignores",
" ",
"any",
" ",
"specified",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"location",
"s",
".",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"equivalent",
" ",
"to",
" ",
"calling",
" ",
"the",
" ",
"method",
" ",
"with",
" ",
"a",
" ",
"mode",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"of",
" ",
"'",
"overwrit",
"e",
"'",
" ",
"and",
" ",
"pore",
"s",
" ",
"=",
" ",
"[]",
" ",
"or",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"'",
"inlet",
"'",
" ",
"pore",
"s",
" ",
"are",
" ",
"initially",
" ",
"filled",
" ",
"with",
" ",
"inva",
"ding",
" ",
"fluid",
" ",
"to",
" ",
"start",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"simulati",
"on",
".",
" ",
" ",
"To",
" ",
"avoid",
" ",
"the",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"curve",
" ",
"showin",
"g",
" ",
"a",
" ",
"non",
"-",
"zero",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"startin",
"g",
" ",
"saturation",
" ",
"at",
" ",
"low",
" ",
"press",
"ure",
"s",
",",
" ",
"it",
" ",
"is",
" ",
"necessar",
"y",
" ",
"to",
" ",
"create",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bound",
"ary",
" ",
"pore",
"s",
" ",
"tha",
"t",
" ",
"have",
" ",
"zero",
"-",
"volume",
",",
" ",
"and",
" ",
"set",
" ",
"these",
" ",
"as",
" ",
"the",
" ",
"inlet",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Ps_",
"=_",
"self_",
"._",
"\\u",
"parse",
"\\u",
"locations_",
"(_",
"pore",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"in_",
"[_",
"'",
"clear",
"'_",
",_",
"'",
"overwrit",
"e",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"sum_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
"[_",
"Ps_",
"]_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"Some",
" ",
"inlet",
"s",
" ",
"are",
" ",
"alr",
"ead",
"y",
" ",
"defin",
"ed",
" ",
"as",
" ",
"outlet",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"bool\\u",
"val_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"is_",
"'",
"remove",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bool\\u",
"val_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
"[_",
"Ps_",
"]_",
"=_",
"bool\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set\\u",
"outlet",
"s_",
"(_",
"self_",
",_",
"pore",
"s_",
"=_",
"None_",
",_",
"mode_",
"=_",
"'",
"add",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Set",
" ",
"the",
" ",
"location",
"s",
" ",
"through",
" ",
"whi",
"ch",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"exits",
" ",
"the",
" ",
"network",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"only",
" ",
"necessar",
"y",
" ",
"if",
" ",
"'",
"trap",
"ping",
"'",
"was",
" ",
"set",
" ",
"to",
" ",
"Tru",
"e",
" ",
"whe",
"n",
" ",
"setup",
" ",
"was",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"call",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"s",
" ",
":",
" ",
"array",
"\\u",
"like",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"array",
" ",
"of",
" ",
"pore",
" ",
"numbers",
" ",
"where",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"can",
" ",
"exit",
".",
" ",
" ",
"Any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"tha",
"t",
" ",
"doe",
"s",
" ",
"not",
" ",
"have",
" ",
"access",
" ",
"to",
" ",
"these",
" ",
"pore",
"s",
" ",
"will",
" ",
"be",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"trap",
"ped",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mode",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Control",
"s",
" ",
"how",
" ",
"the",
" ",
"new",
" ",
"values",
" ",
"are",
" ",
"handle",
"d",
".",
" ",
" ",
"Optio",
"ns",
" ",
"are",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"add",
"'**",
" ",
":",
" ",
"(",
"default",
")",
" ",
"Add",
"s",
" ",
"the",
" ",
"newl",
"y",
" ",
"recieve",
"d",
" ",
"location",
"s",
" ",
"to",
" ",
"any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exist",
"ing",
" ",
"location",
"s",
".",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"incremental",
"ly",
" ",
"addin",
"g",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"outlet",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"overwrit",
"e",
"'**",
" ",
":",
" ",
"Delete",
"s",
" ",
"any",
" ",
"presen",
"t",
" ",
"location",
"s",
" ",
"and",
" ",
"adds",
" ",
"new",
" ",
"ones",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"fix",
"ing",
" ",
"mist",
"ake",
"n",
" ",
"outlet",
"s",
",",
" ",
"or",
" ",
"rerun",
"ning",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"algo",
"rit",
"hm",
" ",
"with",
" ",
"different",
" ",
"outlet",
" ",
"location",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"remove",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"the",
" ",
"receive",
"d",
" ",
"location",
"s",
" ",
"from",
" ",
"the",
" ",
"list",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"outlet",
" ",
"pore",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"clear",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"the",
" ",
"exist",
"ing",
" ",
"outlet",
"s",
" ",
"and",
" ",
"ignores",
" ",
"any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"specified",
" ",
"location",
"s",
".",
" ",
"Thi",
"s",
" ",
"is",
" ",
"equivalent",
" ",
"to",
" ",
"calling",
" ",
"the",
" ",
"method",
" ",
"with",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"mode",
" ",
"of",
" ",
"'",
"overwrit",
"e",
"'",
" ",
"and",
" ",
"pore",
"s",
" ",
"=",
" ",
"[]",
" ",
"or",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"trap",
"ping_",
"is_",
"False_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"Sett",
"ing",
" ",
"outlet",
"s",
" ",
"is",
" ",
"meaning",
"less",
" ",
"unl",
"ess",
" ",
"trap",
"ping",
" ",
"'_",
"+_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"was",
" ",
"set",
" ",
"to",
" ",
"Tru",
"e",
" ",
"dur",
"ing",
" ",
"setup",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Ps_",
"=_",
"self_",
"._",
"\\u",
"parse",
"\\u",
"locations_",
"(_",
"pore",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"in_",
"[_",
"'",
"clear",
"'_",
",_",
"'",
"overwrit",
"e",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"sum_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
"[_",
"Ps_",
"]_",
")_",
">_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"Some",
" ",
"outlet",
"s",
" ",
"are",
" ",
"alr",
"ead",
"y",
" ",
"defin",
"ed",
" ",
"as",
" ",
"inlet",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"bool\\u",
"val_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"is_",
"'",
"remove",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bool\\u",
"val_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
"[_",
"Ps_",
"]_",
"=_",
"bool\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set\\u",
"residual_",
"(_",
"self_",
",_",
"pore",
"s_",
"=_",
"None_",
",_",
"thro",
"ats_",
"=_",
"None_",
",_",
"mode_",
"=_",
"'",
"add",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Speci",
"fy",
" ",
"location",
"s",
" ",
"of",
" ",
"the",
" ",
"residu",
"al",
" ",
"inva",
"ding",
" ",
"(",
"non",
"wet",
"ting",
")",
" ",
"phase",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"s",
" ",
"and",
" ",
"thro",
"ats",
" ",
":",
" ",
"array",
"\\u",
"like",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"pore",
" ",
"and",
" ",
"thro",
"at",
" ",
"location",
"s",
" ",
"tha",
"t",
" ",
"are",
" ",
"to",
" ",
"be",
" ",
"filled",
" ",
"with",
" ",
"inva",
"ding",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"phase",
" ",
"at",
" ",
"the",
" ",
"beginn",
"ing",
" ",
"of",
" ",
"the",
" ",
"simulati",
"on",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mode",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Control",
"s",
" ",
"how",
" ",
"the",
" ",
"new",
" ",
"values",
" ",
"are",
" ",
"handle",
"d",
".",
" ",
" ",
"Optio",
"ns",
" ",
"are",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"add",
"'**",
" ",
":",
" ",
"(",
"default",
")",
" ",
"Add",
"s",
" ",
"the",
" ",
"newl",
"y",
" ",
"recieve",
"d",
" ",
"location",
"s",
" ",
"to",
" ",
"any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exist",
"ing",
" ",
"location",
"s",
".",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"incremental",
"ly",
" ",
"addin",
"g",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"outlet",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"overwrit",
"e",
"'**",
" ",
":",
" ",
"Delete",
"s",
" ",
"any",
" ",
"presen",
"t",
" ",
"location",
"s",
" ",
"and",
" ",
"adds",
" ",
"new",
" ",
"ones",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"fix",
"ing",
" ",
"mist",
"ake",
"n",
" ",
"outlet",
"s",
",",
" ",
"or",
" ",
"rerun",
"ning",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"algo",
"rit",
"hm",
" ",
"with",
" ",
"different",
" ",
"outlet",
" ",
"location",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"remove",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"the",
" ",
"receive",
"d",
" ",
"location",
"s",
" ",
"from",
" ",
"the",
" ",
"list",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"residu",
"al",
" ",
"pore",
"s",
" ",
"and",
"/",
"or",
" ",
"thro",
"ats",
".",
" ",
" ",
"Bot",
"h",
" ",
"can",
" ",
"be",
" ",
"specified",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"simultaneous",
"ly",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"clear",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"all",
" ",
"exist",
"ing",
" ",
"residu",
"al",
" ",
"location",
"s",
".",
" ",
" ",
"Thi",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ignores",
" ",
"any",
" ",
"specified",
" ",
"location",
"s",
" ",
"and",
" ",
"is",
" ",
"equivalent",
" ",
"to",
" ",
"calling",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
" ",
"with",
" ",
"a",
" ",
"mode",
" ",
"of",
" ",
"'",
"overwrit",
"e",
"'",
" ",
"and",
" ",
"pore",
"s",
" ",
"=",
" ",
"[]",
" ",
"or",
" ",
"Non",
"e",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sett",
"ing",
" ",
"pore",
"s",
" ",
"as",
" ",
"initially",
" ",
"filled",
" ",
"only",
" ",
"affect",
"s",
" ",
"the",
" ",
"saturation",
" ",
"at",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"start",
" ",
"of",
" ",
"the",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"curve",
" ",
"sinc",
"e",
" ",
"pre",
"-",
"filled",
" ",
"pore",
"s",
" ",
"do",
" ",
"not",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"contribute",
" ",
"to",
" ",
"the",
" ",
"inva",
"sion",
" ",
"process",
".",
" ",
" ",
"Sett",
"ing",
" ",
"thro",
"ats",
" ",
"as",
" ",
"filled",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"how",
"ever",
",",
" ",
"has",
" ",
"a",
" ",
"significant",
" ",
"impact",
" ",
"on",
" ",
"the",
" ",
"subsequen",
"t",
" ",
"inva",
"sion",
" ",
"sinc",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"these",
" ",
"thro",
"ats",
" ",
"act",
" ",
"as",
" ",
"bridge",
"s",
" ",
"to",
" ",
"the",
" ",
"perc",
"ola",
"tion",
" ",
"process",
".",
" ",
" ",
"Of",
" ",
"course",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
"y",
" ",
"als",
"o",
" ",
"contribute",
" ",
"to",
" ",
"the",
" ",
"startin",
"g",
" ",
"saturation",
" ",
"as",
" ",
"well",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bool\\u",
"val_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"is_",
"'",
"clear",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"pore",
"s_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Ps_",
"=_",
"self_",
"._",
"\\u",
"parse",
"\\u",
"locations_",
"(_",
"pore",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"in_",
"[_",
"'",
"clear",
"'_",
",_",
"'",
"overwrit",
"e",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"mode_",
"is_",
"'",
"remove",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bool\\u",
"val_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
"[_",
"Ps_",
"]_",
"=_",
"bool\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"thro",
"ats_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Ts_",
"=_",
"self_",
"._",
"\\u",
"parse",
"\\u",
"locations_",
"(_",
"thro",
"ats_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"mode_",
"in_",
"[_",
"'",
"clear",
"'_",
",_",
"'",
"overwrit",
"e",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"mode_",
"is_",
"'",
"remove",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"bool\\u",
"val_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"[_",
"Ts_",
"]_",
"=_",
"bool\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set\\u",
"bound",
"ary",
"\\u",
"conditions_",
"(_",
"self_",
",_",
"bc",
"\\u",
"type_",
"=_",
"None_",
",_",
"pore",
"s_",
"=_",
"None_",
",_",
"thro",
"ats_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mode_",
"=_",
"'",
"add",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"bc",
"\\u",
"type",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"type",
" ",
"of",
" ",
"bound",
"ary",
" ",
"condition",
" ",
"to",
" ",
"appl",
"y",
".",
" ",
" ",
"Optio",
"ns",
" ",
"are",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"inlet",
"s",
"'**",
" ",
":",
" ",
"For",
" ",
"speci",
"fy",
"ing",
" ",
"where",
" ",
"inva",
"ding",
" ",
"phase",
" ",
"enter",
"s",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Network",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"outlet",
"s",
"'**",
" ",
":",
" ",
"For",
" ",
"speci",
"fy",
"ing",
" ",
"where",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"exits",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Network",
" ",
"if",
" ",
"trap",
"ping",
" ",
"is",
" ",
"to",
" ",
"be",
" ",
"consider",
"ed",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"residu",
"al",
"'**",
" ",
":",
" ",
"For",
" ",
"speci",
"fy",
"ing",
" ",
"the",
" ",
"pore",
" ",
"and",
" ",
"thro",
"at",
" ",
"location",
"s",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exist",
"ing",
" ",
"residu",
"al",
" ",
"inva",
"ding",
" ",
"phase",
" ",
"in",
" ",
"the",
" ",
"Network",
" ",
"at",
" ",
"the",
" ",
"start",
" ",
"of",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"drain",
"age",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"pore",
"s",
" ",
"and",
" ",
"thor",
"ats",
":",
" ",
"array",
"\\u",
"like",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"pore",
" ",
"(",
"and",
" ",
"thro",
"at",
")",
" ",
"location",
"s",
" ",
"where",
" ",
"the",
" ",
"specified",
" ",
"bound",
"ary",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"condition",
" ",
"is",
" ",
"to",
" ",
"be",
" ",
"applied",
".",
" ",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"the",
" ",
"'",
"thro",
"ats",
"'",
" ",
"argu",
"ment",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
" ",
"only",
" ",
"valid",
" ",
"for",
" ",
"setti",
"ng",
" ",
"'",
"residu",
"al",
"'",
" ",
"location",
"s",
",",
" ",
"sinc",
"e",
" ",
"'",
"inlet",
"s",
"'",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"outlet",
"s",
"'",
" ",
"location",
"s",
" ",
"can",
" ",
"only",
" ",
"be",
" ",
"pore",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mode",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Control",
"s",
" ",
"how",
" ",
"the",
" ",
"new",
" ",
"values",
" ",
"are",
" ",
"handle",
"d",
".",
" ",
" ",
"Optio",
"ns",
" ",
"are",
":",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"add",
"'**",
" ",
":",
" ",
"(",
"default",
")",
" ",
"Add",
"s",
" ",
"the",
" ",
"newl",
"y",
" ",
"recieve",
"d",
" ",
"location",
"s",
" ",
"to",
" ",
"any",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"exist",
"ing",
" ",
"location",
"s",
".",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"incremental",
"ly",
" ",
"addin",
"g",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"outlet",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"overwrit",
"e",
"'**",
" ",
":",
" ",
"Delete",
"s",
" ",
"any",
" ",
"presen",
"t",
" ",
"location",
"s",
" ",
"and",
" ",
"adds",
" ",
"new",
" ",
"ones",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"usef",
"ul",
" ",
"for",
" ",
"fix",
"ing",
" ",
"mist",
"ake",
"n",
" ",
"outlet",
"s",
",",
" ",
"or",
" ",
"rerun",
"ning",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"algo",
"rit",
"hm",
" ",
"with",
" ",
"different",
" ",
"outlet",
" ",
"location",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"remove",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"bound",
"ary",
" ",
"condition",
"s",
" ",
"of",
" ",
"the",
" ",
"specified",
" ",
"type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"from",
" ",
"the",
" ",
"give",
"n",
" ",
"location",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"**",
"'",
"clear",
"'**",
" ",
":",
" ",
"Remove",
"s",
" ",
"exist",
"ing",
" ",
"condition",
"s",
" ",
"of",
" ",
"the",
" ",
"specified",
" ",
"type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"and",
" ",
"ignores",
" ",
"any",
" ",
"specified",
" ",
"location",
"s",
".",
" ",
"If",
" ",
"'",
"bc",
"\\u",
"type",
"'",
" ",
"is",
" ",
"not",
" ",
"specified",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"then",
" ",
"all",
" ",
"condition",
"s",
" ",
"are",
" ",
"remove",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"bc",
"\\u",
"type_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"mode_",
"==_",
"'",
"clear",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'\\\\'",
"bc",
"\\u",
"type",
"\\\\'",
" ",
"cann",
"ot",
" ",
"be",
" ",
"Non",
"e",
" ",
"unl",
"ess",
" ",
"mode",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
" ",
"is",
" ",
"\\\\'",
"clear",
"\\\\''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"bc",
"\\u",
"type_",
"==_",
"'",
"residu",
"al",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"set\\u",
"residual_",
"(_",
"pore",
"s_",
"=_",
"pore",
"s_",
",_",
"thro",
"ats_",
"=_",
"thro",
"ats_",
",_",
"mode_",
"=_",
"mode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"bc",
"\\u",
"type_",
"==_",
"'",
"inlet",
"s",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"set\\u",
"inlet",
"s_",
"(_",
"pore",
"s_",
"=_",
"pore",
"s_",
",_",
"mode_",
"=_",
"mode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"bc",
"\\u",
"type_",
"==_",
"'",
"outlet",
"s",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"set\\u",
"outlet",
"s_",
"(_",
"pore",
"s_",
"=_",
"pore",
"s_",
",_",
"mode_",
"=_",
"mode_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"Unre",
"cogni",
"zed",
" ",
"\\\\'",
"bc",
"\\u",
"type",
"\\\\'",
" ",
"specified",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"run_",
"(_",
"self_",
",_",
"npts",
"_",
"=_",
"25_",
",_",
"inv",
"\\u",
"press",
"ures_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Run",
" ",
"the",
" ",
"algo",
"rit",
"hm",
" ",
"for",
" ",
"specified",
" ",
"number",
" ",
"of",
" ",
"points",
" ",
"or",
" ",
"at",
" ",
"give",
"n",
" ",
"capi",
"llar",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"press",
"ure",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"npts",
" ",
":",
" ",
"scala",
"r",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"number",
" ",
"of",
" ",
"points",
" ",
"to",
" ",
"obtain",
" ",
"on",
" ",
"the",
" ",
"curve",
".",
" ",
" ",
"The",
" ",
"points",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"automati",
"call",
"y",
" ",
"selecte",
"d",
" ",
"to",
" ",
"span",
" ",
"the",
" ",
"range",
" ",
"of",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"usi",
"ng",
" ",
"a",
" ",
"logar",
"ithm",
"ic",
" ",
"spaci",
"ng",
" ",
"(",
"more",
" ",
"points",
" ",
"are",
" ",
"lower",
" ",
"capi",
"llar",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"press",
"ure",
" ",
"values",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"inv",
"\\u",
"press",
"ure",
"s",
" ",
":",
" ",
"array",
"\\u",
"like",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"list",
" ",
"of",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
"s",
" ",
"to",
" ",
"appl",
"y",
".",
" ",
"List",
" ",
"shou",
"ld",
" ",
"contain",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"incr",
"easi",
"ng",
" ",
"and",
" ",
"unique",
" ",
"values",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"no",
" ",
"inva",
"sion",
" ",
"points",
" ",
"are",
" ",
"give",
"n",
" ",
"then",
" ",
"generat",
"e",
" ",
"some",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"inv",
"\\u",
"press",
"ures_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"info_",
"(_",
"'",
"Generat",
"ing",
" ",
"list",
" ",
"of",
" ",
"inva",
"sion",
" ",
"press",
"ure",
"s",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"min",
"\\u",
"p_",
"=_",
"sp_",
"._",
"amin_",
"(_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"entry",
"\\u",
"press",
"ure",
"'_",
"]_",
")_",
"*_",
"0.98",
"_",
"#",
" ",
"nud",
"ge",
" ",
"down_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"max",
"\\u",
"p_",
"=_",
"sp_",
"._",
"amax_",
"(_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"entry",
"\\u",
"press",
"ure",
"'_",
"]_",
")_",
"*_",
"1.02",
"_",
"#",
" ",
"bump",
" ",
"up_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"inv",
"\\u",
"points_",
"=_",
"sp_",
"._",
"logs",
"pace_",
"(_",
"sp_",
"._",
"log10_",
"(_",
"min",
"\\u",
"p_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sp_",
"._",
"log10_",
"(_",
"max",
"\\u",
"p_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"npts",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Make",
" ",
"sure",
" ",
"the",
" ",
"give",
"n",
" ",
"inva",
"sti",
"on",
" ",
"points",
" ",
"are",
" ",
"sensi",
"ble_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"inv",
"\\u",
"points_",
"=_",
"sp_",
"._",
"unique_",
"(_",
"inv",
"\\u",
"press",
"ures_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"points_",
"=_",
"inv",
"\\u",
"points_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ensur",
"e",
" ",
"inlet",
"s",
" ",
"are",
" ",
"set_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"sp_",
"._",
"sum_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"In",
"let",
" ",
"pore",
"s",
" ",
"have",
" ",
"not",
" ",
"bee",
"n",
" ",
"specified",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ensur",
"e",
" ",
"outlet",
" ",
"pore",
"s",
" ",
"are",
" ",
"set",
" ",
"if",
" ",
"trap",
"ping",
" ",
"is",
" ",
"enabled_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"trap",
"ping_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"sp_",
"._",
"sum_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
")_",
"==_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"Outl",
"et",
" ",
"pore",
"s",
" ",
"have",
" ",
"not",
" ",
"bee",
"n",
" ",
"specified",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Generate",
" ",
"curve",
" ",
"from",
" ",
"points_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"inv",
"\\u",
"val_",
"in_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"points_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Apply",
" ",
"one",
" ",
"applied",
" ",
"press",
"ure",
" ",
"and",
" ",
"dete",
"rmin",
"e",
" ",
"inva",
"ded",
" ",
"pore",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"info_",
"(_",
"'",
"Apply",
"ing",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
":",
" ",
"'_",
"+_",
"str_",
"(_",
"inv",
"\\u",
"val_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"appl",
"y",
"\\u",
"perc",
"ola",
"tion_",
"(_",
"inv",
"\\u",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"trap",
"ping_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"info_",
"(_",
"'",
"Check",
"ing",
" ",
"for",
" ",
"trap",
"ping",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"check",
"\\u",
"trap",
"ping_",
"(_",
"inv",
"\\u",
"val_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"inva",
"sion",
" ",
"sequence",
" ",
"values",
" ",
"(",
"to",
" ",
"correspond",
" ",
"with",
" ",
"IP",
" ",
"algo",
"rit",
"hm",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Pin",
"v_",
"=_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"seq",
"'_",
"]_",
"=_",
"sp_",
"._",
"searchs",
"orted_",
"(_",
"sp_",
"._",
"unique_",
"(_",
"Pin",
"v_",
")_",
",_",
"Pin",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Tin",
"v_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"seq",
"'_",
"]_",
"=_",
"sp_",
"._",
"searchs",
"orted_",
"(_",
"sp_",
"._",
"unique_",
"(_",
"Tin",
"v_",
")_",
",_",
"Tin",
"v_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"check",
"\\u",
"trap",
"ping_",
"(_",
"self_",
",_",
"inv",
"\\u",
"val_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Det",
"erm",
"ine",
" ",
"whi",
"ch",
" ",
"pore",
"s",
" ",
"and",
" ",
"thro",
"ats",
" ",
"are",
" ",
"trap",
"ped",
" ",
"by",
" ",
"inva",
"ding",
" ",
"phase",
".",
" ",
" ",
"Thi",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
" ",
"is",
" ",
"call",
"ed",
" ",
"by",
" ",
"``",
"run",
"``",
" ",
"if",
" ",
"'",
"trap",
"ping",
"'",
" ",
"is",
" ",
"set",
" ",
"to",
" ",
"Tru",
"e",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Generate",
" ",
"a",
" ",
"list",
" ",
"contain",
"ing",
" ",
"boolean",
" ",
"values",
" ",
"for",
" ",
"thro",
"at",
" ",
"state_",
"\\u\\u\\uNL\\u\\u\\u_",
"Tin",
"vad",
"ed_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"<_",
"sp_",
"._",
"inf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"residu",
"al",
" ",
"thro",
"ats",
",",
" ",
"if",
" ",
"any",
",",
" ",
"to",
" ",
"list",
" ",
"of",
" ",
"inva",
"ded",
" ",
"thro",
"ats_",
"\\u\\u\\uNL\\u\\u\\u_",
"Tin",
"vad",
"ed_",
"=_",
"Tin",
"vad",
"ed_",
"+_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Invert",
" ",
"logic",
" ",
"to",
" ",
"find",
" ",
"defend",
"ing",
" ",
"thro",
"ats_",
"\\u\\u\\uNL\\u\\u\\u_",
"Td",
"efe",
"nde",
"d_",
"=_",
"~_",
"Tin",
"vad",
"ed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[_",
"pcl",
"uste",
"rs_",
",_",
"tcl",
"uste",
"rs_",
"]_",
"=_",
"self_",
"._",
"\\u",
"net_",
"._",
"find",
"\\u",
"cluster",
"s2_",
"(_",
"mask_",
"=_",
"Td",
"efe",
"nde",
"d_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"t",
"\\u",
"labels_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"See",
" ",
"whi",
"ch",
" ",
"outlet",
" ",
"pore",
"s",
" ",
"rema",
"in",
" ",
"unin",
"vad",
"ed_",
"\\u\\u\\uNL\\u\\u\\u_",
"outlet",
"s_",
"=_",
"self_",
"[_",
"'",
"pore",
".",
"outlet",
"s",
"'_",
"]_",
"*_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"==_",
"sp_",
"._",
"inf_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Identif",
"y",
" ",
"cluster",
"s",
" ",
"connect",
"ed",
" ",
"to",
" ",
"rema",
"inin",
"g",
" ",
"outlet",
" ",
"sites_",
"\\u\\u\\uNL\\u\\u\\u_",
"def",
"\\u",
"clusters_",
"=_",
"sp_",
"._",
"unique_",
"(_",
"pcl",
"uste",
"rs_",
"[_",
"outlet",
"s_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"temp_",
"=_",
"sp_",
"._",
"in1",
"d_",
"(_",
"sp_",
"._",
"unique_",
"(_",
"pcl",
"uste",
"rs_",
")_",
",_",
"def",
"\\u",
"clusters_",
",_",
"invert_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"trap",
"ped",
"\\u",
"clusters_",
"=_",
"sp_",
"._",
"unique_",
"(_",
"pcl",
"uste",
"rs_",
")_",
"[_",
"temp_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"trap",
"ped",
"\\u",
"clusters_",
"=_",
"trap",
"ped",
"\\u",
"clusters_",
"[_",
"trap",
"ped",
"\\u",
"clusters_",
">=_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"defend",
"ing",
" ",
"cluster",
"s",
" ",
"NOT",
" ",
"connect",
"ed",
" ",
"to",
" ",
"the",
" ",
"outlet",
" ",
"pore",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"pma",
"sk_",
"=_",
"np_",
"._",
"in1",
"d_",
"(_",
"pcl",
"uste",
"rs_",
",_",
"trap",
"ped",
"\\u",
"clusters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"current",
" ",
"applied",
" ",
"press",
"ure",
" ",
"in",
" ",
"newl",
"y",
" ",
"trap",
"ped",
" ",
"pore",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"pin",
"ds_",
"=_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"trap",
"ped",
"'_",
"]_",
"==_",
"sp_",
"._",
"inf_",
")_",
"*_",
"(_",
"pma",
"sk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"trap",
"ped",
"'_",
"]_",
"[_",
"pin",
"ds_",
"]_",
"=_",
"inv",
"\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"thro",
"ats",
" ",
"on",
" ",
"the",
" ",
"trap",
"ped",
" ",
"defend",
"ing",
" ",
"clusters_",
"\\u\\u\\uNL\\u\\u\\u_",
"tin",
"ds_",
"=_",
"self_",
"._",
"\\u",
"net_",
"._",
"find",
"\\u",
"neighbor",
"\\u",
"thro",
"ats_",
"(_",
"pore",
"s_",
"=_",
"pin",
"ds_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"mode_",
"=_",
"'",
"intersect",
"ion",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"trap",
"ped",
"'_",
"]_",
"[_",
"tin",
"ds_",
"]_",
"=_",
"inv",
"\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"entry",
"\\u",
"press",
"ure",
"'_",
"]_",
"[_",
"tin",
"ds_",
"]_",
"=_",
"1000000_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"appl",
"y",
"\\u",
"perc",
"ola",
"tion_",
"(_",
"self_",
",_",
"inv",
"\\u",
"val_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Det",
"erm",
"ine",
" ",
"whi",
"ch",
" ",
"pore",
"s",
" ",
"and",
" ",
"thro",
"ats",
" ",
"are",
" ",
"inva",
"ded",
" ",
"at",
" ",
"a",
" ",
"give",
"n",
" ",
"applied",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
".",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"is",
" ",
"call",
"ed",
" ",
"by",
" ",
"``",
"run",
"``.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Generate",
" ",
"a",
" ",
"list",
" ",
"contain",
"ing",
" ",
"boolean",
" ",
"values",
" ",
"for",
" ",
"thro",
"at",
" ",
"state_",
"\\u\\u\\uNL\\u\\u\\u_",
"Tin",
"vad",
"ed_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"entry",
"\\u",
"press",
"ure",
"'_",
"]_",
"<=_",
"inv",
"\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"residu",
"al",
" ",
"thro",
"ats",
",",
" ",
"if",
" ",
"any",
",",
" ",
"to",
" ",
"list",
" ",
"of",
" ",
"inva",
"ded",
" ",
"thro",
"ats_",
"\\u\\u\\uNL\\u\\u\\u_",
"Tin",
"vad",
"ed_",
"=_",
"Tin",
"vad",
"ed_",
"+_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"all",
" ",
"pore",
"s",
" ",
"tha",
"t",
" ",
"can",
" ",
"be",
" ",
"inva",
"ded",
" ",
"at",
" ",
"specified",
" ",
"pressure_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"pcl",
"uste",
"rs_",
",_",
"tcl",
"uste",
"rs_",
"]_",
"=_",
"self_",
"._",
"\\u",
"net_",
"._",
"find",
"\\u",
"cluster",
"s2_",
"(_",
"mask_",
"=_",
"Tin",
"vad",
"ed_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"t",
"\\u",
"labels_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Identif",
"y",
" ",
"cluster",
"s",
" ",
"connect",
"ed",
" ",
"to",
" ",
"inlet",
" ",
"sites_",
"\\u\\u\\uNL\\u\\u\\u_",
"inv",
"\\u",
"clusters_",
"=_",
"sp_",
"._",
"unique_",
"(_",
"pcl",
"uste",
"rs_",
"[_",
"self_",
"[_",
"'",
"pore",
".",
"inlet",
"s",
"'_",
"]_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"inv",
"\\u",
"clusters_",
"=_",
"inv",
"\\u",
"clusters_",
"[_",
"inv",
"\\u",
"clusters_",
">=_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"pore",
"s",
" ",
"on",
" ",
"the",
" ",
"inva",
"ding",
" ",
"clusters_",
"\\u\\u\\uNL\\u\\u\\u_",
"pma",
"sk_",
"=_",
"np_",
"._",
"in1",
"d_",
"(_",
"pcl",
"uste",
"rs_",
",_",
"inv",
"\\u",
"clusters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"current",
" ",
"applied",
" ",
"press",
"ure",
" ",
"in",
" ",
"newl",
"y",
" ",
"inva",
"ded",
" ",
"pore",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"pin",
"ds_",
"=_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"==_",
"sp_",
"._",
"inf_",
")_",
"*_",
"(_",
"pma",
"sk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"[_",
"pin",
"ds_",
"]_",
"=_",
"inv",
"\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"thro",
"ats",
" ",
"on",
" ",
"the",
" ",
"inva",
"ding",
" ",
"clusters_",
"\\u\\u\\uNL\\u\\u\\u_",
"tma",
"sk_",
"=_",
"np_",
"._",
"in1",
"d_",
"(_",
"tcl",
"uste",
"rs_",
",_",
"inv",
"\\u",
"clusters_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Stor",
"e",
" ",
"current",
" ",
"applied",
" ",
"press",
"ure",
" ",
"in",
" ",
"newl",
"y",
" ",
"inva",
"ded",
" ",
"thro",
"ats_",
"\\u\\u\\uNL\\u\\u\\u_",
"tin",
"ds_",
"=_",
"(_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"==_",
"sp_",
"._",
"inf_",
")_",
"*_",
"(_",
"tma",
"sk_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"[_",
"tin",
"ds_",
"]_",
"=_",
"inv",
"\\u",
"val_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"residu",
"al",
" ",
"pore",
"s",
" ",
"and",
" ",
"thro",
"ats",
",",
" ",
"if",
" ",
"any",
",",
" ",
"to",
" ",
"inva",
"ded",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"sp_",
"._",
"any_",
"(_",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"[_",
"self_",
"[_",
"'",
"pore",
".",
"residu",
"al",
"'_",
"]_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"sp_",
"._",
"any_",
"(_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"[_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"residu",
"al",
"'_",
"]_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"drain",
"age",
"\\u",
"data_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Obtain",
" ",
"the",
" ",
"numerical",
" ",
"values",
" ",
"of",
" ",
"the",
" ",
"result",
"ant",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"curve",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Non",
"e",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"A",
" ",
"dictionar",
"y",
" ",
"contain",
"ing",
" ",
"arrays",
" ",
"of",
" ",
"applied",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
"s",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"vari",
"ous",
" ",
"phase",
" ",
"saturation",
"s",
".",
" ",
" ",
"The",
" ",
"dictionar",
"y",
" ",
"keys",
" ",
"explain",
" ",
"the",
" ",
"content",
" ",
"of",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"each",
" ",
"array",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"assume",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"pore",
" ",
"and",
" ",
"thro",
"at",
" ",
"volume",
"s",
" ",
"are",
" ",
"store",
"d",
" ",
"under",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"keys",
" ",
"'",
"pore",
".",
"volume",
"'",
" ",
"and",
" ",
"'",
"thro",
"at",
".",
"volume",
"'.",
" ",
" ",
"Thi",
"s",
" ",
"cann",
"ot",
" ",
"be",
" ",
"customize",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"at",
" ",
"this",
" ",
"time",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Infer",
" ",
"list",
" ",
"of",
" ",
"applied",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ures_",
"\\u\\u\\uNL\\u\\u\\u_",
"Pc",
"Points_",
"=_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"points_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"Pc",
"Points_",
"[_",
"-_",
"1_",
"]_",
"==_",
"sp_",
"._",
"inf_",
":_",
"#",
" ",
"Remove",
" ",
"infinity",
" ",
"from",
" ",
"Pc",
"Point",
"s",
" ",
"if",
" ",
"present_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Pc",
"Points_",
"=_",
"Pc",
"Points_",
"[_",
":_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"pore",
" ",
"and",
" ",
"thro",
"at",
" ",
"volumes_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Pv",
"ol_",
"=_",
"self_",
"._",
"\\u",
"net_",
"[_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"volume_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Tv",
"ol_",
"=_",
"self_",
"._",
"\\u",
"net_",
"[_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"volume_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Total",
"\\u",
"vol_",
"=_",
"sp_",
"._",
"sum_",
"(_",
"Pv",
"ol_",
")_",
"+_",
"sp_",
"._",
"sum_",
"(_",
"Tv",
"ol_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"cumul",
"ative",
" ",
"filled",
" ",
"volume",
" ",
"at",
" ",
"each",
" ",
"applied",
" ",
"capi",
"llar",
"y",
" ",
"pressure_",
"\\u\\u\\uNL\\u\\u\\u_",
"Vn",
"wp",
"\\u",
"t_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Vn",
"wp",
"\\u",
"p_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Vn",
"wp",
"\\u",
"all_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"Pc",
"_",
"in_",
"Pc",
"Points_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Calculat",
"e",
" ",
"filled",
" ",
"pore",
" ",
"volumes_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"p",
"\\u",
"inv_",
"=_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"<=_",
"Pc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"filling",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Vp",
"_",
"=_",
"sp_",
"._",
"sum_",
"(_",
"Pv",
"ol_",
"[_",
"p",
"\\u",
"inv_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Vp",
"_",
"=_",
"self_",
"._",
"\\u",
"calc",
"\\u",
"fractional",
"\\u",
"filling",
"_",
"(_",
"pressure_",
"=_",
"Pc",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"element_",
"=_",
"'",
"pore",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Vp",
"_",
"=_",
"sp_",
"._",
"sum_",
"(_",
"Vp",
"_",
"[_",
"p",
"\\u",
"inv_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Calculat",
"e",
" ",
"filled",
" ",
"thro",
"at",
" ",
"volumes_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"t",
"\\u",
"inv_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"<=_",
"Pc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"filling",
"_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Vt",
"_",
"=_",
"sp_",
"._",
"sum_",
"(_",
"Tv",
"ol_",
"[_",
"t",
"\\u",
"inv_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Vt",
"_",
"=_",
"self_",
"._",
"\\u",
"calc",
"\\u",
"fractional",
"\\u",
"filling",
"_",
"(_",
"pressure_",
"=_",
"Pc",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"element_",
"=_",
"'",
"thro",
"at",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Vt",
"_",
"=_",
"sp_",
"._",
"sum_",
"(_",
"Vt",
"_",
"[_",
"t",
"\\u",
"inv_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Vn",
"wp",
"\\u",
"p_",
"._",
"append_",
"(_",
"Vp",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Vn",
"wp",
"\\u",
"t_",
"._",
"append_",
"(_",
"Vt",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Vn",
"wp",
"\\u",
"all_",
"._",
"append_",
"(_",
"Vp",
"_",
"+_",
"Vt",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Convert",
" ",
"volume",
"s",
" ",
"to",
" ",
"saturation",
"s",
" ",
"by",
" ",
"normali",
"zin",
"g",
" ",
"with",
" ",
"total",
" ",
"pore",
" ",
"volume_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Sn",
"wp",
"\\u",
"all_",
"=_",
"[_",
"V_",
"/_",
"Total",
"\\u",
"vol_",
"for_",
"V_",
"in_",
"Vn",
"wp",
"\\u",
"all_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"[_",
"'",
"capi",
"llar",
"y",
"\\u",
"press",
"ure",
"'_",
"]_",
"=_",
"Pc",
"Points_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"[_",
"'",
"inva",
"ding",
"\\u",
"phase",
"\\u",
"saturation",
"'_",
"]_",
"=_",
"Sn",
"wp",
"\\u",
"all_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"data_",
"[_",
"'",
"defend",
"ing",
"\\u",
"phase",
"\\u",
"saturation",
"'_",
"]_",
"=_",
"[_",
"1_",
"-_",
"s_",
"for_",
"s_",
"in_",
"Sn",
"wp",
"\\u",
"all_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"calc",
"\\u",
"fractional",
"\\u",
"filling",
"_",
"(_",
"self_",
",_",
"element_",
",_",
"pressure_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Calculat",
"es",
" ",
"the",
" ",
"fractional",
" ",
"filling",
" ",
"of",
" ",
"each",
" ",
"pore",
" ",
"or",
" ",
"thro",
"at",
" ",
"as",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"supplie",
"d",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"element",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Can",
" ",
"eit",
"her",
" ",
"be",
" ",
"'",
"pore",
"'",
" ",
"or",
" ",
"'",
"thro",
"at",
"'",
" ",
"indicati",
"ng",
" ",
"whi",
"ch",
" ",
"type",
" ",
"of",
" ",
"element",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"be",
" ",
"calculated",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"press",
"ure",
" ",
":",
" ",
"float",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"value",
" ",
"of",
" ",
"the",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"to",
" ",
"appl",
"y",
".",
" ",
" ",
"Thi",
"s",
" ",
"value",
" ",
"is",
" ",
"sent",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"to",
" ",
"Phys",
"ics",
" ",
"model",
" ",
"store",
"d",
" ",
"in",
" ",
"the",
" ",
"``",
"\\u",
"pore",
"(",
"thro",
"at",
")\\u",
"filling",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"attribute",
" ",
"of",
" ",
"the",
" ",
"object",
".",
" ",
" ",
"Thi",
"s",
" ",
"attribute",
" ",
"is",
" ",
"set",
" ",
"dur",
"ing",
" ",
"the",
" ",
"call",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"``",
"get",
"\\u",
"drain",
"age",
"\\u",
"data",
"``.",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"'",
"pore",
"(",
"thro",
"at",
")\\u",
"filling",
"'",
" ",
"model",
" ",
"must",
" ",
"accept",
" ",
"the",
" ",
"applied",
" ",
"capi",
"llar",
"y",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"press",
"ure",
" ",
"as",
" ",
"'",
"Pc",
"'.",
" ",
" ",
"Thi",
"s",
" ",
"is",
" ",
"not",
" ",
"customi",
"zab",
"le",
" ",
"at",
" ",
"the",
" ",
"moment",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"element_",
"==_",
"'",
"pore",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"filling",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vol_",
"=_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"volume_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"element_",
"==_",
"'",
"thro",
"at",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key_",
"=_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"filling",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"vol_",
"=_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"volume_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Exception_",
"(_",
"'",
"element",
" ",
"must",
" ",
"be",
" ",
"eit",
"her",
" ",
"\\\\'",
"pore",
"\\\\'",
" ",
"or",
" ",
"\\\\'",
"thro",
"at",
"\\\\''_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"Sn",
"wp_",
"=_",
"sp_",
"._",
"zeros_",
"(_",
"(_",
"self_",
"._",
"\\u",
"count_",
"(_",
"element_",
")_",
",_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"phys",
"_",
"in_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"._",
"\\u",
"physics_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"Phys",
"ics",
" ",
"model",
" ",
"with",
" ",
"current",
" ",
"Pc",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"temp",
"\\u",
"Pc",
"_",
"=_",
"phys",
"_",
"._",
"models_",
"[_",
"key_",
"]_",
"[_",
"'",
"Pc",
"'_",
"]_",
"#",
" ",
"Stor",
"e",
" ",
"old",
" ",
"Pc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"phys",
"_",
"._",
"models_",
"[_",
"key_",
"]_",
"[_",
"'",
"Pc",
"'_",
"]_",
"=_",
"pressure_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Rege",
"nera",
"te",
" ",
"Phys",
"ics",
" ",
"model",
" ",
"and",
" ",
"captur",
"e",
" ",
"output",
" ",
"local",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"Sn",
"wp_",
"[_",
"phys",
"_",
"._",
"Pn",
"et_",
"]_",
"=_",
"phys",
"_",
"._",
"models_",
"[_",
"key_",
"]_",
"._",
"run_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Re",
"-",
"populate",
" ",
"the",
" ",
"residu",
"al",
" ",
"element",
" ",
"with",
" ",
"the",
" ",
"non",
"-",
"wet",
"ting",
" ",
"phase_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"sp_",
"._",
"any_",
"(_",
"self_",
"[_",
"element_",
"+_",
"'.",
"residu",
"al",
"'_",
"]_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Sn",
"wp_",
"[_",
"self_",
"[_",
"element_",
"+_",
"'.",
"residu",
"al",
"'_",
"]_",
"]_",
"=_",
"1.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"phys",
"_",
"._",
"models_",
"[_",
"key_",
"]_",
"[_",
"'",
"Pc",
"'_",
"]_",
"=_",
"temp",
"\\u",
"Pc",
"_",
"#",
" ",
"Return",
" ",
"old",
" ",
"Pc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"V_",
"=_",
"self_",
"._",
"\\u",
"net_",
"[_",
"vol_",
"]_",
"*_",
"Sn",
"wp_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"V_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"plot",
"\\u",
"drain",
"age",
"\\u",
"curve_",
"(_",
"self_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"data_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"x",
"\\u",
"values_",
"=_",
"'",
"capi",
"llar",
"y",
"\\u",
"press",
"ure",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"y",
"\\u",
"values_",
"=_",
"'",
"inva",
"ding",
"\\u",
"phase",
"\\u",
"saturation",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Plot",
" ",
"the",
" ",
"drain",
"age",
" ",
"curve",
" ",
"as",
" ",
"the",
" ",
"non",
"-",
"wet",
"ting",
" ",
"phase",
" ",
"saturation",
" ",
"vs",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"applied",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"data",
" ",
":",
" ",
"dictionar",
"y",
" ",
"of",
" ",
"arrays",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"dictionar",
"y",
" ",
"shou",
"ld",
" ",
"be",
" ",
"obtain",
"ed",
" ",
"from",
" ",
"the",
" ",
"``",
"get",
"\\u",
"drain",
"age",
"\\u",
"data",
"``",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"method",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"x",
"\\u",
"values",
" ",
"and",
" ",
"y",
"\\u",
"values",
" ",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"dictionar",
"y",
" ",
"keys",
" ",
"of",
" ",
"the",
" ",
"arrays",
" ",
"contain",
"ing",
" ",
"the",
" ",
"x",
"-",
"values",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"y",
"-",
"values",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Begin",
" ",
"creati",
"ng",
" ",
"nice",
"ly",
" ",
"format",
"ted",
" ",
"plot_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"data_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"data_",
"=_",
"self_",
"._",
"get",
"\\u",
"drain",
"age",
"\\u",
"data_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"xdata_",
"=_",
"data_",
"[_",
"x",
"\\u",
"values_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ydata_",
"=_",
"data_",
"[_",
"y",
"\\u",
"values_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fig_",
"=_",
"plt_",
"._",
"figure_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"plot_",
"(_",
"xdata_",
",_",
"ydata_",
",_",
"'",
"ko",
"-'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"ylabel_",
"(_",
"y",
"\\u",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"xlabel_",
"(_",
"x",
"\\u",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"plt_",
"._",
"grid_",
"(_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"sp_",
"._",
"amax_",
"(_",
"xdata_",
")_",
"<=_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plt_",
"._",
"xlim_",
"(_",
"xmin_",
"=_",
"0_",
",_",
"xmax_",
"=_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"sp_",
"._",
"amax_",
"(_",
"ydata_",
")_",
"<=_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"plt_",
"._",
"ylim_",
"(_",
"ymin_",
"=_",
"0_",
",_",
"ymax_",
"=_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"fig_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Drain",
"age_",
"(_",
"Gene",
"ric",
"Algorithm_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"return",
"\\u",
"results_",
"(_",
"self_",
",_",
"Pc",
"_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"dete",
"rmin",
"es",
" ",
"whi",
"ch",
" ",
"pore",
"s",
" ",
"and",
" ",
"thro",
"ats",
" ",
"are",
" ",
"filled",
" ",
"with",
" ",
"non",
"-",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"wet",
"ting",
" ",
"phase",
" ",
"at",
" ",
"the",
" ",
"specified",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
",",
" ",
"and",
" ",
"create",
"s",
" ",
"or",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"update",
"s",
" ",
"'",
"pore",
".",
"occupancy",
"'",
" ",
"and",
" ",
"'",
"thro",
"at",
".",
"occupancy",
"'",
" ",
"arrays",
" ",
"on",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"associate",
"d",
" ",
"Phase",
" ",
"object",
"s",
".",
" ",
"Inva",
"sion",
" ",
"press",
"ure",
" ",
"and",
" ",
"sequence",
" ",
"are",
" ",
"als",
"o",
" ",
"sent",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"to",
" ",
"the",
" ",
"inva",
"ding",
" ",
"phase",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Pc",
" ",
":",
" ",
"scala",
"r",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"capi",
"llar",
"y",
" ",
"press",
"ure",
" ",
"for",
" ",
"whi",
"ch",
" ",
"an",
" ",
"inva",
"ding",
" ",
"phase",
" ",
"configura",
"tion",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"require",
"d",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-------",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Not",
"es",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"-----",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"Phase",
" ",
"object",
" ",
"tha",
"t",
" ",
"receive",
"s",
" ",
"the",
" ",
"update",
"d",
" ",
"occupancy",
" ",
"arrays",
" ",
"is",
" ",
"the",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"one",
" ",
"tha",
"t",
" ",
"was",
" ",
"specified",
" ",
"as",
" ",
"the",
" ",
"'",
"inva",
"ding",
"\\u",
"phase",
"'",
" ",
"whe",
"n",
" ",
"``",
"setup",
"``",
" ",
"was",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"call",
"ed",
".",
" ",
"The",
" ",
"defend",
"ing",
" ",
"phase",
" ",
"has",
" ",
"the",
" ",
"opposite",
" ",
"occupancy",
" ",
"values",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"partial",
" ",
"occupancy",
" ",
"so",
" ",
"tha",
"t",
" ",
"summ",
"ing",
" ",
"occupancy",
" ",
"for",
" ",
"bot",
"h",
" ",
"phase",
"s",
" ",
"equals",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"1.0",
" ",
"for",
" ",
"every",
" ",
"pore",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Ps",
"at",
"n_",
"=_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"<=_",
"Pc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Ts",
"at",
"n_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"<=_",
"Pc",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"occupancy",
"'_",
"]_",
"=_",
"sp_",
"._",
"array_",
"(_",
"Ps",
"at",
"n_",
",_",
"dtype_",
"=_",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"occupancy",
"'_",
"]_",
"=_",
"sp_",
"._",
"array_",
"(_",
"Ts",
"at",
"n_",
",_",
"dtype_",
"=_",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"def",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"occupancy",
"'_",
"]_",
"=_",
"sp_",
"._",
"array_",
"(_",
"~_",
"Ps",
"at",
"n_",
",_",
"dtype_",
"=_",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"def",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"occupancy",
"'_",
"]_",
"=_",
"sp_",
"._",
"array_",
"(_",
"~_",
"Ts",
"at",
"n_",
",_",
"dtype_",
"=_",
"float_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"=_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"seq",
"'_",
"]_",
"=_",
"self_",
"[_",
"'",
"pore",
".",
"inv",
"\\u",
"seq",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"Pc",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"seq",
"'_",
"]_",
"=_",
"self_",
"[_",
"'",
"thro",
"at",
".",
"inv",
"\\u",
"seq",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"filling",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Vp",
"_",
"=_",
"self_",
"._",
"\\u",
"calc",
"\\u",
"fractional",
"\\u",
"filling",
"_",
"(_",
"element_",
"=_",
"'",
"pore",
"'_",
",_",
"pressure_",
"=_",
"Pc",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Sp",
"_",
"=_",
"Vp",
"_",
"/_",
"self_",
"._",
"\\u",
"net_",
"[_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"volume_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"For",
" ",
"pore",
"s",
" ",
"tha",
"t",
" ",
"have",
" ",
"zero",
" ",
"volume",
" ",
"(",
"i",
".",
"e",
".",
" ",
"bound",
"ary",
" ",
"pore",
"s",
" ",
"in",
" ",
"some",
" ",
"case",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fractional",
" ",
"filling",
" ",
"is",
" ",
"meaning",
"less",
" ",
"so",
" ",
"use",
" ",
"the",
" ",
"standard",
" ",
"occupancy",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"zero",
"\\u",
"ps_",
"=_",
"self_",
"._",
"\\u",
"net_",
"[_",
"self_",
"._",
"\\u",
"pore",
"\\u",
"volume_",
"]_",
"==_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Sp",
"_",
"[_",
"zero",
"\\u",
"ps_",
"]_",
"=_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"occupancy",
"'_",
"]_",
"[_",
"zero",
"\\u",
"ps_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"partial",
"\\u",
"occupancy",
"'_",
"]_",
"=_",
"Sp",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"def",
"\\u",
"phase_",
"[_",
"'",
"pore",
".",
"partial",
"\\u",
"occupancy",
"'_",
"]_",
"=_",
"1_",
"-_",
"Sp",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"filling",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"Vt",
"_",
"=_",
"self_",
"._",
"\\u",
"calc",
"\\u",
"fractional",
"\\u",
"filling",
"_",
"(_",
"element_",
"=_",
"'",
"thro",
"at",
"'_",
",_",
"pressure_",
"=_",
"Pc",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"St",
"_",
"=_",
"Vt",
"_",
"/_",
"self_",
"._",
"\\u",
"net_",
"[_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"volume_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"For",
" ",
"thro",
"ats",
" ",
"tha",
"t",
" ",
"have",
" ",
"zero",
" ",
"volume",
" ",
"(",
"i",
".",
"e",
".",
" ",
"bound",
"ary",
" ",
"thro",
"ats",
" ",
"in",
" ",
"some",
" ",
"case",
"s",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"fractional",
" ",
"filling",
" ",
"is",
" ",
"meaning",
"less",
" ",
"so",
" ",
"use",
" ",
"the",
" ",
"standard",
" ",
"occupancy",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"zero",
"\\u",
"ts_",
"=_",
"self_",
"._",
"\\u",
"net_",
"[_",
"self_",
"._",
"\\u",
"thro",
"at",
"\\u",
"volume_",
"]_",
"==_",
"0.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"St",
"_",
"[_",
"zero",
"\\u",
"ts_",
"]_",
"=_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"occupancy",
"'_",
"]_",
"[_",
"zero",
"\\u",
"ts_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"inv",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"partial",
"\\u",
"occupancy",
"'_",
"]_",
"=_",
"St",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"def",
"\\u",
"phase_",
"[_",
"'",
"thro",
"at",
".",
"partial",
"\\u",
"occupancy",
"'_",
"]_",
"=_",
"1_",
"-_",
"St",
"_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Missing call to `__init__` during object initialization | soccermetrics/soccermetrics-client-py/soccermetrics/rest/resources/match.py | [
{
"content": " def __init__(self, play, base_uri, auth):\n \"\"\"\n Constructor of MatchResource class.\n\n :param play: Type of teams playing in matches.\n :type play: string\n :param base_uri: Base URI of API.\n :type base_uri: string\n :param auth: Authentication credential.\n :type auth: tuple\n \"\"\"\n super(MatchResource, self).__init__(base_uri,auth)\n\n self.base_endpoint = \"%s/%s/matches\" % (self.endpoint, play)\n self.match = None\n self.resource = None",
"metadata": "root.MatchResource.__init__",
"header": "['class', 'MatchResource', '(', 'Resource', ')', ':', '___EOS___']",
"index": 13
},
{
"content": "class MatchShootouts(MatchResource):\n \"\"\"\n Access to Match Shootouts resources (/<play>/matches/shootouts resource).\n\n Derived from :class:`MatchResource`.\n \"\"\"",
"metadata": "root.MatchShootouts",
"header": "['module', '___EOS___']",
"index": 165
},
{
"content": " def __init__(self, play, base_uri, auth):\n super(MatchShootouts, self).__init__(play, base_uri, auth)\n self.resource = \"shootouts\"",
"metadata": "root.MatchShootouts.__init__",
"header": "['class', 'MatchShootouts', '(', 'MatchResource', ')', ':', '___EOS___']",
"index": 171
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Missing",
"_",
"call_",
"to_",
" _",
"`_",
"\\u\\u",
"init\\u\\u_",
"`_",
"dur",
"ing_",
"object_",
"initialization",
"_",
"[SEP]_",
"class_",
"Match",
"Resource_",
"(_",
"Resource_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"play_",
",_",
"base",
"\\u",
"uri_",
",_",
"auth_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Constructor",
" ",
"of",
" ",
"Match",
"Reso",
"urc",
"e",
" ",
"class",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"play",
":",
" ",
"Type",
" ",
"of",
" ",
"team",
"s",
" ",
"play",
"ing",
" ",
"in",
" ",
"matche",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"play",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"base",
"\\u",
"uri",
":",
" ",
"Base",
" ",
"URI",
" ",
"of",
" ",
"API",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"base",
"\\u",
"uri",
":",
" ",
"string",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"auth",
":",
" ",
"Auth",
"entica",
"tion",
" ",
"cred",
"ential",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"type",
" ",
"auth",
":",
" ",
"tuple",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"Match",
"Resource_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"base",
"\\u",
"uri_",
",_",
"auth_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"base",
"\\u",
"endpoint_",
"=_",
"\"%",
"s",
"/",
"%",
"s",
"/",
"matche",
"s",
"\"_",
"%_",
"(_",
"self_",
"._",
"endpoint_",
",_",
"play_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"match_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"resource_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Match",
"Sho",
"oto",
"uts",
"_",
"(_",
"Match",
"Resource_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Access",
" ",
"to",
" ",
"Match",
" ",
"Sho",
"oto",
"uts",
" ",
"resource",
"s",
" ",
"(/",
"<",
"play",
">/",
"matche",
"s",
"/",
"shoot",
"outs",
" ",
"resource",
").",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Derive",
"d",
" ",
"from",
" ",
":",
"class",
":`",
"Match",
"Reso",
"urc",
"e",
"`.",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Match",
"Sho",
"oto",
"uts",
"_",
"(_",
"Match",
"Resource_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"play_",
",_",
"base",
"\\u",
"uri_",
",_",
"auth_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Match",
"Sho",
"oto",
"uts",
"_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"play_",
",_",
"base",
"\\u",
"uri_",
",_",
"auth_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"resource_",
"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2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | captin411/ofxclient/tests/secure_config.py | [
{
"content": "try:\n from configparser import ConfigParser, NoOptionError\nexcept ImportError:\n from ConfigParser import ConfigParser, NoOptionError\nimport unittest\n\nfrom ofxclient.config import SecurableConfigParser\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def makeConfig(keyring_available=True, **kwargs):\n conf = None\n conf = SecurableConfigParser(keyring_available=keyring_available, **kwargs)\n conf.add_section('section1')\n conf.add_section('section2')\n conf.set('section1', 'username', 'USERNAME')\n conf.set_secure('section1', 'password', 'PASSWORD')\n conf.set('section2', 'question', 'answer')\n conf.set_secure('section2', 'ssn', '111-11-1111')\n return conf",
"metadata": "root.makeConfig",
"header": "['module', '___EOS___']",
"index": 9
},
{
"content": "class IdentifySecureOptionTests(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n pass",
"metadata": "root.IdentifySecureOptionTests",
"header": "['module', '___EOS___']",
"index": 21
},
{
"content": " def testIsSecureOption(self):\n c = makeConfig()\n self.assertTrue(c.is_secure_option('section1', 'password'))\n self.assertTrue(c.is_secure_option('section2', 'ssn'))\n self.assertFalse(c.is_secure_option('section1', 'username'))\n self.assertFalse(c.is_secure_option('section2', 'question'))",
"metadata": "root.IdentifySecureOptionTests.testIsSecureOption",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 23
},
{
"content": " def testStaysSecure(self):\n c = makeConfig()\n self.assertTrue(c.is_secure_option('section1', 'password'))\n c.set('section1', 'password', 'MYPASS')\n self.assertTrue(c.is_secure_option('section1', 'password'))",
"metadata": "root.IdentifySecureOptionTests.testStaysSecure",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 30
},
{
"content": " def testStaysUnsecure(self):\n c = makeConfig()\n self.assertFalse(c.is_secure_option('section1', 'username'))\n c.set('section1', 'username', 'MYUSER')\n self.assertFalse(c.is_secure_option('section1', 'username'))",
"metadata": "root.IdentifySecureOptionTests.testStaysUnsecure",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 36
},
{
"content": " def testSetThenSetSecureTurnsSecure(self):\n c = makeConfig()\n c.set('section1', 'foo', 'bar')\n self.assertFalse(c.is_secure_option('section1', 'foo'))\n c.set_secure('section1', 'foo', 'bar')\n self.assertTrue(c.is_secure_option('section1', 'foo'))\n c.set('section1', 'foo', 'bar')\n self.assertTrue(c.is_secure_option('section1', 'foo'))",
"metadata": "root.IdentifySecureOptionTests.testSetThenSetSecureTurnsSecure",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 42
},
{
"content": " def testItemsHavePasswords(self):\n c = makeConfig()\n items = sorted(c.items('section1'))\n self.assertEqual(\n items,\n [('password', 'PASSWORD'), ('username', 'USERNAME')]\n )\n self.assertEqual(len(items), 2)",
"metadata": "root.IdentifySecureOptionTests.testItemsHavePasswords",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 51
},
{
"content": " def testSecureItems(self):\n c = makeConfig()\n items = sorted(c.secure_items('section1'))\n self.assertEqual(items, [('password', 'PASSWORD')])\n self.assertEqual(len(items), 1)\n c.remove_option('section1', 'password')\n items = sorted(c.secure_items('section1'))\n self.assertEqual(len(items), 0)",
"metadata": "root.IdentifySecureOptionTests.testSecureItems",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 60
},
{
"content": " def testGet(self):\n c = makeConfig()\n self.assertEqual(c.get('section1', 'password'), 'PASSWORD')\n self.assertNotEqual(\n ConfigParser.get(c, 'section1', 'password'),\n 'PASSWORD'\n )\n self.assertEqual(c.get('section1', 'username'), 'USERNAME')\n c.remove_option('section1', 'password')\n self.assertRaises(NoOptionError, c.get, 'section1', 'password')",
"metadata": "root.IdentifySecureOptionTests.testGet",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 69
},
{
"content": " def testUnsavedOptions(self):\n c = makeConfig()\n s_option = \"%s%s\" % ('section1', 'foo2')\n\n c.set('section1', 'foo2', 'bar2')\n self.assertFalse(s_option in c._unsaved)\n\n c.remove_option('section1', 'foo2')\n self.assertFalse(s_option in c._unsaved)\n\n c.set_secure('section1', 'foo2', 'bar2')\n self.assertTrue(s_option in c._unsaved)\n self.assertTrue(c._unsaved[s_option][0] == 'set')\n self.assertTrue(c._unsaved[s_option][1] == 'bar2')\n\n c.remove_option('section1', 'foo2')\n self.assertTrue(s_option in c._unsaved)\n self.assertTrue(c._unsaved[s_option][0] == 'delete')\n self.assertTrue(c._unsaved[s_option][1] is None)",
"metadata": "root.IdentifySecureOptionTests.testUnsavedOptions",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 80
},
{
"content": " def testKeyringOffSet(self):\n c = makeConfig(keyring_available=False)\n self.assertFalse(c.is_secure_option('section1', 'username'))\n self.assertFalse(c.is_secure_option('section1', 'password'))\n\n self.assertEqual(c._unsaved, {})\n\n c.set_secure('section1', 'password', 'PASSWORD')\n self.assertFalse(c.is_secure_option('section1', 'password'))\n\n self.assertEqual(c.get('section1', 'password'), 'PASSWORD')\n self.assertEqual(c.get('section1', 'username'), 'USERNAME')\n\n c.remove_option('section1', 'password')\n self.assertFalse(c.is_secure_option('section1', 'password'))\n self.assertEqual(c._unsaved, {})",
"metadata": "root.IdentifySecureOptionTests.testKeyringOffSet",
"header": "['class', 'IdentifySecureOptionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 100
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"configparser_",
"import_",
"Config",
"Parser_",
",_",
"No",
"Optio",
"n",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"from_",
"Config",
"Parser_",
"import_",
"Config",
"Parser_",
",_",
"No",
"Optio",
"n",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"of",
"xc",
"lient_",
"._",
"config_",
"import_",
"Secur",
"able",
"Config",
"Parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"make",
"Config_",
"(_",
"keyring",
"\\u",
"available_",
"=_",
"True_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"conf_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"=_",
"Secur",
"able",
"Config",
"Parser_",
"(_",
"keyring",
"\\u",
"available_",
"=_",
"keyring",
"\\u",
"available_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"._",
"add",
"\\u",
"section_",
"(_",
"'",
"section",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"._",
"add",
"\\u",
"section_",
"(_",
"'",
"section",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"._",
"set_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
",_",
"'",
"USER",
"NAME",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"._",
"set\\u",
"secure_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
",_",
"'",
"PASS",
"WORD",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"._",
"set_",
"(_",
"'",
"section",
"2",
"'_",
",_",
"'",
"question",
"'_",
",_",
"'",
"answer",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"conf_",
"._",
"set\\u",
"secure_",
"(_",
"'",
"section",
"2",
"'_",
",_",
"'",
"ssn",
"'_",
",_",
"'",
"111",
"-1",
"1",
"-1",
"111",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"conf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"pass_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"test",
"Is",
"Secur",
"e",
"Option_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"2",
"'_",
",_",
"'",
"ssn",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"2",
"'_",
",_",
"'",
"question",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Sta",
"ys",
"Secur",
"e_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"set_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
",_",
"'",
"MY",
"PASS",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Sta",
"ys",
"Unse",
"cure",
"_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"set_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
",_",
"'",
"MY",
"USER",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Set",
"The",
"n",
"Set",
"Secur",
"e",
"Turn",
"s",
"Secur",
"e_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"set_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"'_",
",_",
"'",
"bar",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"set\\u",
"secure_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"'_",
",_",
"'",
"bar",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"set_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"'_",
",_",
"'",
"bar",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Item",
"s",
"Ha",
"ve",
"Passw",
"ords_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"items_",
"=_",
"sorted_",
"(_",
"c_",
"._",
"items_",
"(_",
"'",
"section",
"1",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"items_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"[_",
"(_",
"'",
"password",
"'_",
",_",
"'",
"PASS",
"WORD",
"'_",
")_",
",_",
"(_",
"'",
"user",
"name",
"'_",
",_",
"'",
"USER",
"NAME",
"'_",
")_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"items_",
")_",
",_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Secur",
"e",
"Items_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"items_",
"=_",
"sorted_",
"(_",
"c_",
"._",
"secure",
"\\u",
"items_",
"(_",
"'",
"section",
"1",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"items_",
",_",
"[_",
"(_",
"'",
"password",
"'_",
",_",
"'",
"PASS",
"WORD",
"'_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"items_",
")_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"remove",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"items_",
"=_",
"sorted_",
"(_",
"c_",
"._",
"secure",
"\\u",
"items_",
"(_",
"'",
"section",
"1",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"len_",
"(_",
"items_",
")_",
",_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Get_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
",_",
"'",
"PASS",
"WORD",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Not",
"Equal_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Config",
"Parser_",
"._",
"get_",
"(_",
"c_",
",_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"PASS",
"WORD",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
")_",
",_",
"'",
"USER",
"NAME",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"c_",
"._",
"remove",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Raises_",
"(_",
"No",
"Optio",
"n",
"Error_",
",_",
"c_",
"._",
"get_",
",_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Uns",
"ave",
"d",
"Options_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"s",
"\\u",
"option_",
"=_",
"\"%",
"s",
"%",
"s",
"\"_",
"%_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"set_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"2",
"'_",
",_",
"'",
"bar",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"s",
"\\u",
"option_",
"in_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"remove",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"s",
"\\u",
"option_",
"in_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"set\\u",
"secure_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"2",
"'_",
",_",
"'",
"bar",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"s",
"\\u",
"option_",
"in_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
"[_",
"s",
"\\u",
"option_",
"]_",
"[_",
"0_",
"]_",
"==_",
"'",
"set",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
"[_",
"s",
"\\u",
"option_",
"]_",
"[_",
"1_",
"]_",
"==_",
"'",
"bar",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"remove",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"foo",
"2",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"s",
"\\u",
"option_",
"in_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
"[_",
"s",
"\\u",
"option_",
"]_",
"[_",
"0_",
"]_",
"==_",
"'",
"delete",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
"[_",
"s",
"\\u",
"option_",
"]_",
"[_",
"1_",
"]_",
"is_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Identif",
"y",
"Secur",
"e",
"Optio",
"n",
"Tests_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test",
"Key",
"ring",
"Off",
"Set_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"c_",
"=_",
"make",
"Config_",
"(_",
"keyring",
"\\u",
"available_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"c_",
"._",
"\\u",
"unsa",
"ved",
"_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"set\\u",
"secure_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
",_",
"'",
"PASS",
"WORD",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
",_",
"'",
"PASS",
"WORD",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"c_",
"._",
"get_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"user",
"name",
"'_",
")_",
",_",
"'",
"USER",
"NAME",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"c_",
"._",
"remove",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"False_",
"(_",
"c_",
"._",
"is",
"\\u",
"secure",
"\\u",
"option_",
"(_",
"'",
"section",
"1",
"'_",
",_",
"'",
"password",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
First parameter of a method is not named 'self' | aliyun/aliyun-openapi-python-sdk/aliyun-python-sdk-yundun/aliyunsdkyundun/request/v20150416/BruteforceLogRequest.py | [
{
"content": "\tdef set_PageNumber(self,PageNumber):\n\t\tself.add_query_param('PageNumber',PageNumber)",
"metadata": "root.BruteforceLogRequest.set_PageNumber",
"header": "['class', 'BruteforceLogRequest', '(', 'RpcRequest', ')', ':', '___EOS___']",
"index": 34
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Bru",
"tef",
"orce",
"Log",
"Request_",
"(_",
"Rp",
"c",
"Request_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"set\\u",
"Page",
"Number_",
"(_",
"self_",
",_",
"Page",
"Number_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u\t",
"\t_",
"self_",
"._",
"add",
"\\u",
"query",
"\\u",
"param_",
"(_",
"'",
"Page",
"Number",
"'_",
",_",
"Page",
"Number_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Imprecise assert | liberation/django-elasticsearch/django_elasticsearch/tests/test_views.py | [
{
"content": " def _test_detail_view(self):\n response = self.client.get('/tests/{id}/'.format(id=self.instance.pk))\n content = json.loads(response.content)\n self.assertEqual(content['fields']['first_name'], u\"woot\")\n self.assertEqual(content['fields']['last_name'], u\"foo\")",
"metadata": "root.EsViewTestCase._test_detail_view",
"header": "['class', 'EsViewTestCase', '(', 'TestCase', ')', ':', '___EOS___']",
"index": 26
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Es",
"View",
"Test",
"Case_",
"(_",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"test\\u",
"deta",
"il",
"\\u",
"view_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"response_",
"=_",
"self_",
"._",
"client_",
"._",
"get_",
"(_",
"'/",
"tests",
"/{",
"id",
"}/'",
"_",
"._",
"format_",
"(_",
"id_",
"=_",
"self_",
"._",
"instance_",
"._",
"pk_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"content_",
"=_",
"json_",
"._",
"loads_",
"(_",
"response_",
"._",
"content_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"content_",
"[_",
"'",
"fields",
"'_",
"]_",
"[_",
"'",
"first",
"\\u",
"name",
"'_",
"]_",
",_",
"u",
"\"",
"woo",
"t",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"content_",
"[_",
"'",
"fields",
"'_",
"]_",
"[_",
"'",
"last",
"\\u",
"name",
"'_",
"]_",
",_",
"u",
"\"",
"foo",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Comparison of constants | zalando/connexion/tests/fakeapi/hello.py | [
{
"content": "def schema_response_string(valid):\n if valid == \"valid\":\n return \"Image version 2.0\"\n else:\n return 2.0",
"metadata": "root.schema_response_string",
"header": "['module', '___EOS___']",
"index": 116
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"schema",
"\\u",
"response",
"\\u",
"string_",
"(_",
"valid_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"valid_",
"==_",
"\"",
"valid",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\"",
"Image",
" ",
"version",
" ",
"2.0",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"2.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/panels/folding.py | [
{
"content": " def _add_scope_decorations(self, block, start, end):\n \"\"\"\n Show a scope decoration on the editor widget\n\n :param start: Start line\n :param end: End line\n \"\"\"\n try:\n parent = FoldScope(block).parent()\n except ValueError:\n parent = None\n if TextBlockHelper.is_fold_trigger(block):\n base_color = self._get_scope_highlight_color()\n factor_step = 5\n if base_color.lightness() < 128:\n factor_step = 10\n factor = 70\n else:\n factor = 100\n while parent:\n # highlight parent scope\n parent_start, parent_end = parent.get_range()\n self._add_scope_deco(\n start, end + 1, parent_start, parent_end,\n base_color, factor)\n # next parent scope\n start = parent_start\n end = parent_end\n parent = parent.parent()\n factor += factor_step\n # global scope\n parent_start = 0\n parent_end = self.editor.document().blockCount()\n self._add_scope_deco(\n start, end + 1, parent_start, parent_end, base_color,\n factor + factor_step)\n else:\n self._clear_scope_decos()",
"metadata": "root.FoldingPanel._add_scope_decorations",
"header": "['class', 'FoldingPanel', '(', 'Panel', ')', ':', '___EOS___']",
"index": 459
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"class_",
"Fold",
"ing",
"Panel_",
"(_",
"Panel_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"add",
"\\u",
"scope",
"\\u",
"decorat",
"ions_",
"(_",
"self_",
",_",
"block_",
",_",
"start_",
",_",
"end_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Show",
" ",
"a",
" ",
"scope",
" ",
"decorat",
"ion",
" ",
"on",
" ",
"the",
" ",
"editor",
" ",
"widget",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"start",
":",
" ",
"Start",
" ",
"line",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"end",
":",
" ",
"End",
" ",
"line",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parent_",
"=_",
"Fold",
"Scope_",
"(_",
"block_",
")_",
"._",
"parent_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parent_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"Text",
"Block",
"Helper_",
"._",
"is",
"\\u",
"fold",
"\\u",
"trigger_",
"(_",
"block_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"base",
"\\u",
"color_",
"=_",
"self_",
"._",
"\\u",
"get",
"\\u",
"scope",
"\\u",
"highlight",
"\\u",
"color_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"factor",
"\\u",
"step_",
"=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"base",
"\\u",
"color_",
"._",
"light",
"ness_",
"(_",
")_",
"<_",
"128_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"factor",
"\\u",
"step_",
"=_",
"10_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"factor_",
"=_",
"70_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"factor_",
"=_",
"100_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"while_",
"parent_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"highlight",
" ",
"parent",
" ",
"scope_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parent",
"\\u",
"start_",
",_",
"parent",
"\\u",
"end_",
"=_",
"parent_",
"._",
"get",
"\\u",
"range_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"add",
"\\u",
"scope",
"\\u",
"deco",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
",_",
"end_",
"+_",
"1_",
",_",
"parent",
"\\u",
"start_",
",_",
"parent",
"\\u",
"end_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"base",
"\\u",
"color_",
",_",
"factor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"next",
" ",
"parent",
" ",
"scope_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
"=_",
"parent",
"\\u",
"start_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"end_",
"=_",
"parent",
"\\u",
"end_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent_",
"=_",
"parent_",
"._",
"parent_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"factor_",
"+=_",
"factor",
"\\u",
"step_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"global",
" ",
"scope_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"parent",
"\\u",
"start_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parent",
"\\u",
"end_",
"=_",
"self_",
"._",
"editor_",
"._",
"document_",
"(_",
")_",
"._",
"block",
"Count_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"add",
"\\u",
"scope",
"\\u",
"deco",
"_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"start_",
",_",
"end_",
"+_",
"1_",
",_",
"parent",
"\\u",
"start_",
",_",
"parent",
"\\u",
"end_",
",_",
"base",
"\\u",
"color_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"factor_",
"+_",
"factor",
"\\u",
"step_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"clear",
"\\u",
"scope",
"\\u",
"deco",
"s_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2
] |
Unused import | twisted/nevow/examples/table/tablehtml.py | [
{
"content": "import random\n\nfrom twisted.python import util\n\nfrom nevow import loaders\nfrom nevow import rend\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class Table(rend.Page):\n\n # addSlash is used to automatically ad a slash at the end of each url\n # http://localhost:8080/foo -> http://localhost:8080/foo/\n addSlash = True\n docFactory = loaders.xmlfile(util.sibpath(__file__, 'tablehtml.html'))\n\n ",
"metadata": "root.Table",
"header": "['module', '___EOS___']",
"index": 8
},
{
"content": " def data_theList(self, context, data):\n return [(x, random.randint(0, 5000)) for x in range(random.randint(0, 10))]",
"metadata": "root.Table.data_theList",
"header": "['class', 'Table', '(', 'rend', '.', 'Page', ')', ':', '___NEWLINE___', '___NL___', '# addSlash is used to automatically ad a slash at the end of each url', '___NL___', '# http://localhost:8080/foo -> http://localhost:8080/foo/', '___NL___', '___EOS___']",
"index": 15
},
{
"content": " def render_row(self, context, data):\n context.fillSlots('first_column', data[0])\n context.fillSlots('second_column', data[1])\n return context.tag",
"metadata": "root.Table.render_row",
"header": "['class', 'Table', '(', 'rend', '.', 'Page', ')', ':', '___NEWLINE___', '___NL___', '# addSlash is used to automatically ad a slash at the end of each url', '___NL___', '# http://localhost:8080/foo -> http://localhost:8080/foo/', '___NL___', '___EOS___']",
"index": 18
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"random_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"twisted_",
"._",
"python_",
"import_",
"util_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"nev",
"ow_",
"import_",
"loaders_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"nev",
"ow_",
"import_",
"rend",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Table_",
"(_",
"rend",
"_",
"._",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
"Sla",
"sh",
" ",
"is",
" ",
"used",
" ",
"to",
" ",
"automati",
"call",
"y",
" ",
"ad",
" ",
"a",
" ",
"slash",
" ",
"at",
" ",
"the",
" ",
"end",
" ",
"of",
" ",
"each",
" ",
"url_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"local",
"host",
":",
"808",
"0",
"/",
"foo",
" ",
"->",
" ",
"http",
"://",
"local",
"host",
":",
"808",
"0",
"/",
"foo",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"add",
"Sla",
"sh_",
"=_",
"True_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"doc",
"Factory_",
"=_",
"loaders_",
"._",
"xmlfile",
"_",
"(_",
"util_",
"._",
"sib",
"path_",
"(_",
"\\u\\u",
"file\\u\\u_",
",_",
"'",
"table",
"html",
".",
"html",
"'_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Table_",
"(_",
"rend",
"_",
"._",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
"Sla",
"sh",
" ",
"is",
" ",
"used",
" ",
"to",
" ",
"automati",
"call",
"y",
" ",
"ad",
" ",
"a",
" ",
"slash",
" ",
"at",
" ",
"the",
" ",
"end",
" ",
"of",
" ",
"each",
" ",
"url_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"local",
"host",
":",
"808",
"0",
"/",
"foo",
" ",
"->",
" ",
"http",
"://",
"local",
"host",
":",
"808",
"0",
"/",
"foo",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"data\\u",
"the",
"List_",
"(_",
"self_",
",_",
"context_",
",_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"[_",
"(_",
"x_",
",_",
"random_",
"._",
"randint_",
"(_",
"0_",
",_",
"5000_",
")_",
")_",
"for_",
"x_",
"in_",
"range_",
"(_",
"random_",
"._",
"randint_",
"(_",
"0_",
",_",
"10_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Table_",
"(_",
"rend",
"_",
"._",
"Page_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
"Sla",
"sh",
" ",
"is",
" ",
"used",
" ",
"to",
" ",
"automati",
"call",
"y",
" ",
"ad",
" ",
"a",
" ",
"slash",
" ",
"at",
" ",
"the",
" ",
"end",
" ",
"of",
" ",
"each",
" ",
"url_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"local",
"host",
":",
"808",
"0",
"/",
"foo",
" ",
"->",
" ",
"http",
"://",
"local",
"host",
":",
"808",
"0",
"/",
"foo",
"/_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render",
"\\u",
"row_",
"(_",
"self_",
",_",
"context_",
",_",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"context_",
"._",
"fill",
"Slot",
"s_",
"(_",
"'",
"first",
"\\u",
"column",
"'_",
",_",
"data_",
"[_",
"0_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"._",
"fill",
"Slot",
"s_",
"(_",
"'",
"second",
"\\u",
"column",
"'_",
",_",
"data_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"context_",
"._",
"tag_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | openstack/compass-core/compass/db/api/adapter.py | [
{
"content": "def _add_flavors_from_configuration():\n \"\"\"Get flavors from flavor config dir and update to adapters.\"\"\"\n configs = util.load_configs(setting.ADAPTER_FLAVOR_DIR)\n for config in configs:\n logging.info('add config %s to flavor', config)\n adapter_name = config['ADAPTER_NAME']\n adapter = ADAPTERS[adapter_name]\n adapter_flavors = ADAPTERS_FLAVORS.setdefault(adapter_name, {})\n adapter_roles = ADAPTERS_ROLES[adapter_name]\n for flavor_dict in config['FLAVORS']:\n flavor_name = flavor_dict['flavor']\n flavor_id = '%s:%s' % (adapter_name, flavor_name)\n flavor = {\n 'name': flavor_name,\n 'id': flavor_id,\n 'adapter_id': adapter_name,\n 'adapter_name': adapter_name,\n 'display_name': flavor_dict.get('display_name', flavor_name),\n 'template': flavor_dict.get('template', None)\n }\n flavor_roles = flavor_dict.get('roles', [])\n roles_in_flavor = []\n for flavor_role in flavor_roles:\n if isinstance(flavor_role, basestring):\n role_name = flavor_role\n role_in_flavor = {\n 'name': role_name,\n 'flavor_id': flavor_id\n }\n else:\n role_in_flavor = flavor_role\n role_in_flavor['flavor_id'] = flavor_id\n if 'role' in role_in_flavor:\n role_in_flavor['name'] = role_in_flavor['role']\n del role_in_flavor['role']\n role_name = role_in_flavor['name']\n role = adapter_roles[role_name]\n util.merge_dict(role_in_flavor, role, override=False)\n roles_in_flavor.append(role_in_flavor)\n flavor['roles'] = roles_in_flavor\n adapter_flavors[flavor_name] = flavor\n parents = {}\n for name, adapter in ADAPTERS.items():\n parent = adapter.get('parent', None)\n parents[name] = parent\n for adapter_name, adapter_roles in ADAPTERS_FLAVORS.items():\n util.recursive_merge_dict(adapter_name, ADAPTERS_FLAVORS, parents)\n for adapter_name, adapter_flavors in ADAPTERS_FLAVORS.items():\n adapter = ADAPTERS[adapter_name]\n adapter['flavors'] = adapter_flavors.values()",
"metadata": "root._add_flavors_from_configuration",
"header": "['module', '___EOS___']",
"index": 197
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"add",
"\\u",
"flavor",
"s",
"\\u",
"from",
"\\u",
"configuration_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Get",
" ",
"flavor",
"s",
" ",
"from",
" ",
"flavor",
" ",
"config",
" ",
"dir",
" ",
"and",
" ",
"update",
" ",
"to",
" ",
"adapter",
"s",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"configs_",
"=_",
"util_",
"._",
"load",
"\\u",
"configs_",
"(_",
"setting_",
"._",
"ADA",
"PTE",
"R",
"\\u",
"FLA",
"VOR",
"\\u",
"DIR_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"config_",
"in_",
"configs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"info_",
"(_",
"'",
"add",
" ",
"config",
" ",
"%",
"s",
" ",
"to",
" ",
"flavor",
"'_",
",_",
"config_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"adapter",
"\\u",
"name_",
"=_",
"config_",
"[_",
"'",
"ADA",
"PTE",
"R",
"\\u",
"NAME",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"adapter_",
"=_",
"ADA",
"PTE",
"RS_",
"[_",
"adapter",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"adapter",
"\\u",
"flavors_",
"=_",
"ADA",
"PTE",
"RS",
"\\u",
"FLA",
"VOR",
"S_",
"._",
"setdefault_",
"(_",
"adapter",
"\\u",
"name_",
",_",
"{_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"adapter",
"\\u",
"roles_",
"=_",
"ADA",
"PTE",
"RS",
"\\u",
"ROLE",
"S_",
"[_",
"adapter",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"flavor",
"\\u",
"dict_",
"in_",
"config_",
"[_",
"'",
"FLA",
"VOR",
"S",
"'_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"flavor",
"\\u",
"name_",
"=_",
"flavor",
"\\u",
"dict_",
"[_",
"'",
"flavor",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flavor",
"\\u",
"id_",
"=_",
"'%",
"s",
":",
"%",
"s",
"'_",
"%_",
"(_",
"adapter",
"\\u",
"name_",
",_",
"flavor",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flavor_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"flavor",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"id",
"'_",
":_",
"flavor",
"\\u",
"id_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"adapter",
"\\u",
"id",
"'_",
":_",
"adapter",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"adapter",
"\\u",
"name",
"'_",
":_",
"adapter",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"display",
"\\u",
"name",
"'_",
":_",
"flavor",
"\\u",
"dict_",
"._",
"get_",
"(_",
"'",
"display",
"\\u",
"name",
"'_",
",_",
"flavor",
"\\u",
"name_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"template",
"'_",
":_",
"flavor",
"\\u",
"dict_",
"._",
"get_",
"(_",
"'",
"template",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"flavor",
"\\u",
"roles_",
"=_",
"flavor",
"\\u",
"dict_",
"._",
"get_",
"(_",
"'",
"role",
"s",
"'_",
",_",
"[_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"role",
"s",
"\\u",
"in",
"\\u",
"flavor_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"flavor",
"\\u",
"role_",
"in_",
"flavor",
"\\u",
"roles_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"isinstance_",
"(_",
"flavor",
"\\u",
"role_",
",_",
"basestring_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"role",
"\\u",
"name_",
"=_",
"flavor",
"\\u",
"role_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"role",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"flavor",
"\\u",
"id",
"'_",
":_",
"flavor",
"\\u",
"id_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"=_",
"flavor",
"\\u",
"role_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"[_",
"'",
"flavor",
"\\u",
"id",
"'_",
"]_",
"=_",
"flavor",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"'",
"role",
"'_",
"in_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"[_",
"'",
"name",
"'_",
"]_",
"=_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"[_",
"'",
"role",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"del_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"[_",
"'",
"role",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"role",
"\\u",
"name_",
"=_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
"[_",
"'",
"name",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"role_",
"=_",
"adapter",
"\\u",
"roles_",
"[_",
"role",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"util_",
"._",
"merge",
"\\u",
"dict_",
"(_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
",_",
"role_",
",_",
"override_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"role",
"s",
"\\u",
"in",
"\\u",
"flavor_",
"._",
"append_",
"(_",
"role",
"\\u",
"in",
"\\u",
"flavor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"flavor_",
"[_",
"'",
"role",
"s",
"'_",
"]_",
"=_",
"role",
"s",
"\\u",
"in",
"\\u",
"flavor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"adapter",
"\\u",
"flavors_",
"[_",
"flavor",
"\\u",
"name_",
"]_",
"=_",
"flavor_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"parents_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"name_",
",_",
"adapter_",
"in_",
"ADA",
"PTE",
"RS_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parent_",
"=_",
"adapter_",
"._",
"get_",
"(_",
"'",
"parent",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parents_",
"[_",
"name_",
"]_",
"=_",
"parent_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"adapter",
"\\u",
"name_",
",_",
"adapter",
"\\u",
"roles_",
"in_",
"ADA",
"PTE",
"RS",
"\\u",
"FLA",
"VOR",
"S_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"util_",
"._",
"recurs",
"ive",
"\\u",
"merge",
"\\u",
"dict_",
"(_",
"adapter",
"\\u",
"name_",
",_",
"ADA",
"PTE",
"RS",
"\\u",
"FLA",
"VOR",
"S_",
",_",
"parents_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"adapter",
"\\u",
"name_",
",_",
"adapter",
"\\u",
"flavors_",
"in_",
"ADA",
"PTE",
"RS",
"\\u",
"FLA",
"VOR",
"S_",
"._",
"items_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"adapter_",
"=_",
"ADA",
"PTE",
"RS_",
"[_",
"adapter",
"\\u",
"name_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"adapter_",
"[_",
"'",
"flavor",
"s",
"'_",
"]_",
"=_",
"adapter",
"\\u",
"flavors_",
"._",
"values_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | GoogleCloudPlatform/DataflowPythonSDK/google/cloud/dataflow/examples/wordcount_minimal.py | [
{
"content": "# Copyright 2016 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"A minimalist word-counting workflow that counts words in Shakespeare.\n\nThis is the first in a series of successively more detailed 'word count'\nexamples.\n\nNext, see the wordcount pipeline, then the wordcount_debugging pipeline, for\nmore detailed examples that introduce additional concepts.\n\nConcepts:\n\n1. Reading data from text files\n2. Specifying 'inline' transforms\n3. Counting a PCollection\n4. Writing data to Cloud Storage as text files\n\nTo execute this pipeline locally, first edit the code to specify the output\nlocation. Output location could be a local file path or an output prefix\non GCS. (Only update the output location marked with the first CHANGE comment.)\n\nTo execute this pipeline remotely, first edit the code to set your project ID,\nrunner type, the staging location, the temp location, and the output location.\nThe specified GCS bucket(s) must already exist. (Update all the places marked\nwith a CHANGE comment.)\n\nThen, run the pipeline as described in the README. It will be deployed and run\nusing the Google Cloud Dataflow Service. No args are required to run the\npipeline. You can see the results in your output bucket in the GCS browser.\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport argparse\nimport logging\nimport re\n\nimport google.cloud.dataflow as df\n\n\n\n\nif __name__ == '__main__':\n logging.getLogger().setLevel(logging.INFO)\n run()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def run(argv=None):\n \"\"\"Main entry point; defines and runs the wordcount pipeline.\"\"\"\n\n parser = argparse.ArgumentParser()\n parser.add_argument('--input',\n dest='input',\n default='gs://dataflow-samples/shakespeare/kinglear.txt',\n help='Input file to process.')\n parser.add_argument('--output',\n dest='output',\n # CHANGE 1/5: The Google Cloud Storage path is required\n # for outputting the results.\n default='gs://YOUR_OUTPUT_BUCKET/AND_OUTPUT_PREFIX',\n help='Output file to write results to.')\n known_args, pipeline_args = parser.parse_known_args(argv)\n\n pipeline_args.extend([\n # CHANGE 2/5: (OPTIONAL) Change this to BlockingDataflowPipelineRunner to\n # run your pipeline on the Google Cloud Dataflow Service.\n '--runner=DirectPipelineRunner',\n # CHANGE 3/5: Your project ID is required in order to run your pipeline on\n # the Google Cloud Dataflow Service.\n '--project=SET_YOUR_PROJECT_ID_HERE',\n # CHANGE 4/5: Your Google Cloud Storage path is required for staging local\n # files.\n '--staging_location=gs://YOUR_BUCKET_NAME/AND_STAGING_DIRECTORY',\n # CHANGE 5/5: Your Google Cloud Storage path is required for temporary\n # files.\n '--temp_location=gs://YOUR_BUCKET_NAME/AND_TEMP_DIRECTORY',\n '--job_name=your-wordcount-job',\n ])\n\n p = df.Pipeline(argv=pipeline_args)\n\n # Read the text file[pattern] into a PCollection.\n lines = p | df.io.Read('read', df.io.TextFileSource(known_args.input))\n\n # Count the occurrences of each word.\n counts = (lines\n | (df.FlatMap('split', lambda x: re.findall(r'[A-Za-z\\']+', x))\n .with_output_types(unicode))\n | df.Map('pair_with_one', lambda x: (x, 1))\n | df.GroupByKey('group')\n | df.Map('count', lambda (word, ones): (word, sum(ones))))\n\n # Format the counts into a PCollection of strings.\n output = counts | df.Map('format', lambda (word, c): '%s: %s' % (word, c))\n\n # Write the output using a \"Write\" transform that has side effects.\n # pylint: disable=expression-not-assigned\n output | df.io.Write('write', df.io.TextFileSink(known_args.output))\n\n # Actually run the pipeline (all operations above are deferred).\n p.run()",
"metadata": "root.run",
"header": "['module', '___EOS___']",
"index": 52
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2016",
" ",
"Goo",
"gle",
" ",
"Inc",
".",
" ",
"All",
" ",
"Rig",
"hts",
" ",
"Reserve",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"A",
" ",
"minima",
"list",
" ",
"word",
"-",
"counti",
"ng",
" ",
"workf",
"low",
" ",
"tha",
"t",
" ",
"count",
"s",
" ",
"words",
" ",
"in",
" ",
"Sha",
"kes",
"pea",
"re",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"is",
" ",
"the",
" ",
"first",
" ",
"in",
" ",
"a",
" ",
"series",
" ",
"of",
" ",
"success",
"ively",
" ",
"more",
" ",
"detailed",
" ",
"'",
"word",
" ",
"count",
"'",
"\\",
"10",
";",
"example",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Ne",
"xt",
",",
" ",
"see",
" ",
"the",
" ",
"wordc",
"ount",
" ",
"pipeline",
",",
" ",
"then",
" ",
"the",
" ",
"wordc",
"ount",
"\\u",
"debugg",
"ing",
" ",
"pipeline",
",",
" ",
"for",
"\\",
"10",
";",
"more",
" ",
"detailed",
" ",
"example",
"s",
" ",
"tha",
"t",
" ",
"introduce",
" ",
"addition",
"al",
" ",
"concepts",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Concept",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"1",
".",
" ",
"Reading",
" ",
"data",
" ",
"from",
" ",
"text",
" ",
"files",
"\\",
"10",
";",
"2",
".",
" ",
"Speci",
"fy",
"ing",
" ",
"'",
"inline",
"'",
" ",
"transform",
"s",
"\\",
"10",
";",
"3",
".",
" ",
"Count",
"ing",
" ",
"a",
" ",
"PC",
"olle",
"ction",
"\\",
"10",
";",
"4",
".",
" ",
"Writ",
"ing",
" ",
"data",
" ",
"to",
" ",
"Cloud",
" ",
"Stor",
"age",
" ",
"as",
" ",
"text",
" ",
"files",
"\\",
"10",
";",
"\\",
"10",
";",
"To",
" ",
"execute",
" ",
"this",
" ",
"pipeline",
" ",
"local",
"ly",
",",
" ",
"first",
" ",
"edit",
" ",
"the",
" ",
"code",
" ",
"to",
" ",
"speci",
"fy",
" ",
"the",
" ",
"output",
"\\",
"10",
";",
"location",
".",
" ",
"Output",
" ",
"location",
" ",
"coul",
"d",
" ",
"be",
" ",
"a",
" ",
"local",
" ",
"file",
" ",
"path",
" ",
"or",
" ",
"an",
" ",
"output",
" ",
"prefix",
"\\",
"10",
";",
"on",
" ",
"GC",
"S",
".",
" ",
"(",
"On",
"ly",
" ",
"update",
" ",
"the",
" ",
"output",
" ",
"location",
" ",
"marked",
" ",
"with",
" ",
"the",
" ",
"first",
" ",
"CHANGE",
" ",
"comment",
".)",
"\\",
"10",
";",
"\\",
"10",
";",
"To",
" ",
"execute",
" ",
"this",
" ",
"pipeline",
" ",
"remote",
"ly",
",",
" ",
"first",
" ",
"edit",
" ",
"the",
" ",
"code",
" ",
"to",
" ",
"set",
" ",
"your",
" ",
"project",
" ",
"ID",
",",
"\\",
"10",
";",
"runn",
"er",
" ",
"type",
",",
" ",
"the",
" ",
"staging",
" ",
"location",
",",
" ",
"the",
" ",
"temp",
" ",
"location",
",",
" ",
"and",
" ",
"the",
" ",
"output",
" ",
"location",
".",
"\\",
"10",
";",
"The",
" ",
"specified",
" ",
"GC",
"S",
" ",
"bucket",
"(",
"s",
")",
" ",
"must",
" ",
"alr",
"ead",
"y",
" ",
"exist",
".",
" ",
"(",
"Update",
" ",
"all",
" ",
"the",
" ",
"place",
"s",
" ",
"marked",
"\\",
"10",
";",
"with",
" ",
"a",
" ",
"CHANGE",
" ",
"comment",
".)",
"\\",
"10",
";",
"\\",
"10",
";",
"The",
"n",
",",
" ",
"run",
" ",
"the",
" ",
"pipeline",
" ",
"as",
" ",
"descri",
"bed",
" ",
"in",
" ",
"the",
" ",
"READ",
"ME",
".",
" ",
"It",
" ",
"will",
" ",
"be",
" ",
"deploye",
"d",
" ",
"and",
" ",
"run",
"\\",
"10",
";",
"usi",
"ng",
" ",
"the",
" ",
"Goo",
"gle",
" ",
"Cloud",
" ",
"Dataf",
"low",
" ",
"Service",
".",
" ",
"No",
" ",
"args",
" ",
"are",
" ",
"require",
"d",
" ",
"to",
" ",
"run",
" ",
"the",
"\\",
"10",
";",
"pipeline",
".",
" ",
"You",
" ",
"can",
" ",
"see",
" ",
"the",
" ",
"results",
" ",
"in",
" ",
"your",
" ",
"output",
" ",
"bucket",
" ",
"in",
" ",
"the",
" ",
"GC",
"S",
" ",
"browse",
"r",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"argparse_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"google_",
"._",
"cloud_",
"._",
"dataflow",
"_",
"as_",
"df_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"get",
"Logger_",
"(_",
")_",
"._",
"set",
"Level_",
"(_",
"logging_",
"._",
"INFO_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"run_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"run_",
"(_",
"argv_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Main",
" ",
"entry",
" ",
"point",
";",
" ",
"defin",
"es",
" ",
"and",
" ",
"runs",
" ",
"the",
" ",
"wordc",
"ount",
" ",
"pipeline",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"parser_",
"=_",
"argparse_",
"._",
"Arg",
"ument",
"Parser_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"input",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"input",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"'",
"gs",
"://",
"dataflow",
"-",
"samples",
"/",
"shake",
"spear",
"e",
"/",
"king",
"lea",
"r",
".",
"txt",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Inp",
"ut",
" ",
"file",
" ",
"to",
" ",
"process",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"parser_",
"._",
"add",
"\\u",
"argument_",
"(_",
"'--",
"output",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"dest_",
"=_",
"'",
"output",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"CHANGE",
" ",
"1",
"/",
"5",
":",
" ",
"The",
" ",
"Goo",
"gle",
" ",
"Cloud",
" ",
"Stor",
"age",
" ",
"path",
" ",
"is",
" ",
"required_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"for",
" ",
"output",
"ting",
" ",
"the",
" ",
"results",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"default_",
"=_",
"'",
"gs",
"://",
"YOU",
"R",
"\\u",
"OUTPU",
"T",
"\\u",
"BUCKET",
"/",
"AND",
"\\u",
"OUTPU",
"T",
"\\u",
"PREF",
"IX",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"'",
"Output",
" ",
"file",
" ",
"to",
" ",
"write",
" ",
"results",
" ",
"to",
".'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"know",
"n",
"\\u",
"args_",
",_",
"pipeline",
"\\u",
"args_",
"=_",
"parser_",
"._",
"parse",
"\\u",
"know",
"n",
"\\u",
"args_",
"(_",
"argv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"pipeline",
"\\u",
"args_",
"._",
"extend_",
"(_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"CHANGE",
" ",
"2",
"/",
"5",
":",
" ",
"(",
"OPTIONAL",
")",
" ",
"Change",
" ",
"this",
" ",
"to",
" ",
"Block",
"ing",
"Dataf",
"low",
"Pipe",
"line",
"Run",
"ner",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"run",
" ",
"your",
" ",
"pipeline",
" ",
"on",
" ",
"the",
" ",
"Goo",
"gle",
" ",
"Cloud",
" ",
"Dataf",
"low",
" ",
"Service",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"runn",
"er",
"=",
"Direct",
"Pipe",
"line",
"Run",
"ner",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"CHANGE",
" ",
"3",
"/",
"5",
":",
" ",
"You",
"r",
" ",
"project",
" ",
"ID",
" ",
"is",
" ",
"require",
"d",
" ",
"in",
" ",
"order",
" ",
"to",
" ",
"run",
" ",
"your",
" ",
"pipeline",
" ",
"on_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"Goo",
"gle",
" ",
"Cloud",
" ",
"Dataf",
"low",
" ",
"Service",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"project",
"=",
"SET",
"\\u",
"YOU",
"R",
"\\u",
"PROJECT",
"\\u",
"ID",
"\\u",
"HER",
"E",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"CHANGE",
" ",
"4",
"/",
"5",
":",
" ",
"You",
"r",
" ",
"Goo",
"gle",
" ",
"Cloud",
" ",
"Stor",
"age",
" ",
"path",
" ",
"is",
" ",
"require",
"d",
" ",
"for",
" ",
"staging",
" ",
"local_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"staging",
"\\u",
"location",
"=",
"gs",
"://",
"YOU",
"R",
"\\u",
"BUCKET",
"\\u",
"NAME",
"/",
"AND",
"\\u",
"STA",
"GING",
"\\u",
"DIRECT",
"ORY",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"CHANGE",
" ",
"5",
"/",
"5",
":",
" ",
"You",
"r",
" ",
"Goo",
"gle",
" ",
"Cloud",
" ",
"Stor",
"age",
" ",
"path",
" ",
"is",
" ",
"require",
"d",
" ",
"for",
" ",
"temporar",
"y_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"files",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"temp",
"\\u",
"location",
"=",
"gs",
"://",
"YOU",
"R",
"\\u",
"BUCKET",
"\\u",
"NAME",
"/",
"AND",
"\\u",
"TEMP",
"\\u",
"DIRECT",
"ORY",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'--",
"job",
"\\u",
"name",
"=",
"your",
"-",
"wordc",
"ount",
"-",
"job",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"p_",
"=_",
"df_",
"._",
"Pipeline_",
"(_",
"argv_",
"=_",
"pipeline",
"\\u",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Read",
" ",
"the",
" ",
"text",
" ",
"file",
"[",
"pattern",
"]",
" ",
"int",
"o",
" ",
"a",
" ",
"PC",
"olle",
"ction",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"lines_",
"=_",
"p_",
"|_",
"df_",
"._",
"io_",
"._",
"Read_",
"(_",
"'",
"read",
"'_",
",_",
"df_",
"._",
"io_",
"._",
"Text",
"File",
"Source_",
"(_",
"know",
"n",
"\\u",
"args_",
"._",
"input_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Count",
" ",
"the",
" ",
"occurrences",
" ",
"of",
" ",
"each",
" ",
"word",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"counts_",
"=_",
"(_",
"lines_",
"\\u\\u\\uNL\\u\\u\\u_",
"|_",
"(_",
"df_",
"._",
"Flat",
"Map_",
"(_",
"'",
"split",
"'_",
",_",
"lambda_",
"x_",
":_",
"re_",
"._",
"findall_",
"(_",
"r",
"'[",
"A",
"-",
"Za",
"-",
"z",
"\\\\']",
"+'_",
",_",
"x_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"._",
"with",
"\\u",
"output",
"\\u",
"types_",
"(_",
"unicode_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"|_",
"df_",
"._",
"Map_",
"(_",
"'",
"pair",
"\\u",
"with",
"\\u",
"one",
"'_",
",_",
"lambda_",
"x_",
":_",
"(_",
"x_",
",_",
"1_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"|_",
"df_",
"._",
"Group",
"By",
"Key_",
"(_",
"'",
"group",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"|_",
"df_",
"._",
"Map_",
"(_",
"'",
"count",
"'_",
",_",
"lambda_",
"(_",
"word_",
",_",
"ones_",
")_",
":_",
"(_",
"word_",
",_",
"sum_",
"(_",
"ones_",
")_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Format",
" ",
"the",
" ",
"count",
"s",
" ",
"int",
"o",
" ",
"a",
" ",
"PC",
"olle",
"ction",
" ",
"of",
" ",
"string",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"output_",
"=_",
"counts_",
"|_",
"df_",
"._",
"Map_",
"(_",
"'",
"format",
"'_",
",_",
"lambda_",
"(_",
"word_",
",_",
"c_",
")_",
":_",
"'%",
"s",
":",
" ",
"%",
"s",
"'_",
"%_",
"(_",
"word_",
",_",
"c_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Write",
" ",
"the",
" ",
"output",
" ",
"usi",
"ng",
" ",
"a",
" ",
"\"",
"Write",
"\"",
" ",
"transform",
" ",
"tha",
"t",
" ",
"has",
" ",
"side",
" ",
"effect",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"express",
"ion",
"-",
"not",
"-",
"assigned_",
"\\u\\u\\uNL\\u\\u\\u_",
"output_",
"|_",
"df_",
"._",
"io_",
"._",
"Write_",
"(_",
"'",
"write",
"'_",
",_",
"df_",
"._",
"io_",
"._",
"Text",
"File",
"Sink_",
"(_",
"know",
"n",
"\\u",
"args_",
"._",
"output_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Actual",
"ly",
" ",
"run",
" ",
"the",
" ",
"pipeline",
" ",
"(",
"all",
" ",
"operati",
"ons",
" ",
"above",
" ",
"are",
" ",
"defer",
"red",
").",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"p_",
"._",
"run_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2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| aerospike/aerospike-client-python/examples/client/index_remove.py | [
{
"content": "# -*- coding: utf-8 -*-\n##########################################################################\n# Copyright 2013-2016 Aerospike, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n##########################################################################\n\n\nfrom __future__ import print_function\n\nimport aerospike\nimport sys\n\nfrom optparse import OptionParser\n\n##########################################################################\n# Options Parsing\n##########################################################################\n\nusage = \"usage: %prog [options] bin index_name\"\n\noptparser = OptionParser(usage=usage, add_help_option=False)\n\noptparser.add_option(\n \"--help\", dest=\"help\", action=\"store_true\",\n help=\"Displays this message.\")\n\noptparser.add_option(\n \"-U\", \"--username\", dest=\"username\", type=\"string\", metavar=\"<USERNAME>\",\n help=\"Username to connect to database.\")\n\noptparser.add_option(\n \"-P\", \"--password\", dest=\"password\", type=\"string\", metavar=\"<PASSWORD>\",\n help=\"Password to connect to database.\")\n\noptparser.add_option(\n \"-h\", \"--host\", dest=\"host\", type=\"string\", default=\"127.0.0.1\", metavar=\"<ADDRESS>\",\n help=\"Address of Aerospike server.\")\n\noptparser.add_option(\n \"-p\", \"--port\", dest=\"port\", type=\"int\", default=3000, metavar=\"<PORT>\",\n help=\"Port of the Aerospike server.\")\n\noptparser.add_option(\n \"-n\", \"--namespace\", dest=\"namespace\", type=\"string\", default=\"test\", metavar=\"<NS>\",\n help=\"Port of the Aerospike server.\")\n\n(options, args) = optparser.parse_args()\n\nif options.help:\n optparser.print_help()\n print()\n sys.exit(1)\n\nif len(args) != 1:\n optparser.print_help()\n print()\n sys.exit(1)\n\n##########################################################################\n# Client Configuration\n##########################################################################\n\nconfig = {\n 'hosts': [(options.host, options.port)]\n}\n\n##########################################################################\n# Application\n##########################################################################\n\nexitCode = 0\n\ntry:\n\n # ----------------------------------------------------------------------------\n # Connect to Cluster\n # ----------------------------------------------------------------------------\n\n client = aerospike.client(config).connect(\n options.username, options.password)\n\n # ----------------------------------------------------------------------------\n # Perform Operation\n # ----------------------------------------------------------------------------\n\n try:\n\n policy = {}\n namespace = options.namespace\n index_name = args.pop()\n\n client.index_remove(namespace, index_name, policy)\n print(\"OK, 1 Integer Secondary Index Removed \")\n\n except Exception as e:\n print(\"error: {0}\".format(e), file=sys.stderr)\n exitCode = 2\n\n # ----------------------------------------------------------------------------\n # Close Connection to Cluster\n # ----------------------------------------------------------------------------\n\n client.close()\n\nexcept Exception as eargs:\n print(\"error: {0}\".format(eargs), file=sys.stderr)\n exitCode = 3\n\n##########################################################################\n# Exit\n##########################################################################\n\nsys.exit(exitCode)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2013",
"-",
"2016",
" ",
"Aer",
"osp",
"ike",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"print",
"\\u",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"aeros",
"pike",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"optparse_",
"import_",
"Optio",
"n",
"Parser_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Optio",
"ns",
" ",
"Pars",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"usage_",
"=_",
"\"",
"usage",
":",
" ",
"%",
"prog",
" ",
"[",
"options",
"]",
" ",
"bin",
" ",
"index",
"\\u",
"name",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"=_",
"Optio",
"n",
"Parser_",
"(_",
"usage_",
"=_",
"usage_",
",_",
"add",
"\\u",
"help",
"\\u",
"option_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"._",
"add",
"\\u",
"option_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"--",
"help",
"\"_",
",_",
"dest_",
"=_",
"\"",
"help",
"\"_",
",_",
"action_",
"=_",
"\"",
"store",
"\\u",
"true",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Display",
"s",
" ",
"this",
" ",
"message",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"._",
"add",
"\\u",
"option_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"U",
"\"_",
",_",
"\"--",
"user",
"name",
"\"_",
",_",
"dest_",
"=_",
"\"",
"user",
"name",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"metavar_",
"=_",
"\"<",
"USER",
"NAME",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"User",
"name",
" ",
"to",
" ",
"connect",
" ",
"to",
" ",
"databa",
"se",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"._",
"add",
"\\u",
"option_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"P",
"\"_",
",_",
"\"--",
"password",
"\"_",
",_",
"dest_",
"=_",
"\"",
"password",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"metavar_",
"=_",
"\"<",
"PASS",
"WORD",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Passw",
"ord",
" ",
"to",
" ",
"connect",
" ",
"to",
" ",
"databa",
"se",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"._",
"add",
"\\u",
"option_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"h",
"\"_",
",_",
"\"--",
"host",
"\"_",
",_",
"dest_",
"=_",
"\"",
"host",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"default_",
"=_",
"\"",
"127",
".0",
".0",
".1",
"\"_",
",_",
"metavar_",
"=_",
"\"<",
"ADDR",
"ESS",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Address",
" ",
"of",
" ",
"Aer",
"osp",
"ike",
" ",
"server",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"._",
"add",
"\\u",
"option_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"p",
"\"_",
",_",
"\"--",
"port",
"\"_",
",_",
"dest_",
"=_",
"\"",
"port",
"\"_",
",_",
"type_",
"=_",
"\"",
"int",
"\"_",
",_",
"default_",
"=_",
"3000_",
",_",
"metavar_",
"=_",
"\"<",
"PORT",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Port",
" ",
"of",
" ",
"the",
" ",
"Aer",
"osp",
"ike",
" ",
"server",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"optparse",
"r_",
"._",
"add",
"\\u",
"option_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"-",
"n",
"\"_",
",_",
"\"--",
"namespace",
"\"_",
",_",
"dest_",
"=_",
"\"",
"namespace",
"\"_",
",_",
"type_",
"=_",
"\"",
"string",
"\"_",
",_",
"default_",
"=_",
"\"",
"test",
"\"_",
",_",
"metavar_",
"=_",
"\"<",
"NS",
">\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"Port",
" ",
"of",
" ",
"the",
" ",
"Aer",
"osp",
"ike",
" ",
"server",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"options_",
",_",
"args_",
")_",
"=_",
"optparse",
"r_",
"._",
"parse",
"\\u",
"args_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"options_",
"._",
"help_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"optparse",
"r_",
"._",
"print",
"\\u",
"help_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"len_",
"(_",
"args_",
")_",
"!=_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"optparse",
"r_",
"._",
"print",
"\\u",
"help_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Client",
" ",
"Configuration_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"config_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"host",
"s",
"'_",
":_",
"[_",
"(_",
"options_",
"._",
"host_",
",_",
"options_",
"._",
"port_",
")_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Application_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"exit",
"Code_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Connect",
" ",
"to",
" ",
"Cluster_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"client_",
"=_",
"aeros",
"pike",
"_",
"._",
"client_",
"(_",
"config_",
")_",
"._",
"connect_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"options_",
"._",
"username_",
",_",
"options_",
"._",
"password_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Perform",
" ",
"Operation_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"policy_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"namespace_",
"=_",
"options_",
"._",
"namespace_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"index",
"\\u",
"name_",
"=_",
"args_",
"._",
"pop_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"client_",
"._",
"index",
"\\u",
"remove_",
"(_",
"namespace_",
",_",
"index",
"\\u",
"name_",
",_",
"policy_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"print_",
"(_",
"\"",
"OK",
",",
" ",
"1",
" ",
"Integer",
" ",
"Second",
"ary",
" ",
"Index",
" ",
"Remove",
"d",
" ",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"e_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"error",
":",
" ",
"{",
"0",
"}\"_",
"._",
"format_",
"(_",
"e_",
")_",
",_",
"file_",
"=_",
"sys_",
"._",
"stderr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exit",
"Code_",
"=_",
"2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Clos",
"e",
" ",
"Connect",
"ion",
" ",
"to",
" ",
"Cluster_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"client_",
"._",
"close_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
"as_",
"ear",
"gs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
"(_",
"\"",
"error",
":",
" ",
"{",
"0",
"}\"_",
"._",
"format_",
"(_",
"ear",
"gs_",
")_",
",_",
"file_",
"=_",
"sys_",
"._",
"stderr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"exit",
"Code_",
"=_",
"3_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Exit_",
"\\u\\u\\uNL\\u\\u\\u_",
"###########",
"###########",
"###########",
"###########",
"###########",
"###########",
"######",
"##",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"sys_",
"._",
"exit_",
"(_",
"exit",
"Code_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | NeuralEnsemble/python-neo/neo/test/iotest/test_brainwaredamio.py | [
{
"content": "# -*- coding: utf-8 -*-\n\"\"\"\nTests of neo.io.brainwaredamio\n\"\"\"\n\n# needed for python 3 compatibility\nfrom __future__ import absolute_import, division, print_function\n\nimport os.path\nimport sys\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nimport numpy as np\nimport quantities as pq\n\nfrom neo.core import (AnalogSignal, Block, RecordingChannel,\n RecordingChannelGroup, Segment)\nfrom neo.io import BrainwareDamIO\nfrom neo.test.iotest.common_io_test import BaseTestIO\nfrom neo.test.tools import (assert_same_sub_schema,\n assert_neo_object_is_compliant)\nfrom neo.test.iotest.tools import create_generic_reader\n\nPY_VER = sys.version_info[0]\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def proc_dam(filename):\n '''Load an dam file that has already been processed by the official matlab\n file converter. That matlab data is saved to an m-file, which is then\n converted to a numpy '.npz' file. This numpy file is the file actually\n loaded. This function converts it to a neo block and returns the block.\n This block can be compared to the block produced by BrainwareDamIO to\n make sure BrainwareDamIO is working properly\n\n block = proc_dam(filename)\n\n filename: The file name of the numpy file to load. It should end with\n '*_dam_py?.npz'. This will be converted to a neo 'file_origin' property\n with the value '*.dam', so the filename to compare should fit that pattern.\n 'py?' should be 'py2' for the python 2 version of the numpy file or 'py3'\n for the python 3 version of the numpy file.\n\n example: filename = 'file1_dam_py2.npz'\n dam file name = 'file1.dam'\n '''\n with np.load(filename) as damobj:\n damfile = damobj.items()[0][1].flatten()\n\n filename = os.path.basename(filename[:-12]+'.dam')\n\n signals = [res.flatten() for res in damfile['signal']]\n stimIndexes = [int(res[0, 0].tolist()) for res in damfile['stimIndex']]\n timestamps = [res[0, 0] for res in damfile['timestamp']]\n\n block = Block(file_origin=filename)\n\n rcg = RecordingChannelGroup(file_origin=filename)\n chan = RecordingChannel(file_origin=filename, index=0, name='Chan1')\n rcg.channel_indexes = np.array([1])\n rcg.channel_names = np.array(['Chan1'], dtype='S')\n\n block.recordingchannelgroups.append(rcg)\n rcg.recordingchannels.append(chan)\n\n params = [res['params'][0, 0].flatten() for res in damfile['stim']]\n values = [res['values'][0, 0].flatten() for res in damfile['stim']]\n params = [[res1[0] for res1 in res] for res in params]\n values = [[res1 for res1 in res] for res in values]\n stims = [dict(zip(param, value)) for param, value in zip(params, values)]\n\n fulldam = zip(stimIndexes, timestamps, signals, stims)\n for stimIndex, timestamp, signal, stim in fulldam:\n sig = AnalogSignal(signal=signal*pq.mV,\n t_start=timestamp*pq.d,\n file_origin=filename,\n sampling_period=1.*pq.s)\n segment = Segment(file_origin=filename,\n index=stimIndex,\n **stim)\n segment.analogsignals = [sig]\n block.segments.append(segment)\n\n block.create_many_to_one_relationship()\n\n return block",
"metadata": "root.proc_dam",
"header": "['module', '___EOS___']",
"index": 30
},
{
"content": "class BrainwareDamIOTestCase(BaseTestIO, unittest.TestCase):\n '''\n Unit test testcase for neo.io.BrainwareDamIO\n '''\n ioclass = BrainwareDamIO\n read_and_write_is_bijective = False\n\n # These are the files it tries to read and test for compliance\n files_to_test = ['block_300ms_4rep_1clust_part_ch1.dam',\n 'interleaved_500ms_5rep_ch2.dam',\n 'long_170s_1rep_1clust_ch2.dam',\n 'multi_500ms_mulitrep_ch1.dam',\n 'random_500ms_12rep_noclust_part_ch2.dam',\n 'sequence_500ms_5rep_ch2.dam']\n\n # these are reference files to compare to\n files_to_compare = ['block_300ms_4rep_1clust_part_ch1',\n 'interleaved_500ms_5rep_ch2',\n '',\n 'multi_500ms_mulitrep_ch1',\n 'random_500ms_12rep_noclust_part_ch2',\n 'sequence_500ms_5rep_ch2']\n\n # add the appropriate suffix depending on the python version\n for i, fname in enumerate(files_to_compare):\n if fname:\n files_to_compare[i] += '_dam_py%s.npz' % PY_VER\n\n # Will fetch from g-node if they don't already exist locally\n # How does it know to do this before any of the other tests?\n files_to_download = files_to_test + files_to_compare\n\n",
"metadata": "root.BrainwareDamIOTestCase",
"header": "['module', '___EOS___']",
"index": 91
},
{
"content": " def test_reading_same(self):\n for ioobj, path in self.iter_io_objects(return_path=True):\n obj_reader_base = create_generic_reader(ioobj, target=False)\n obj_reader_single = create_generic_reader(ioobj)\n\n obj_base = obj_reader_base()\n obj_single = obj_reader_single()\n\n try:\n assert_same_sub_schema(obj_base, obj_single)\n except BaseException as exc:\n exc.args += ('from ' + os.path.basename(path),)\n raise",
"metadata": "root.BrainwareDamIOTestCase.test_reading_same",
"header": "['class', 'BrainwareDamIOTestCase', '(', 'BaseTestIO', ',', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 123
},
{
"content": " def test_against_reference(self):\n for filename, refname in zip(self.files_to_test,\n self.files_to_compare):\n if not refname:\n continue\n obj = self.read_file(filename=filename)\n refobj = proc_dam(self.get_filename_path(refname))\n\n try:\n assert_neo_object_is_compliant(obj)\n assert_neo_object_is_compliant(refobj)\n assert_same_sub_schema(obj, refobj)\n except BaseException as exc:\n exc.args += ('from ' + filename,)\n raise",
"metadata": "root.BrainwareDamIOTestCase.test_against_reference",
"header": "['class', 'BrainwareDamIOTestCase', '(', 'BaseTestIO', ',', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 137
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"-*-",
" ",
"codi",
"ng",
":",
" ",
"utf",
"-",
"8",
" ",
"-*-",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Test",
"s",
" ",
"of",
" ",
"neo",
".",
"io",
".",
"brain",
"ware",
"dam",
"io",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"need",
"ed",
" ",
"for",
" ",
"python",
" ",
"3",
" ",
"compatibility",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"abs",
"olute",
"\\u",
"import_",
",_",
"division_",
",_",
"print",
"\\u",
"function_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"os_",
"._",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"unittest2_",
"as_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Import",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"import_",
"unittest_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"quantities",
"_",
"as_",
"pq_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"neo",
"_",
"._",
"core_",
"import_",
"(_",
"Ana",
"log",
"Signal_",
",_",
"Block_",
",_",
"Record",
"ing",
"Channel_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Record",
"ing",
"Chan",
"nel",
"Group_",
",_",
"Segment_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"neo",
"_",
"._",
"io_",
"import_",
"Brain",
"ware",
"Dam",
"IO_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"neo",
"_",
"._",
"test_",
"._",
"iot",
"est_",
"._",
"common",
"\\u",
"io",
"\\u",
"test_",
"import_",
"Base",
"Test",
"IO_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"neo",
"_",
"._",
"test_",
"._",
"tools_",
"import_",
"(_",
"assert",
"\\u",
"same",
"\\u",
"sub\\u",
"schema_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"assert",
"\\u",
"neo",
"\\u",
"object\\u",
"is",
"\\u",
"compliant",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"neo",
"_",
"._",
"test_",
"._",
"iot",
"est_",
"._",
"tools_",
"import_",
"create",
"\\u",
"gener",
"ic",
"\\u",
"reader_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"PY",
"\\u",
"VER_",
"=_",
"sys_",
"._",
"version",
"\\u",
"info_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"unittest_",
"._",
"main_",
"(_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"proc",
"\\u",
"dam",
"_",
"(_",
"filename_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Load",
" ",
"an",
" ",
"dam",
" ",
"file",
" ",
"tha",
"t",
" ",
"has",
" ",
"alr",
"ead",
"y",
" ",
"bee",
"n",
" ",
"process",
"ed",
" ",
"by",
" ",
"the",
" ",
"official",
" ",
"matlab",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"file",
" ",
"converter",
".",
" ",
" ",
"Tha",
"t",
" ",
"matlab",
" ",
"data",
" ",
"is",
" ",
"saved",
" ",
"to",
" ",
"an",
" ",
"m",
"-",
"file",
",",
" ",
"whi",
"ch",
" ",
"is",
" ",
"then",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"convert",
"ed",
" ",
"to",
" ",
"a",
" ",
"nump",
"y",
" ",
"'.",
"np",
"z",
"'",
" ",
"file",
".",
" ",
" ",
"Thi",
"s",
" ",
"nump",
"y",
" ",
"file",
" ",
"is",
" ",
"the",
" ",
"file",
" ",
"actual",
"ly",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"load",
"ed",
".",
" ",
" ",
"Thi",
"s",
" ",
"function",
" ",
"convert",
"s",
" ",
"it",
" ",
"to",
" ",
"a",
" ",
"neo",
" ",
"block",
" ",
"and",
" ",
"return",
"s",
" ",
"the",
" ",
"block",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"block",
" ",
"can",
" ",
"be",
" ",
"compare",
"d",
" ",
"to",
" ",
"the",
" ",
"block",
" ",
"produce",
"d",
" ",
"by",
" ",
"Brain",
"ware",
"Dam",
"IO",
" ",
"to",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"make",
" ",
"sure",
" ",
"Brain",
"ware",
"Dam",
"IO",
" ",
"is",
" ",
"working",
" ",
"proper",
"ly",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"block",
" ",
"=",
" ",
"proc",
"\\u",
"dam",
"(",
"filename",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"filename",
":",
" ",
"The",
" ",
"file",
" ",
"name",
" ",
"of",
" ",
"the",
" ",
"nump",
"y",
" ",
"file",
" ",
"to",
" ",
"load",
".",
" ",
" ",
"It",
" ",
"shou",
"ld",
" ",
"end",
" ",
"with",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'*",
"\\u",
"dam",
"\\u",
"py",
"?",
".",
"np",
"z",
"'.",
" ",
"Thi",
"s",
" ",
"will",
" ",
"be",
" ",
"convert",
"ed",
" ",
"to",
" ",
"a",
" ",
"neo",
" ",
"'",
"file",
"\\u",
"orig",
"in",
"'",
" ",
"property",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"with",
" ",
"the",
" ",
"value",
" ",
"'*",
".",
"dam",
"',",
" ",
"so",
" ",
"the",
" ",
"filename",
" ",
"to",
" ",
"compare",
" ",
"shou",
"ld",
" ",
"fit",
" ",
"tha",
"t",
" ",
"pattern",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"py",
"?'",
" ",
"shou",
"ld",
" ",
"be",
" ",
"'",
"py2",
"'",
" ",
"for",
" ",
"the",
" ",
"python",
" ",
"2",
" ",
"version",
" ",
"of",
" ",
"the",
" ",
"nump",
"y",
" ",
"file",
" ",
"or",
" ",
"'",
"py3",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"for",
" ",
"the",
" ",
"python",
" ",
"3",
" ",
"version",
" ",
"of",
" ",
"the",
" ",
"nump",
"y",
" ",
"file",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"example",
":",
" ",
"filename",
" ",
"=",
" ",
"'",
"file",
"1",
"\\u",
"dam",
"\\u",
"py2",
".",
"np",
"z",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"dam",
" ",
"file",
" ",
"name",
" ",
"=",
" ",
"'",
"file",
"1",
".",
"dam",
"'",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"np_",
"._",
"load_",
"(_",
"filename_",
")_",
"as_",
"dam",
"obj_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dam",
"file_",
"=_",
"dam",
"obj_",
"._",
"items_",
"(_",
")_",
"[_",
"0_",
"]_",
"[_",
"1_",
"]_",
"._",
"flatten_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"filename_",
"=_",
"os_",
"._",
"path_",
"._",
"basename_",
"(_",
"filename_",
"[_",
":_",
"-_",
"12_",
"]_",
"+_",
"'.",
"dam",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"signals_",
"=_",
"[_",
"res_",
"._",
"flatten_",
"(_",
")_",
"for_",
"res_",
"in_",
"dam",
"file_",
"[_",
"'",
"signal",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stim",
"Indexes_",
"=_",
"[_",
"int_",
"(_",
"res_",
"[_",
"0_",
",_",
"0_",
"]_",
"._",
"tolist_",
"(_",
")_",
")_",
"for_",
"res_",
"in_",
"dam",
"file_",
"[_",
"'",
"stim",
"Index",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"timestamps_",
"=_",
"[_",
"res_",
"[_",
"0_",
",_",
"0_",
"]_",
"for_",
"res_",
"in_",
"dam",
"file_",
"[_",
"'",
"timestamp",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"block_",
"=_",
"Block_",
"(_",
"file",
"\\u",
"origin_",
"=_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rc",
"g_",
"=_",
"Record",
"ing",
"Chan",
"nel",
"Group_",
"(_",
"file",
"\\u",
"origin_",
"=_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"chan_",
"=_",
"Record",
"ing",
"Channel_",
"(_",
"file",
"\\u",
"origin_",
"=_",
"filename_",
",_",
"index_",
"=_",
"0_",
",_",
"name_",
"=_",
"'",
"Chan",
"1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rc",
"g_",
"._",
"channel",
"\\u",
"indexes_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rc",
"g_",
"._",
"channel",
"\\u",
"names_",
"=_",
"np_",
"._",
"array_",
"(_",
"[_",
"'",
"Chan",
"1",
"'_",
"]_",
",_",
"dtype_",
"=_",
"'",
"S",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"block_",
"._",
"record",
"ing",
"channel",
"groups_",
"._",
"append_",
"(_",
"rc",
"g_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rc",
"g_",
"._",
"record",
"ing",
"channels_",
"._",
"append_",
"(_",
"chan_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"params_",
"=_",
"[_",
"res_",
"[_",
"'",
"params",
"'_",
"]_",
"[_",
"0_",
",_",
"0_",
"]_",
"._",
"flatten_",
"(_",
")_",
"for_",
"res_",
"in_",
"dam",
"file_",
"[_",
"'",
"stim",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"values_",
"=_",
"[_",
"res_",
"[_",
"'",
"values",
"'_",
"]_",
"[_",
"0_",
",_",
"0_",
"]_",
"._",
"flatten_",
"(_",
")_",
"for_",
"res_",
"in_",
"dam",
"file_",
"[_",
"'",
"stim",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"params_",
"=_",
"[_",
"[_",
"res1_",
"[_",
"0_",
"]_",
"for_",
"res1_",
"in_",
"res_",
"]_",
"for_",
"res_",
"in_",
"params_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"values_",
"=_",
"[_",
"[_",
"res1_",
"for_",
"res1_",
"in_",
"res_",
"]_",
"for_",
"res_",
"in_",
"values_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stim",
"s_",
"=_",
"[_",
"dict_",
"(_",
"zip_",
"(_",
"param_",
",_",
"value_",
")_",
")_",
"for_",
"param_",
",_",
"value_",
"in_",
"zip_",
"(_",
"params_",
",_",
"values_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"full",
"dam",
"_",
"=_",
"zip_",
"(_",
"stim",
"Indexes_",
",_",
"timestamps_",
",_",
"signals_",
",_",
"stim",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"stim",
"Index_",
",_",
"timestamp_",
",_",
"signal_",
",_",
"stim",
"_",
"in_",
"full",
"dam",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sig_",
"=_",
"Ana",
"log",
"Signal_",
"(_",
"signal_",
"=_",
"signal_",
"*_",
"pq_",
"._",
"m",
"V_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"t",
"\\u",
"start_",
"=_",
"timestamp_",
"*_",
"pq_",
"._",
"d_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"file",
"\\u",
"origin_",
"=_",
"filename_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"samp",
"ling",
"\\u",
"period_",
"=_",
"1._",
"*_",
"pq_",
"._",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"segment_",
"=_",
"Segment_",
"(_",
"file",
"\\u",
"origin_",
"=_",
"filename_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"index_",
"=_",
"stim",
"Index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"**_",
"stim",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"segment_",
"._",
"analog",
"signals_",
"=_",
"[_",
"sig_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"block_",
"._",
"segments_",
"._",
"append_",
"(_",
"segment_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"block_",
"._",
"create",
"\\u",
"many",
"\\u",
"to",
"\\u",
"one",
"\\u",
"relationship_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"block_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Brain",
"ware",
"Dam",
"IO",
"Test",
"Case_",
"(_",
"Base",
"Test",
"IO_",
",_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Unit",
" ",
"test",
" ",
"testc",
"ase",
" ",
"for",
" ",
"neo",
".",
"io",
".",
"Brain",
"ware",
"Dam",
"IO",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ioc",
"lass_",
"=_",
"Brain",
"ware",
"Dam",
"IO_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"read",
"\\u",
"and",
"\\u",
"write",
"\\u",
"is",
"\\u",
"bij",
"ective",
"_",
"=_",
"False_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"The",
"se",
" ",
"are",
" ",
"the",
" ",
"files",
" ",
"it",
" ",
"trie",
"s",
" ",
"to",
" ",
"read",
" ",
"and",
" ",
"test",
" ",
"for",
" ",
"compli",
"ance_",
"\\u\\u\\uNL\\u\\u\\u_",
"files",
"\\u",
"to",
"\\u",
"test_",
"=_",
"[_",
"'",
"block",
"\\u",
"300",
"ms",
"\\u",
"4",
"rep",
"\\u",
"1c",
"lus",
"t",
"\\u",
"part",
"\\u",
"ch",
"1",
".",
"dam",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"interleave",
"d\\u",
"500",
"ms",
"\\u",
"5",
"rep",
"\\u",
"ch",
"2",
".",
"dam",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"long",
"\\u",
"170",
"s",
"\\u",
"1",
"rep",
"\\u",
"1c",
"lus",
"t",
"\\u",
"ch",
"2",
".",
"dam",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"multi",
"\\u",
"500",
"ms",
"\\u",
"mul",
"itr",
"ep",
"\\u",
"ch",
"1",
".",
"dam",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"random",
"\\u",
"500",
"ms",
"\\u",
"1",
"2r",
"ep",
"\\u",
"noc",
"lus",
"t",
"\\u",
"part",
"\\u",
"ch",
"2",
".",
"dam",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sequence",
"\\u",
"500",
"ms",
"\\u",
"5",
"rep",
"\\u",
"ch",
"2",
".",
"dam",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"these",
" ",
"are",
" ",
"reference",
" ",
"files",
" ",
"to",
" ",
"compare",
" ",
"to_",
"\\u\\u\\uNL\\u\\u\\u_",
"files",
"\\u",
"to",
"\\u",
"compare_",
"=_",
"[_",
"'",
"block",
"\\u",
"300",
"ms",
"\\u",
"4",
"rep",
"\\u",
"1c",
"lus",
"t",
"\\u",
"part",
"\\u",
"ch",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"interleave",
"d\\u",
"500",
"ms",
"\\u",
"5",
"rep",
"\\u",
"ch",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"multi",
"\\u",
"500",
"ms",
"\\u",
"mul",
"itr",
"ep",
"\\u",
"ch",
"1",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"random",
"\\u",
"500",
"ms",
"\\u",
"1",
"2r",
"ep",
"\\u",
"noc",
"lus",
"t",
"\\u",
"part",
"\\u",
"ch",
"2",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"sequence",
"\\u",
"500",
"ms",
"\\u",
"5",
"rep",
"\\u",
"ch",
"2",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"add",
" ",
"the",
" ",
"appropr",
"iate",
" ",
"suff",
"ix",
" ",
"depend",
"ing",
" ",
"on",
" ",
"the",
" ",
"python",
" ",
"version_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"i_",
",_",
"fname_",
"in_",
"enumerate_",
"(_",
"files",
"\\u",
"to",
"\\u",
"compare_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"fname_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"files",
"\\u",
"to",
"\\u",
"compare_",
"[_",
"i_",
"]_",
"+=_",
"'\\u",
"dam",
"\\u",
"py",
"%",
"s",
".",
"np",
"z",
"'_",
"%_",
"PY",
"\\u",
"VER_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Wil",
"l",
" ",
"fetch",
" ",
"from",
" ",
"g",
"-",
"node",
" ",
"if",
" ",
"the",
"y",
" ",
"don",
"'",
"t",
" ",
"alr",
"ead",
"y",
" ",
"exist",
" ",
"local",
"ly_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ho",
"w",
" ",
"doe",
"s",
" ",
"it",
" ",
"know",
" ",
"to",
" ",
"do",
" ",
"this",
" ",
"bef",
"ore",
" ",
"any",
" ",
"of",
" ",
"the",
" ",
"other",
" ",
"tests",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"files",
"\\u",
"to",
"\\u",
"download_",
"=_",
"files",
"\\u",
"to",
"\\u",
"test_",
"+_",
"files",
"\\u",
"to",
"\\u",
"compare_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Brain",
"ware",
"Dam",
"IO",
"Test",
"Case_",
"(_",
"Base",
"Test",
"IO_",
",_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"test\\u",
"readi",
"ng",
"\\u",
"same_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"io",
"obj_",
",_",
"path_",
"in_",
"self_",
"._",
"iter",
"\\u",
"io",
"\\u",
"objects_",
"(_",
"return",
"\\u",
"path_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"obj",
"\\u",
"reader",
"\\u",
"base_",
"=_",
"create",
"\\u",
"gener",
"ic",
"\\u",
"reader_",
"(_",
"io",
"obj_",
",_",
"target_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj",
"\\u",
"reader",
"\\u",
"single_",
"=_",
"create",
"\\u",
"gener",
"ic",
"\\u",
"reader_",
"(_",
"io",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"obj",
"\\u",
"base_",
"=_",
"obj",
"\\u",
"reader",
"\\u",
"base_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"obj",
"\\u",
"single_",
"=_",
"obj",
"\\u",
"reader",
"\\u",
"single_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert",
"\\u",
"same",
"\\u",
"sub\\u",
"schema_",
"(_",
"obj",
"\\u",
"base_",
",_",
"obj",
"\\u",
"single_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Base",
"Exception_",
"as_",
"exc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exc_",
"._",
"args_",
"+=_",
"(_",
"'",
"from",
" ",
"'_",
"+_",
"os_",
"._",
"path_",
"._",
"basename_",
"(_",
"path_",
")_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Brain",
"ware",
"Dam",
"IO",
"Test",
"Case_",
"(_",
"Base",
"Test",
"IO_",
",_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"against",
"\\u",
"reference_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"filename_",
",_",
"refn",
"ame_",
"in_",
"zip_",
"(_",
"self_",
"._",
"files",
"\\u",
"to",
"\\u",
"test_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"files",
"\\u",
"to",
"\\u",
"compare_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"refn",
"ame_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"obj_",
"=_",
"self_",
"._",
"read",
"\\u",
"file_",
"(_",
"filename_",
"=_",
"filename_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ref",
"obj_",
"=_",
"proc",
"\\u",
"dam",
"_",
"(_",
"self_",
"._",
"get",
"\\u",
"filename",
"\\u",
"path_",
"(_",
"refn",
"ame_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert",
"\\u",
"neo",
"\\u",
"object\\u",
"is",
"\\u",
"compliant",
"_",
"(_",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"neo",
"\\u",
"object\\u",
"is",
"\\u",
"compliant",
"_",
"(_",
"ref",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert",
"\\u",
"same",
"\\u",
"sub\\u",
"schema_",
"(_",
"obj_",
",_",
"ref",
"obj_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Base",
"Exception_",
"as_",
"exc_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"exc_",
"._",
"args_",
"+=_",
"(_",
"'",
"from",
" ",
"'_",
"+_",
"filename_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | openstack/neutron/neutron/db/migration/__init__.py | [
{
"content": "# Copyright 2012 New Dream Network, LLC (DreamHost)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport contextlib\nimport functools\n\nimport alembic\nfrom alembic import context\nfrom alembic import op\nimport sqlalchemy as sa\nfrom sqlalchemy.engine import reflection\n\nfrom neutron._i18n import _\n\n# Neutron milestones for upgrade aliases\nLIBERTY = 'liberty'\nMITAKA = 'mitaka'\nNEWTON = 'newton'\n\nNEUTRON_MILESTONES = [\n # earlier milestones were not tagged\n LIBERTY,\n MITAKA,\n NEWTON,\n]\n\nCREATION_OPERATIONS = (sa.sql.ddl.CreateIndex,\n sa.sql.ddl.CreateTable,\n sa.sql.ddl.CreateColumn,\n )\nDROP_OPERATIONS = (sa.sql.ddl.DropConstraint,\n sa.sql.ddl.DropIndex,\n sa.sql.ddl.DropTable,\n alembic.ddl.base.DropColumn)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def skip_if_offline(func):\n \"\"\"Decorator for skipping migrations in offline mode.\"\"\"\n @functools.wraps(func)\n def decorator(*args, **kwargs):\n if context.is_offline_mode():\n return\n return func(*args, **kwargs)\n\n return decorator",
"metadata": "root.skip_if_offline",
"header": "['module', '___EOS___']",
"index": 47
},
{
"content": "def raise_if_offline(func):\n \"\"\"Decorator for raising if a function is called in offline mode.\"\"\"\n @functools.wraps(func)\n def decorator(*args, **kwargs):\n if context.is_offline_mode():\n raise RuntimeError(_(\"%s cannot be called while in offline mode\") %\n func.__name__)\n return func(*args, **kwargs)\n\n return decorator",
"metadata": "root.raise_if_offline",
"header": "['module', '___EOS___']",
"index": 58
},
{
"content": "@raise_if_offline\ndef schema_has_table(table_name):\n \"\"\"Check whether the specified table exists in the current schema.\n\n This method cannot be executed in offline mode.\n \"\"\"\n bind = op.get_bind()\n insp = sa.engine.reflection.Inspector.from_engine(bind)\n return table_name in insp.get_table_names()",
"metadata": "root.schema_has_table",
"header": "['module', '___EOS___']",
"index": 70
},
{
"content": "@raise_if_offline\ndef schema_has_column(table_name, column_name):\n \"\"\"Check whether the specified column exists in the current schema.\n\n This method cannot be executed in offline mode.\n \"\"\"\n bind = op.get_bind()\n insp = sa.engine.reflection.Inspector.from_engine(bind)\n # first check that the table exists\n if not schema_has_table(table_name):\n return\n # check whether column_name exists in table columns\n return column_name in [column['name'] for column in\n insp.get_columns(table_name)]",
"metadata": "root.schema_has_column",
"header": "['module', '___EOS___']",
"index": 81
},
{
"content": "@raise_if_offline\ndef alter_column_if_exists(table_name, column_name, **kwargs):\n \"\"\"Alter a column only if it exists in the schema.\"\"\"\n if schema_has_column(table_name, column_name):\n op.alter_column(table_name, column_name, **kwargs)",
"metadata": "root.alter_column_if_exists",
"header": "['module', '___EOS___']",
"index": 97
},
{
"content": "@raise_if_offline\ndef drop_table_if_exists(table_name):\n if schema_has_table(table_name):\n op.drop_table(table_name)",
"metadata": "root.drop_table_if_exists",
"header": "['module', '___EOS___']",
"index": 104
},
{
"content": "@raise_if_offline\ndef rename_table_if_exists(old_table_name, new_table_name):\n if schema_has_table(old_table_name):\n op.rename_table(old_table_name, new_table_name)",
"metadata": "root.rename_table_if_exists",
"header": "['module', '___EOS___']",
"index": 110
},
{
"content": "def alter_enum(table, column, enum_type, nullable, do_drop=True,\n do_rename=True, do_create=True):\n \"\"\"Alter a enum type column.\n\n Set the do_xx parameters only when the modified enum type\n is used by multiple columns. Else don't provide these\n parameters.\n\n :param do_drop: set to False when modified column is\n not the last one use this enum\n :param do_rename: set to False when modified column is\n not the first one use this enum\n :param do_create: set to False when modified column is\n not the first one use this enum\n \"\"\"\n bind = op.get_bind()\n engine = bind.engine\n if engine.name == 'postgresql':\n values = {'table': table,\n 'column': column,\n 'name': enum_type.name}\n if do_rename:\n op.execute(\"ALTER TYPE %(name)s RENAME TO old_%(name)s\" % values)\n if do_create:\n enum_type.create(bind, checkfirst=False)\n op.execute(\"ALTER TABLE %(table)s RENAME COLUMN %(column)s TO \"\n \"old_%(column)s\" % values)\n op.add_column(table, sa.Column(column, enum_type, nullable=nullable))\n op.execute(\"UPDATE %(table)s SET %(column)s = \"\n \"old_%(column)s::text::%(name)s\" % values)\n op.execute(\"ALTER TABLE %(table)s DROP COLUMN old_%(column)s\" % values)\n if do_drop:\n op.execute(\"DROP TYPE old_%(name)s\" % values)\n else:\n op.alter_column(table, column, type_=enum_type,\n existing_nullable=nullable)",
"metadata": "root.alter_enum",
"header": "['module', '___EOS___']",
"index": 116
},
{
"content": "def create_table_if_not_exist_psql(table_name, values):\n if op.get_bind().engine.dialect.server_version_info < (9, 1, 0):\n op.execute(\"CREATE LANGUAGE plpgsql\")\n op.execute(\"CREATE OR REPLACE FUNCTION execute(TEXT) RETURNS VOID AS $$\"\n \"BEGIN EXECUTE $1; END;\"\n \"$$ LANGUAGE plpgsql STRICT;\")\n op.execute(\"CREATE OR REPLACE FUNCTION table_exist(TEXT) RETURNS bool as \"\n \"$$ SELECT exists(select 1 from pg_class where relname=$1);\"\n \"$$ language sql STRICT;\")\n op.execute(\"SELECT execute($$CREATE TABLE %(name)s %(columns)s $$) \"\n \"WHERE NOT table_exist(%(name)r);\" %\n {'name': table_name,\n 'columns': values})",
"metadata": "root.create_table_if_not_exist_psql",
"header": "['module', '___EOS___']",
"index": 154
},
{
"content": "def remove_foreign_keys(table, foreign_keys):\n for fk in foreign_keys:\n op.drop_constraint(\n constraint_name=fk['name'],\n table_name=table,\n type_='foreignkey'\n )",
"metadata": "root.remove_foreign_keys",
"header": "['module', '___EOS___']",
"index": 169
},
{
"content": "def create_foreign_keys(table, foreign_keys):\n for fk in foreign_keys:\n op.create_foreign_key(\n constraint_name=fk['name'],\n source_table=table,\n referent_table=fk['referred_table'],\n local_cols=fk['constrained_columns'],\n remote_cols=fk['referred_columns'],\n ondelete=fk['options'].get('ondelete')\n )",
"metadata": "root.create_foreign_keys",
"header": "['module', '___EOS___']",
"index": 178
},
{
"content": "@contextlib.contextmanager\ndef remove_fks_from_table(table):\n try:\n inspector = reflection.Inspector.from_engine(op.get_bind())\n foreign_keys = inspector.get_foreign_keys(table)\n remove_foreign_keys(table, foreign_keys)\n yield\n finally:\n create_foreign_keys(table, foreign_keys)",
"metadata": "root.remove_fks_from_table",
"header": "['module', '___EOS___']",
"index": 190
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2012",
" ",
"New",
" ",
"Dre",
"am",
" ",
"Network",
",",
" ",
"LLC",
" ",
"(",
"Dre",
"am",
"Host",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
" ",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"contextlib_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"functools_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"alembic_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"alembic_",
"import_",
"context_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"alembic_",
"import_",
"op_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sqlalchemy_",
"as_",
"sa_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"sqlalchemy_",
"._",
"engine_",
"import_",
"reflection_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"neutron_",
"._",
"\\u",
"i18n_",
"import_",
"\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Neut",
"ron",
" ",
"milestone",
"s",
" ",
"for",
" ",
"upgrade",
" ",
"aliases_",
"\\u\\u\\uNL\\u\\u\\u_",
"LIB",
"ERT",
"Y_",
"=_",
"'",
"liber",
"ty",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"MIT",
"AK",
"A_",
"=_",
"'",
"mit",
"aka",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"NEW",
"TON",
"_",
"=_",
"'",
"newton",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"NEU",
"TRO",
"N",
"\\u",
"MIL",
"EST",
"ONE",
"S_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"ear",
"lie",
"r",
" ",
"milestone",
"s",
" ",
"wer",
"e",
" ",
"not",
" ",
"tagged_",
"\\u\\u\\uNL\\u\\u\\u_",
"LIB",
"ERT",
"Y_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"MIT",
"AK",
"A_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"NEW",
"TON",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"CREATI",
"ON",
"\\u",
"OPERATION",
"S_",
"=_",
"(_",
"sa_",
"._",
"sql_",
"._",
"ddl",
"_",
"._",
"Creat",
"e",
"Index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sa_",
"._",
"sql_",
"._",
"ddl",
"_",
"._",
"Creat",
"e",
"Table_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sa_",
"._",
"sql_",
"._",
"ddl",
"_",
"._",
"Creat",
"e",
"Column_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"DROP",
"\\u",
"OPERATION",
"S_",
"=_",
"(_",
"sa_",
"._",
"sql_",
"._",
"ddl",
"_",
"._",
"Drop",
"Constraint_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sa_",
"._",
"sql_",
"._",
"ddl",
"_",
"._",
"Drop",
"Index_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"sa_",
"._",
"sql_",
"._",
"ddl",
"_",
"._",
"Drop",
"Table_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"alembic_",
"._",
"ddl",
"_",
"._",
"base_",
"._",
"Drop",
"Column_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"skip",
"\\u",
"if",
"\\u",
"offline_",
"(_",
"func_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Decorat",
"or",
" ",
"for",
" ",
"skip",
"ping",
" ",
"migrati",
"ons",
" ",
"in",
" ",
"offline",
" ",
"mode",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"functools_",
"._",
"wraps_",
"(_",
"func_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"decorator_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"context_",
"._",
"is",
"\\u",
"offline",
"\\u",
"mode_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"func_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"decorator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"raise",
"\\u",
"if",
"\\u",
"offline_",
"(_",
"func_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Decorat",
"or",
" ",
"for",
" ",
"rais",
"ing",
" ",
"if",
" ",
"a",
" ",
"function",
" ",
"is",
" ",
"call",
"ed",
" ",
"in",
" ",
"offline",
" ",
"mode",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"@_",
"functools_",
"._",
"wraps_",
"(_",
"func_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"decorator_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"context_",
"._",
"is",
"\\u",
"offline",
"\\u",
"mode_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Run",
"time",
"Error_",
"(_",
"\\u_",
"(_",
"\"%",
"s",
" ",
"cann",
"ot",
" ",
"be",
" ",
"call",
"ed",
" ",
"whi",
"le",
" ",
"in",
" ",
"offline",
" ",
"mode",
"\"_",
")_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"func_",
"._",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"func_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"decorator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raise",
"\\u",
"if",
"\\u",
"offline_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"schema",
"\\u",
"has",
"\\u",
"table_",
"(_",
"table",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Check",
" ",
"whe",
"ther",
" ",
"the",
" ",
"specified",
" ",
"table",
" ",
"exist",
"s",
" ",
"in",
" ",
"the",
" ",
"current",
" ",
"schema",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"cann",
"ot",
" ",
"be",
" ",
"executed",
" ",
"in",
" ",
"offline",
" ",
"mode",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bind_",
"=_",
"op_",
"._",
"get",
"\\u",
"bind_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"insp",
"_",
"=_",
"sa_",
"._",
"engine_",
"._",
"reflection_",
"._",
"Inspector",
"_",
"._",
"from",
"\\u",
"engine_",
"(_",
"bind_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"table",
"\\u",
"name_",
"in_",
"insp",
"_",
"._",
"get",
"\\u",
"table",
"\\u",
"names_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raise",
"\\u",
"if",
"\\u",
"offline_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"schema",
"\\u",
"has",
"\\u",
"column_",
"(_",
"table",
"\\u",
"name_",
",_",
"column",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Check",
" ",
"whe",
"ther",
" ",
"the",
" ",
"specified",
" ",
"column",
" ",
"exist",
"s",
" ",
"in",
" ",
"the",
" ",
"current",
" ",
"schema",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"method",
" ",
"cann",
"ot",
" ",
"be",
" ",
"executed",
" ",
"in",
" ",
"offline",
" ",
"mode",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bind_",
"=_",
"op_",
"._",
"get",
"\\u",
"bind_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"insp",
"_",
"=_",
"sa_",
"._",
"engine_",
"._",
"reflection_",
"._",
"Inspector",
"_",
"._",
"from",
"\\u",
"engine_",
"(_",
"bind_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"first",
" ",
"check",
" ",
"tha",
"t",
" ",
"the",
" ",
"table",
" ",
"exists_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"schema",
"\\u",
"has",
"\\u",
"table_",
"(_",
"table",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"check",
" ",
"whe",
"ther",
" ",
"column",
"\\u",
"name",
" ",
"exist",
"s",
" ",
"in",
" ",
"table",
" ",
"columns_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"column",
"\\u",
"name_",
"in_",
"[_",
"column_",
"[_",
"'",
"name",
"'_",
"]_",
"for_",
"column_",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"insp",
"_",
"._",
"get",
"\\u",
"columns_",
"(_",
"table",
"\\u",
"name_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raise",
"\\u",
"if",
"\\u",
"offline_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"alter",
"\\u",
"column",
"\\u",
"if",
"\\u",
"exists_",
"(_",
"table",
"\\u",
"name_",
",_",
"column",
"\\u",
"name_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Alter",
" ",
"a",
" ",
"column",
" ",
"only",
" ",
"if",
" ",
"it",
" ",
"exist",
"s",
" ",
"in",
" ",
"the",
" ",
"schema",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"schema",
"\\u",
"has",
"\\u",
"column_",
"(_",
"table",
"\\u",
"name_",
",_",
"column",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"alter",
"\\u",
"column_",
"(_",
"table",
"\\u",
"name_",
",_",
"column",
"\\u",
"name_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raise",
"\\u",
"if",
"\\u",
"offline_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"drop",
"\\u",
"table",
"\\u",
"if",
"\\u",
"exists_",
"(_",
"table",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"schema",
"\\u",
"has",
"\\u",
"table_",
"(_",
"table",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"drop",
"\\u",
"table_",
"(_",
"table",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"raise",
"\\u",
"if",
"\\u",
"offline_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"rename",
"\\u",
"table",
"\\u",
"if",
"\\u",
"exists_",
"(_",
"old",
"\\u",
"table",
"\\u",
"name_",
",_",
"new",
"\\u",
"table",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"schema",
"\\u",
"has",
"\\u",
"table_",
"(_",
"old",
"\\u",
"table",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"rename",
"\\u",
"table_",
"(_",
"old",
"\\u",
"table",
"\\u",
"name_",
",_",
"new",
"\\u",
"table",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"alter",
"\\u",
"enum_",
"(_",
"table_",
",_",
"column_",
",_",
"enum",
"\\u",
"type_",
",_",
"nullable_",
",_",
"do",
"\\u",
"drop_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"do",
"\\u",
"rename_",
"=_",
"True_",
",_",
"do",
"\\u",
"create_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Alter",
" ",
"a",
" ",
"enum",
" ",
"type",
" ",
"column",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Set",
" ",
"the",
" ",
"do",
"\\u",
"xx",
" ",
"parameter",
"s",
" ",
"only",
" ",
"whe",
"n",
" ",
"the",
" ",
"modifi",
"ed",
" ",
"enum",
" ",
"type",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"is",
" ",
"used",
" ",
"by",
" ",
"multiple",
" ",
"column",
"s",
".",
" ",
"Else",
" ",
"don",
"'",
"t",
" ",
"provide",
" ",
"these",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"parameter",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"do",
"\\u",
"drop",
":",
" ",
"set",
" ",
"to",
" ",
"Fal",
"se",
" ",
"whe",
"n",
" ",
"modifi",
"ed",
" ",
"column",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"not",
" ",
"the",
" ",
"last",
" ",
"one",
" ",
"use",
" ",
"this",
" ",
"enum",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"do",
"\\u",
"rename",
":",
" ",
"set",
" ",
"to",
" ",
"Fal",
"se",
" ",
"whe",
"n",
" ",
"modifi",
"ed",
" ",
"column",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"not",
" ",
"the",
" ",
"first",
" ",
"one",
" ",
"use",
" ",
"this",
" ",
"enum",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"param",
" ",
"do",
"\\u",
"create",
":",
" ",
"set",
" ",
"to",
" ",
"Fal",
"se",
" ",
"whe",
"n",
" ",
"modifi",
"ed",
" ",
"column",
" ",
"is",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"not",
" ",
"the",
" ",
"first",
" ",
"one",
" ",
"use",
" ",
"this",
" ",
"enum",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"bind_",
"=_",
"op_",
"._",
"get",
"\\u",
"bind_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"engine_",
"=_",
"bind_",
"._",
"engine_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"engine_",
"._",
"name_",
"==_",
"'",
"postgres",
"ql",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"values_",
"=_",
"{_",
"'",
"table",
"'_",
":_",
"table_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"column",
"'_",
":_",
"column_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"enum",
"\\u",
"type_",
"._",
"name_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"do",
"\\u",
"rename_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"execute_",
"(_",
"\"",
"ALT",
"ER",
" ",
"TYPE",
" ",
"%",
"(",
"name",
")",
"s",
" ",
"RENA",
"ME",
" ",
"TO",
" ",
"old",
"\\u",
"%",
"(",
"name",
")",
"s",
"\"_",
"%_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"do",
"\\u",
"create_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"enum",
"\\u",
"type_",
"._",
"create_",
"(_",
"bind_",
",_",
"check",
"first_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"op_",
"._",
"execute_",
"(_",
"\"",
"ALT",
"ER",
" ",
"TAB",
"LE",
" ",
"%",
"(",
"table",
")",
"s",
" ",
"RENA",
"ME",
" ",
"COL",
"UM",
"N",
" ",
"%",
"(",
"column",
")",
"s",
" ",
"TO",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"old",
"\\u",
"%",
"(",
"column",
")",
"s",
"\"_",
"%_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"op_",
"._",
"add",
"\\u",
"column_",
"(_",
"table_",
",_",
"sa_",
"._",
"Column_",
"(_",
"column_",
",_",
"enum",
"\\u",
"type_",
",_",
"nullable_",
"=_",
"nullable_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"op_",
"._",
"execute_",
"(_",
"\"",
"UPDATE",
" ",
"%",
"(",
"table",
")",
"s",
" ",
"SET",
" ",
"%",
"(",
"column",
")",
"s",
" ",
"=",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"old",
"\\u",
"%",
"(",
"column",
")",
"s",
"::",
"text",
"::",
"%",
"(",
"name",
")",
"s",
"\"_",
"%_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"op_",
"._",
"execute_",
"(_",
"\"",
"ALT",
"ER",
" ",
"TAB",
"LE",
" ",
"%",
"(",
"table",
")",
"s",
" ",
"DROP",
" ",
"COL",
"UM",
"N",
" ",
"old",
"\\u",
"%",
"(",
"column",
")",
"s",
"\"_",
"%_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"do",
"\\u",
"drop_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"execute_",
"(_",
"\"",
"DROP",
" ",
"TYPE",
" ",
"old",
"\\u",
"%",
"(",
"name",
")",
"s",
"\"_",
"%_",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"alter",
"\\u",
"column_",
"(_",
"table_",
",_",
"column_",
",_",
"type\\u_",
"=_",
"enum",
"\\u",
"type_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"exist",
"ing",
"\\u",
"nullable_",
"=_",
"nullable_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"table",
"\\u",
"if",
"\\u",
"not",
"\\u",
"exist",
"\\u",
"psql",
"_",
"(_",
"table",
"\\u",
"name_",
",_",
"values_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"op_",
"._",
"get",
"\\u",
"bind_",
"(_",
")_",
"._",
"engine_",
"._",
"dialect_",
"._",
"server",
"\\u",
"version",
"\\u",
"info_",
"<_",
"(_",
"9_",
",_",
"1_",
",_",
"0_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"execute_",
"(_",
"\"",
"CREATE",
" ",
"LANGUAGE",
" ",
"pl",
"pgs",
"ql",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"op_",
"._",
"execute_",
"(_",
"\"",
"CREATE",
" ",
"OR",
" ",
"REPLACE",
" ",
"FUNC",
"TIO",
"N",
" ",
"execute",
"(",
"TEXT",
")",
" ",
"RETURN",
"S",
" ",
"VOID",
" ",
"AS",
" ",
"$$",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"BEGIN",
" ",
"EXECUTE",
" ",
"$",
"1",
";",
" ",
"END",
";\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"$",
"$",
" ",
"LANGUAGE",
" ",
"pl",
"pgs",
"ql",
" ",
"STRI",
"CT",
";\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"op_",
"._",
"execute_",
"(_",
"\"",
"CREATE",
" ",
"OR",
" ",
"REPLACE",
" ",
"FUNC",
"TIO",
"N",
" ",
"table",
"\\u",
"exist",
"(",
"TEXT",
")",
" ",
"RETURN",
"S",
" ",
"bool",
" ",
"as",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"$",
"$",
" ",
"SELECT",
" ",
"exist",
"s",
"(",
"select",
" ",
"1",
" ",
"from",
" ",
"pg",
"\\u",
"class",
" ",
"where",
" ",
"rel",
"name",
"=$",
"1",
");\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"$",
"$",
" ",
"language",
" ",
"sql",
" ",
"STRI",
"CT",
";\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"op_",
"._",
"execute_",
"(_",
"\"",
"SELECT",
" ",
"execute",
"($",
"$",
"CREATE",
" ",
"TAB",
"LE",
" ",
"%",
"(",
"name",
")",
"s",
" ",
"%",
"(",
"column",
"s",
")",
"s",
" ",
"$$",
")",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"WHE",
"RE",
" ",
"NOT",
" ",
"table",
"\\u",
"exist",
"(%",
"(",
"name",
")",
"r",
");\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"'",
"name",
"'_",
":_",
"table",
"\\u",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"column",
"s",
"'_",
":_",
"values_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"remove",
"\\u",
"foreign",
"\\u",
"keys_",
"(_",
"table_",
",_",
"foreign",
"\\u",
"keys_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"fk_",
"in_",
"foreign",
"\\u",
"keys_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"drop",
"\\u",
"constraint_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"constraint",
"\\u",
"name_",
"=_",
"fk_",
"[_",
"'",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"table",
"\\u",
"name_",
"=_",
"table_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"type\\u_",
"=_",
"'",
"foreign",
"key",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"create",
"\\u",
"foreign",
"\\u",
"keys_",
"(_",
"table_",
",_",
"foreign",
"\\u",
"keys_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"fk_",
"in_",
"foreign",
"\\u",
"keys_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"op_",
"._",
"create",
"\\u",
"foreign",
"\\u",
"key_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"constraint",
"\\u",
"name_",
"=_",
"fk_",
"[_",
"'",
"name",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"source",
"\\u",
"table_",
"=_",
"table_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"referen",
"t",
"\\u",
"table_",
"=_",
"fk_",
"[_",
"'",
"referred",
"\\u",
"table",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"local",
"\\u",
"cols_",
"=_",
"fk_",
"[_",
"'",
"constrained",
"\\u",
"column",
"s",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"remote",
"\\u",
"cols_",
"=_",
"fk_",
"[_",
"'",
"referred",
"\\u",
"column",
"s",
"'_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"ondelete_",
"=_",
"fk_",
"[_",
"'",
"options",
"'_",
"]_",
"._",
"get_",
"(_",
"'",
"onde",
"lete",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"contextlib_",
"._",
"contextmanager_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"remove",
"\\u",
"fk",
"s",
"\\u",
"from",
"\\u",
"table_",
"(_",
"table_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"inspector_",
"=_",
"reflection_",
"._",
"Inspector",
"_",
"._",
"from",
"\\u",
"engine_",
"(_",
"op_",
"._",
"get",
"\\u",
"bind_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"foreign",
"\\u",
"keys_",
"=_",
"inspector_",
"._",
"get",
"\\u",
"foreign",
"\\u",
"keys_",
"(_",
"table_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"remove",
"\\u",
"foreign",
"\\u",
"keys_",
"(_",
"table_",
",_",
"foreign",
"\\u",
"keys_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"yield_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"finally_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"create",
"\\u",
"foreign",
"\\u",
"keys_",
"(_",
"table_",
",_",
"foreign",
"\\u",
"keys_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | openstack/openstack-doc-tools/cleanup/retf/retf.py | [
{
"content": "def generate_listing(src):\n \"\"\"Compile all regular expressions in a RETF listing.\"\"\"\n logger = logging.getLogger('retf')\n result = []\n\n soup = soupify_listing(src)\n\n for typo in soup.findAll('typo'):\n try:\n word = typo.attrs.get('word').encode('utf8')\n find = typo.attrs.get('find').encode('utf8')\n replace = typo.attrs.get('replace').encode('utf8')\n replace = replace.replace(b'$', b'\\\\')\n except AttributeError:\n continue\n\n # pylint: disable=W0703\n try:\n logger.debug(\"Compiling regular expression: %s.\", find)\n compiled = regex.compile(find, flags=regex.V1)\n except Exception:\n logger.error(\"Compilation of regular expression %f failed.\", find)\n continue\n # pylint: enable=W0703\n\n entry = {\n 'description': word,\n 'find': find,\n 'replace': replace,\n 'regex': compiled\n }\n\n result.append(entry)\n\n logger.debug(\"Compiled %d regular expression(s).\", len(result))\n\n return result",
"metadata": "root.generate_listing",
"header": "['module', '___EOS___']",
"index": 77
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"generat",
"e\\u",
"listing_",
"(_",
"src_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Compil",
"e",
" ",
"all",
" ",
"regular",
" ",
"express",
"ion",
"s",
" ",
"in",
" ",
"a",
" ",
"RET",
"F",
" ",
"listi",
"ng",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"'",
"ret",
"f",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"soup_",
"=_",
"soup",
"if",
"y",
"\\u",
"listing_",
"(_",
"src_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"for_",
"typo",
"_",
"in_",
"soup_",
"._",
"find",
"All_",
"(_",
"'",
"typo",
"'_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"word_",
"=_",
"typo",
"_",
"._",
"attrs_",
"._",
"get_",
"(_",
"'",
"word",
"'_",
")_",
"._",
"encode_",
"(_",
"'",
"utf",
"8",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"find_",
"=_",
"typo",
"_",
"._",
"attrs_",
"._",
"get_",
"(_",
"'",
"find",
"'_",
")_",
"._",
"encode_",
"(_",
"'",
"utf",
"8",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"replace_",
"=_",
"typo",
"_",
"._",
"attrs_",
"._",
"get_",
"(_",
"'",
"replace",
"'_",
")_",
"._",
"encode_",
"(_",
"'",
"utf",
"8",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"replace_",
"=_",
"replace_",
"._",
"replace_",
"(_",
"b",
"'$'_",
",_",
"b",
"'\\\\\\\\'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Attribute",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"pylint",
":",
" ",
"disable",
"=",
"W",
"070",
"3_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"debug_",
"(_",
"\"",
"Compil",
"ing",
" ",
"regular",
" ",
"express",
"ion",
":",
" ",
"%",
"s",
".\"_",
",_",
"find_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"compiled_",
"=_",
"regex_",
"._",
"compile_",
"(_",
"find_",
",_",
"flags_",
"=_",
"regex_",
"._",
"V1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Exception_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"error_",
"(_",
"\"",
"Compil",
"ation",
" ",
"of",
" ",
"regular",
" ",
"express",
"ion",
" ",
"%",
"f",
" ",
"fail",
"ed",
".\"_",
",_",
"find_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"pylint",
":",
" ",
"enable",
"=",
"W",
"070",
"3_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"entry_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"description",
"'_",
":_",
"word_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"find",
"'_",
":_",
"find_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"replace",
"'_",
":_",
"replace_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"regex",
"'_",
":_",
"compiled_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"result_",
"._",
"append_",
"(_",
"entry_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logger_",
"._",
"debug_",
"(_",
"\"",
"Compiled",
" ",
"%",
"d",
" ",
"regular",
" ",
"express",
"ion",
"(",
"s",
").\"_",
",_",
"len_",
"(_",
"result_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | splunk/splunk-app-twitter/twitter2/bin/verify_twitter_oauth_settings.py | [
{
"content": "#!/usr/bin/env python\n#\n# Copyright 2012 Splunk, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"): you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"\nVerifies whether a set of Twitter credentials are valid.\n\nThis script is invoked by `forms.py` whenever the user inputs new credentials\non the Twitter app's setup page. If the credentials are deemed invalid,\nan error message will be presented to the user at the time the credentials\nare entered.\n\"\"\"\n\nfrom twython import Twython, TwythonError\nimport sys\n\n\nif __name__ == '__main__':\n sys.exit(main(sys.argv))\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "def main(args):\n (_, api_key, api_secret, access_token, access_token_secret) = args\n \n twitter = Twython(\n app_key=api_key,\n app_secret=api_secret,\n oauth_token=access_token,\n oauth_token_secret=access_token_secret)\n try:\n twitter.verify_credentials()\n except TwythonError:\n # Invalid credentials\n return 1\n \n # Okay\n return 0",
"metadata": "root.main",
"header": "['module', '___EOS___']",
"index": 28
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#!",
"/",
"usr",
"/",
"bin",
"/",
"env",
" ",
"python_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"2012",
" ",
"Spl",
"unk",
",",
" ",
"Inc",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\"):",
" ",
"you",
" ",
"may",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
".",
" ",
"You",
" ",
"may",
" ",
"obtain",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",",
" ",
"WITH",
"OUT_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
".",
" ",
"See",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and",
" ",
"limit",
"ations_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"\"\"",
"\\",
"10",
";",
"Verifie",
"s",
" ",
"whe",
"ther",
" ",
"a",
" ",
"set",
" ",
"of",
" ",
"Twit",
"ter",
" ",
"cred",
"ential",
"s",
" ",
"are",
" ",
"valid",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Thi",
"s",
" ",
"script",
" ",
"is",
" ",
"invoke",
"d",
" ",
"by",
" ",
"`",
"forms",
".",
"py",
"`",
" ",
"whe",
"neve",
"r",
" ",
"the",
" ",
"user",
" ",
"inputs",
" ",
"new",
" ",
"cred",
"ential",
"s",
"\\",
"10",
";",
"on",
" ",
"the",
" ",
"Twit",
"ter",
" ",
"app",
"'",
"s",
" ",
"setup",
" ",
"page",
".",
" ",
"If",
" ",
"the",
" ",
"cred",
"ential",
"s",
" ",
"are",
" ",
"dee",
"med",
" ",
"invalid",
",",
"\\",
"10",
";",
"an",
" ",
"error",
" ",
"message",
" ",
"will",
" ",
"be",
" ",
"presente",
"d",
" ",
"to",
" ",
"the",
" ",
"user",
" ",
"at",
" ",
"the",
" ",
"time",
" ",
"the",
" ",
"cred",
"ential",
"s",
"\\",
"10",
";",
"are",
" ",
"enter",
"ed",
".",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"tw",
"ython_",
"import_",
"Tw",
"ython_",
",_",
"Tw",
"yth",
"on",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"sys_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"\\u\\u",
"name\\u\\u_",
"==_",
"'\\u",
"\\u",
"main",
"\\u\\u'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"exit_",
"(_",
"main_",
"(_",
"sys_",
"._",
"argv_",
")_",
")_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"main_",
"(_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"(_",
"\\u_",
",_",
"api",
"\\u",
"key_",
",_",
"api",
"\\u",
"secret_",
",_",
"access",
"\\u",
"token_",
",_",
"access",
"\\u",
"token",
"\\u",
"secret_",
")_",
"=_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"twitter_",
"=_",
"Tw",
"ython_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"app",
"\\u",
"key_",
"=_",
"api",
"\\u",
"key_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"app",
"\\u",
"secret_",
"=_",
"api",
"\\u",
"secret_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"oauth",
"\\u",
"token_",
"=_",
"access",
"\\u",
"token_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"oauth",
"\\u",
"token",
"\\u",
"secret_",
"=_",
"access",
"\\u",
"token",
"\\u",
"secret_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"twitter_",
"._",
"verify",
"\\u",
"credentials_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Tw",
"yth",
"on",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Inva",
"lid",
" ",
"credentials_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Ok",
"ay_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Modification of dictionary returned by locals() | keithmoss/Hodor/hodor/httplib2_patch.py | [
{
"content": "def perf__read_status(self):\n b = self.fp.read(1)\n # this is our first byte, mark it's time\n self._stop_time = time.time()\n # write back the byte we read to the internal buffer so that it can\n # be used for the status line.\n self.fp._rbuf.write(b)\n return httplib__HTTPResponse__read_status(self)",
"metadata": "root.perf__read_status",
"header": "['module', '___EOS___']",
"index": 35
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Modifica",
"tion_",
"of_",
"dictionary_",
"returned_",
"by_",
"locals_",
"(_",
")_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"perf",
"\\u\\u",
"read",
"\\u",
"status_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"b_",
"=_",
"self_",
"._",
"fp_",
"._",
"read_",
"(_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"this",
" ",
"is",
" ",
"our",
" ",
"first",
" ",
"byte",
",",
" ",
"mark",
" ",
"it",
"'",
"s",
" ",
"time_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"stop",
"\\u",
"time_",
"=_",
"time_",
"._",
"time_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"write",
" ",
"back",
" ",
"the",
" ",
"byte",
" ",
"we",
" ",
"read",
" ",
"to",
" ",
"the",
" ",
"internal",
" ",
"buffer",
" ",
"so",
" ",
"tha",
"t",
" ",
"it",
" ",
"can_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"be",
" ",
"used",
" ",
"for",
" ",
"the",
" ",
"status",
" ",
"line",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"fp_",
"._",
"\\u",
"rbu",
"f_",
"._",
"write_",
"(_",
"b_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"http",
"lib",
"\\u\\u",
"HTTP",
"Respons",
"e\\u",
"\\u",
"read",
"\\u",
"status_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Except block handles 'BaseException' | LarsMichelsen/pmatic/ccu_pkg/python/lib/python2.7/email/encoders.py | [
{
"content": "def encode_7or8bit(msg):\n \"\"\"Set the Content-Transfer-Encoding header to 7bit or 8bit.\"\"\"\n orig = msg.get_payload()\n if orig is None:\n # There's no payload. For backwards compatibility we use 7bit\n msg['Content-Transfer-Encoding'] = '7bit'\n return\n # We play a trick to make this go fast. If encoding to ASCII succeeds, we\n # know the data must be 7bit, otherwise treat it as 8bit.\n try:\n orig.encode('ascii')\n except UnicodeError:\n msg['Content-Transfer-Encoding'] = '8bit'\n else:\n msg['Content-Transfer-Encoding'] = '7bit'",
"metadata": "root.encode_7or8bit",
"header": "['module', '___EOS___']",
"index": 62
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Except",
"_",
"block_",
"handles_",
"'",
"Base",
"Except",
"ion",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"encode",
"\\u",
"7",
"or",
"8b",
"it_",
"(_",
"msg_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Set",
" ",
"the",
" ",
"Conten",
"t",
"-",
"Transfer",
"-",
"Enco",
"ding",
" ",
"header",
" ",
"to",
" ",
"7b",
"it",
" ",
"or",
" ",
"8b",
"it",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"orig_",
"=_",
"msg_",
"._",
"get",
"\\u",
"payload_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"orig_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"There",
"'",
"s",
" ",
"no",
" ",
"payload",
".",
" ",
" ",
"For",
" ",
"back",
"ward",
"s",
" ",
"compatibility",
" ",
"we",
" ",
"use",
" ",
"7b",
"it_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"[_",
"'",
"Conten",
"t",
"-",
"Transfer",
"-",
"Enco",
"ding",
"'_",
"]_",
"=_",
"'",
"7b",
"it",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"We",
" ",
"play",
" ",
"a",
" ",
"trick",
" ",
"to",
" ",
"make",
" ",
"this",
" ",
"go",
" ",
"fast",
".",
" ",
" ",
"If",
" ",
"encoding",
" ",
"to",
" ",
"ASCII",
" ",
"succeeds",
",",
" ",
"we",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"know",
" ",
"the",
" ",
"data",
" ",
"must",
" ",
"be",
" ",
"7b",
"it",
",",
" ",
"other",
"wis",
"e",
" ",
"treat",
" ",
"it",
" ",
"as",
" ",
"8b",
"it",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"orig_",
"._",
"encode_",
"(_",
"'",
"ascii",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Unic",
"ode",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"[_",
"'",
"Conten",
"t",
"-",
"Transfer",
"-",
"Enco",
"ding",
"'_",
"]_",
"=_",
"'",
"8b",
"it",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"msg_",
"[_",
"'",
"Conten",
"t",
"-",
"Transfer",
"-",
"Enco",
"ding",
"'_",
"]_",
"=_",
"'",
"7b",
"it",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | andialbrecht/sqlparse/sqlparse/filters.py | [
{
"content": " def process(self, stack, stmt):\n self.count += 1\n if self.count > 1:\n varname = '%s%d' % (self.varname, self.count)\n else:\n varname = self.varname\n\n has_nl = len(u(stmt).strip().splitlines()) > 1\n stmt.tokens = self._process(stmt.tokens, varname, has_nl)\n return stmt",
"metadata": "root.OutputFilter.process",
"header": "['class', 'OutputFilter', ':', '___EOS___']",
"index": 595
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Output",
"Filter_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"process_",
"(_",
"self_",
",_",
"stack_",
",_",
"stmt_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"count_",
"+=_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"count_",
">_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"varname_",
"=_",
"'%",
"s",
"%",
"d",
"'_",
"%_",
"(_",
"self_",
"._",
"varname_",
",_",
"self_",
"._",
"count_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"varname_",
"=_",
"self_",
"._",
"varname_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"has",
"\\u",
"nl_",
"=_",
"len_",
"(_",
"u_",
"(_",
"stmt_",
")_",
"._",
"strip_",
"(_",
")_",
"._",
"splitlines_",
"(_",
")_",
")_",
">_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"stmt_",
"._",
"tokens_",
"=_",
"self_",
"._",
"\\u",
"process_",
"(_",
"stmt_",
"._",
"tokens_",
",_",
"varname_",
",_",
"has",
"\\u",
"nl_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"stmt_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Insecure temporary file | pfnet/chainer/tests/chainer_tests/serializers_tests/test_npz.py | [
{
"content": " def setUp(self):\n fd, path = tempfile.mkstemp()\n os.close(fd)\n self.temp_file_path = path\n with open(path, 'wb') as f:\n savez = numpy.savez_compressed if self.compress else numpy.savez\n savez(f, None)",
"metadata": "root.TestLoadNpz.setUp",
"header": "['class', 'TestLoadNpz', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 156
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Inse",
"cure",
"_",
"temporar",
"y_",
"file_",
"[SEP]_",
"class_",
"Test",
"Load",
"Np",
"z_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"set",
"Up_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"fd_",
",_",
"path_",
"=_",
"tempfile_",
"._",
"mkstemp_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"os_",
"._",
"close_",
"(_",
"fd_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"temp",
"\\u",
"file",
"\\u",
"path_",
"=_",
"path_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"with_",
"open_",
"(_",
"path_",
",_",
"'",
"wb",
"'_",
")_",
"as_",
"f_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"save",
"z_",
"=_",
"numpy_",
"._",
"save",
"z",
"\\u",
"compressed_",
"if_",
"self_",
"._",
"compress_",
"else_",
"numpy_",
"._",
"save",
"z_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"save",
"z_",
"(_",
"f_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Imprecise assert | mozilla/moztrap/tests/view/manage/tags/test_forms.py | [
{
"content": " def test_edit_cases(self):\n \"\"\"Can edit cases of a tag.\"\"\"\n pv = self.F.ProductVersionFactory()\n t = self.F.TagFactory(product=pv.product)\n t.caseversions.add(self.F.CaseVersionFactory(productversion=pv))\n cv_new = self.F.CaseVersionFactory(productversion=pv)\n\n f = self.form(\n {\n \"product\": str(t.product.id),\n \"name\": t.name,\n \"description\": t.description,\n \"caseversions\": [str(cv_new.id)],\n \"cc_version\": str(t.cc_version),\n },\n instance=t,\n )\n\n self.assertTrue(f.is_valid())\n tag = f.save()\n\n self.assertEqual(set(tag.caseversions.all()), set([cv_new]))",
"metadata": "root.EditTagFormTest.test_edit_cases",
"header": "['class', 'EditTagFormTest', '(', 'case', '.', 'DBTestCase', ')', ':', '___EOS___']",
"index": 130
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Imp",
"reci",
"se_",
"assert_",
"[SEP]_",
"class_",
"Edit",
"Ta",
"g",
"Form",
"Test_",
"(_",
"case_",
"._",
"DB",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"edit",
"\\u",
"cases_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Can",
" ",
"edit",
" ",
"case",
"s",
" ",
"of",
" ",
"a",
" ",
"tag",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pv_",
"=_",
"self_",
"._",
"F_",
"._",
"Product",
"Version",
"Factory_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"t_",
"=_",
"self_",
"._",
"F_",
"._",
"Ta",
"g",
"Factory_",
"(_",
"product_",
"=_",
"pv_",
"._",
"product_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"t_",
"._",
"case",
"versions_",
"._",
"add_",
"(_",
"self_",
"._",
"F_",
"._",
"Case",
"Version",
"Factory_",
"(_",
"product",
"version_",
"=_",
"pv_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cv",
"\\u",
"new_",
"=_",
"self_",
"._",
"F_",
"._",
"Case",
"Version",
"Factory_",
"(_",
"product",
"version_",
"=_",
"pv_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"f_",
"=_",
"self_",
"._",
"form_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"product",
"\"_",
":_",
"str_",
"(_",
"t_",
"._",
"product_",
"._",
"id_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"name",
"\"_",
":_",
"t_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"description",
"\"_",
":_",
"t_",
"._",
"description_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"case",
"version",
"s",
"\"_",
":_",
"[_",
"str_",
"(_",
"cv",
"\\u",
"new_",
"._",
"id_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"cc",
"\\u",
"version",
"\"_",
":_",
"str_",
"(_",
"t_",
"._",
"cc",
"\\u",
"version_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"instance_",
"=_",
"t_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"True_",
"(_",
"f_",
"._",
"is",
"\\u",
"valid_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"tag_",
"=_",
"f_",
"._",
"save_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"set_",
"(_",
"tag_",
"._",
"case",
"versions_",
"._",
"all_",
"(_",
")_",
")_",
",_",
"set_",
"(_",
"[_",
"cv",
"\\u",
"new_",
"]_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unreachable code | dsiroky/snakemq/snakemq/packeter.py | [
{
"content": " def get_packets(self):\n \"\"\"\n :return: list of fully received packets\n \"\"\"\n packets = []\n while self.size:\n if self.packet_size is None:\n if self.size < SIZEOF_BIN_SIZE:\n # wait for more data\n break\n header = self.get(SIZEOF_BIN_SIZE, True)\n self.packet_size = bin_to_size(header)\n if self.packet_size < 0:\n raise SnakeMQBrokenPacket(\"wrong packet header\")\n else:\n if self.size < self.packet_size:\n # wait for more data\n break\n packets.append(self.get(self.packet_size, True))\n self.packet_size = None\n\n return packets",
"metadata": "root.ReceiveBuffer.get_packets",
"header": "['class', 'ReceiveBuffer', '(', 'StreamBuffer', ')', ':', '___EOS___']",
"index": 50
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Unrea",
"chab",
"le_",
"code_",
"[SEP]_",
"class_",
"Receive",
"Buffer_",
"(_",
"Stream",
"Buffer_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"packets_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
":",
"return",
":",
" ",
"list",
" ",
"of",
" ",
"full",
"y",
" ",
"receive",
"d",
" ",
"packet",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"packets_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"while_",
"self_",
"._",
"size_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"packet",
"\\u",
"size_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"size_",
"<_",
"SIZE",
"OF",
"\\u",
"BIN",
"\\u",
"SIZE_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"wait",
" ",
"for",
" ",
"more",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"header_",
"=_",
"self_",
"._",
"get_",
"(_",
"SIZE",
"OF",
"\\u",
"BIN",
"\\u",
"SIZE_",
",_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"packet",
"\\u",
"size_",
"=_",
"bin",
"\\u",
"to",
"\\u",
"size_",
"(_",
"header_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"packet",
"\\u",
"size_",
"<_",
"0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"raise_",
"Sna",
"ke",
"MQ",
"Bro",
"ken",
"Packet_",
"(_",
"\"",
"wrong",
" ",
"packet",
" ",
"header",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"size_",
"<_",
"self_",
"._",
"packet",
"\\u",
"size_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"wait",
" ",
"for",
" ",
"more",
" ",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"packets_",
"._",
"append_",
"(_",
"self_",
"._",
"get_",
"(_",
"self_",
"._",
"packet",
"\\u",
"size_",
",_",
"True_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"packet",
"\\u",
"size_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"packets_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | codefordurham/Durham-Restaurants/eatsmart/urls.py | [
{
"content": "from django.conf import settings\nfrom django.conf.urls import patterns, include, url\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\nfrom django.views.generic import TemplateView\n\nfrom tastypie.api import Api\nfrom inspections.api import resources\n\n\nadmin.autodiscover()\nv1_api = Api(api_name='v1')\nv1_api.register(resources.EstablishmentResource())\nv1_api.register(resources.InspectionResource())\nv1_api.register(resources.ViolationResource())\n\n\nurlpatterns = patterns('',\n url(r'^admin/', include(admin.site.urls)),\n url(r'^about/', TemplateView.as_view(template_name=\"about.html\"),\n name='about'),\n (r'^api/', include(v1_api.urls)),\n url(r'^users/', include('users.urls')),\n url(r'', include('inspections.urls')),\n) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"import_",
"patterns_",
",_",
"include_",
",_",
"url_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"._",
"urls_",
"._",
"static_",
"import_",
"static_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"contrib_",
"import_",
"admin_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"views_",
"._",
"generic_",
"import_",
"Templa",
"te",
"View_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"tast",
"ypi",
"e_",
"._",
"api_",
"import_",
"Api_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"inspection",
"s_",
"._",
"api_",
"import_",
"resources_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"admin_",
"._",
"autodiscover",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v1",
"\\u",
"api_",
"=_",
"Api_",
"(_",
"api",
"\\u",
"name_",
"=_",
"'",
"v1",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v1",
"\\u",
"api_",
"._",
"register_",
"(_",
"resources_",
"._",
"Esta",
"blis",
"hm",
"ent",
"Resource_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v1",
"\\u",
"api_",
"._",
"register_",
"(_",
"resources_",
"._",
"Inspect",
"ion",
"Resource_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"v1",
"\\u",
"api_",
"._",
"register_",
"(_",
"resources_",
"._",
"Violation",
"Resource_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"urlpatterns_",
"=_",
"patterns_",
"(_",
"''_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"r",
"'",
"^",
"admin",
"/'_",
",_",
"include_",
"(_",
"admin_",
"._",
"site_",
"._",
"urls_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"r",
"'",
"^",
"abo",
"ut",
"/'_",
",_",
"Templa",
"te",
"View_",
"._",
"as",
"\\u",
"view_",
"(_",
"template",
"\\u",
"name_",
"=_",
"\"",
"abo",
"ut",
".",
"html",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"name_",
"=_",
"'",
"abo",
"ut",
"'_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"r",
"'",
"^",
"api",
"/'_",
",_",
"include_",
"(_",
"v1",
"\\u",
"api_",
"._",
"urls_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"r",
"'",
"^",
"users",
"/'_",
",_",
"include_",
"(_",
"'",
"users",
".",
"urls",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"url_",
"(_",
"r",
"''_",
",_",
"include_",
"(_",
"'",
"inspection",
"s",
".",
"urls",
"'_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"+_",
"static_",
"(_",
"settings_",
"._",
"MEDIA",
"\\u",
"URL_",
",_",
"document",
"\\u",
"root_",
"=_",
"settings_",
"._",
"MEDIA",
"\\u",
"ROOT_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Modification of dictionary returned by locals() | bloomreach/zinc/zinc.py | [
{
"content": " @log_calls\n def track(self, scope, track_path_list=[], mode=None, no_download=False, recursive=False):\n '''Update working directory. track_path_list is a list of filenames to track.'''\n # If mode is unspecified, use the mode that the given scope currently in\n if mode is None:\n partial_mode = self.get_scope_mode(scope) == Mode.PARTIAL\n if not partial_mode and track_path_list:\n raise InvalidOperation(\"scope %s is not in tracking mode %s; cannot track files\" % (scope, Mode.PARTIAL))\n else:\n partial_mode = mode == Mode.PARTIAL and (len(track_path_list) > 0 or self.get_scope_mode(scope) != Mode.PARTIAL)\n partial2auto_mode = self.get_scope_mode(scope) == Mode.PARTIAL and mode == Mode.AUTO and len(track_path_list) == 0\n # Error checking\n if not (partial_mode or partial2auto_mode):\n raise InvalidOperation(\"scope %s is already in %s mode; specyfing mode %s does not make much sense\" % (scope, Mode.AUTO, mode))\n # Get manifest for working dir\n cur_rev = self.get_checkout_rev(scope)\n mf = self.repo.get_manifest(scope, cur_rev)\n\n # We need any local file changes even we are not tracking them in order to avoid overwriting\n # the files that have the same name in the scope; I.e., use mode=Mode.AUTO when in partial_mode\n status_changelist = self.status(scope, force_mode=Mode.AUTO)\n\n # Find out what files we need to update.\n changelist = changelist_for_items([], mf.items)\n log.debug(\"update from %s, changing %s\", mf, changelist)\n track_changelist = Changelist()\n # Filter down the changelist if checking out / track only specified files\n if partial_mode:\n self.update_scope_mode(scope, Mode.PARTIAL)\n log.info(\"%s: scope '%s' at revision %s in tracking mode '%s'\", \"track\", scope, mf.rev, Mode.PARTIAL)\n path_candidates = [item.path for item in mf.items] + list(status_changelist.add_paths)\n for path in expand_wildcards(track_path_list, path_candidates, recursive=recursive):\n with self._yield_fingerprint(scope, path) as (fp, local_path):\n if fp is not None and fp.state in FileStateTrackedList:\n log.warn(\"Warning: scope %s path %s is already %s\", scope, path, fp.state)\n changelist.discard(path)\n else:\n track_changelist.update(path, Changelist.Status.ADDED)\n changelist = changelist.intersect(track_changelist)\n\n # if changing mode from auto to partial, register it\n if partial2auto_mode:\n self.update_scope_mode(scope, Mode.AUTO)\n log.info(\"%s: scope '%s' at revision %s in tracking mode '%s'\", \"track\", scope, mf.rev, Mode.AUTO)\n\n # mod_changelist is for files that manifest has but locally modified or deleted\n mod_changelist = status_changelist.intersect(changelist)\n # add_changelist is for files that manifest does no have but locally newlly added\n add_changelist = track_changelist.difference(changelist)\n # retrack_changelist is for files that has been untracked but brought back to be tracked\n retrack_changelist = changelist.difference(mod_changelist)\n retrack_changelist_paths = retrack_changelist.all_paths()\n for path in retrack_changelist_paths:\n with self._yield_fingerprint(scope, path) as (fp, local_path):\n if fp is not None and fp.state in FileStateTrackedList:\n # do not include paths that are already tracked since the file should be there\n self.checkout_state._check_file_exists(local_path) # sanity check\n retrack_changelist.discard(path)\n log.debug(\"update changelist:\\n%s\", changelist.to_summary())\n log.debug(\"status changelist:\\n%s\", status_changelist.to_summary())\n log.debug(\"modified changelist:\\n%s\", mod_changelist.to_summary())\n log.debug(\"added changelist:\\n%s\", add_changelist.to_summary())\n log.debug(\"retrack changelist:\\n%s\", retrack_changelist.to_summary())\n\n # Update mod_changelist checkout state; do not update local files\n if mod_changelist.is_empty():\n log.info(\"no conflicting local changes\")\n else:\n log.info(\"preserving files: %s (assuming these changes in working directory are ahead of those in repository)\", mod_changelist.brief_summary())\n for path in mod_changelist.all_paths():\n with self._yield_fingerprint(scope, path) as (fp, local_path):\n if fp is None:\n assert False # since it is picked-uped by status change, there must be a fingerprint\n fp.state = FileState.Tracked\n fp.md5 = INVALID_MD5 # for precaution since this md5 could be outdated. No need to invalidate size. This file is marked as MODIFIED or REMOVED anyway.\n\n # Update add_changelist checkout state; do no update local files\n if not add_changelist.is_empty():\n add_changelist_paths = add_changelist.all_paths()\n for path in add_changelist_paths:\n local_path = join_path(scope, path)\n self.checkout_state._check_file_exists(local_path) # sanity check\n log.info(\"newly tracking: %s (files that are not in repository yet)\", add_changelist.brief_summary())\n local_scope_path = join_path(self.work_dir, scope)\n new_fingerprints = FingerprintList.of_files(local_scope_path, add_changelist_paths, compute_md5=True, state=FileState.ToBeTracked)\n self.checkout_state.update_from_changelist(scope, add_changelist, new_fingerprints)\n\n # Update retrack files\n if retrack_changelist.is_empty():\n if no_download:\n log.warn(\"Warning: --no-download is used, even though there is nothing to download\")\n else:\n log.info(\"updating files: %s\", retrack_changelist.brief_summary())\n if no_download:\n for path in retrack_changelist_paths:\n local_path = join_path(scope, path)\n fp = Fingerprint(md5=INVALID_MD5, mtime=INVALID_MTIME, size=INVALID_SIZE, state=FileState.Tracked) # fake MD5 in order to pass sanity checks later\n self.checkout_state.fingerprints.update_fingerprint(local_path, fp)\n else:\n new_fingerprints = self._update_local_files(scope, mf.items, retrack_changelist, delete_all=True)\n # Changes to files are done. Update checkout state. We already have hashes in new_fingerprints.\n self.checkout_state.update_from_changelist(scope, retrack_changelist, new_fingerprints)\n\n self._write_checkout_state()\n\n return mf",
"metadata": "root.WorkingDir.track",
"header": "['class', 'WorkingDir', '(', 'object', ')', ':', '___EOS___']",
"index": 2957
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Modifica",
"tion_",
"of_",
"dictionary_",
"returned_",
"by_",
"locals_",
"(_",
")_",
"[SEP]_",
"class_",
"Work",
"ing",
"Dir_",
"(_",
"object_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"log",
"\\u",
"calls_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"track_",
"(_",
"self_",
",_",
"scope_",
",_",
"track",
"\\u",
"path",
"\\u",
"list_",
"=_",
"[_",
"]_",
",_",
"mode_",
"=_",
"None_",
",_",
"no",
"\\u",
"download_",
"=_",
"False_",
",_",
"recursive_",
"=_",
"False_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"'''",
"Update",
" ",
"working",
" ",
"director",
"y",
".",
" ",
"track",
"\\u",
"path",
"\\u",
"list",
" ",
"is",
" ",
"a",
" ",
"list",
" ",
"of",
" ",
"filename",
"s",
" ",
"to",
" ",
"track",
".'''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"If",
" ",
"mode",
" ",
"is",
" ",
"unspe",
"cif",
"ied",
",",
" ",
"use",
" ",
"the",
" ",
"mode",
" ",
"tha",
"t",
" ",
"the",
" ",
"give",
"n",
" ",
"scope",
" ",
"currentl",
"y",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"mode_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"partial",
"\\u",
"mode_",
"=_",
"self_",
"._",
"get",
"\\u",
"scope",
"\\u",
"mode_",
"(_",
"scope_",
")_",
"==_",
"Mode_",
"._",
"PARTI",
"AL_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"partial",
"\\u",
"mode_",
"and_",
"track",
"\\u",
"path",
"\\u",
"list_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Inva",
"lid",
"Operation_",
"(_",
"\"",
"scope",
" ",
"%",
"s",
" ",
"is",
" ",
"not",
" ",
"in",
" ",
"track",
"ing",
" ",
"mode",
" ",
"%",
"s",
";",
" ",
"cann",
"ot",
" ",
"track",
" ",
"files",
"\"_",
"%_",
"(_",
"scope_",
",_",
"Mode_",
"._",
"PARTI",
"AL_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"partial",
"\\u",
"mode_",
"=_",
"mode_",
"==_",
"Mode_",
"._",
"PARTI",
"AL_",
"and_",
"(_",
"len_",
"(_",
"track",
"\\u",
"path",
"\\u",
"list_",
")_",
">_",
"0_",
"or_",
"self_",
"._",
"get",
"\\u",
"scope",
"\\u",
"mode_",
"(_",
"scope_",
")_",
"!=_",
"Mode_",
"._",
"PARTI",
"AL_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"partial",
"2a",
"uto",
"\\u",
"mode_",
"=_",
"self_",
"._",
"get",
"\\u",
"scope",
"\\u",
"mode_",
"(_",
"scope_",
")_",
"==_",
"Mode_",
"._",
"PARTI",
"AL_",
"and_",
"mode_",
"==_",
"Mode_",
"._",
"AUTO",
"_",
"and_",
"len_",
"(_",
"track",
"\\u",
"path",
"\\u",
"list_",
")_",
"==_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Error",
" ",
"checking",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"(_",
"partial",
"\\u",
"mode_",
"or_",
"partial",
"2a",
"uto",
"\\u",
"mode_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"Inva",
"lid",
"Operation_",
"(_",
"\"",
"scope",
" ",
"%",
"s",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"in",
" ",
"%",
"s",
" ",
"mode",
";",
" ",
"spec",
"yfi",
"ng",
" ",
"mode",
" ",
"%",
"s",
" ",
"doe",
"s",
" ",
"not",
" ",
"make",
" ",
"muc",
"h",
" ",
"sense",
"\"_",
"%_",
"(_",
"scope_",
",_",
"Mode_",
"._",
"AUTO",
"_",
",_",
"mode_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"manifest",
" ",
"for",
" ",
"working",
" ",
"dir_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"cur",
"\\u",
"rev_",
"=_",
"self_",
"._",
"get",
"\\u",
"check",
"out",
"\\u",
"rev_",
"(_",
"scope_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mf_",
"=_",
"self_",
"._",
"repo_",
"._",
"get",
"\\u",
"manifest_",
"(_",
"scope_",
",_",
"cur",
"\\u",
"rev_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"need",
" ",
"any",
" ",
"local",
" ",
"file",
" ",
"change",
"s",
" ",
"even",
" ",
"we",
" ",
"are",
" ",
"not",
" ",
"track",
"ing",
" ",
"them",
" ",
"in",
" ",
"order",
" ",
"to",
" ",
"avoid",
" ",
"overwrit",
"ing_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"the",
" ",
"files",
" ",
"tha",
"t",
" ",
"have",
" ",
"the",
" ",
"same",
" ",
"name",
" ",
"in",
" ",
"the",
" ",
"scope",
";",
" ",
"I",
".",
"e",
".,",
" ",
"use",
" ",
"mode",
"=",
"Mode",
".",
"AUTO",
" ",
"whe",
"n",
" ",
"in",
" ",
"partial",
"\\u",
"mode_",
"\\u\\u\\uNL\\u\\u\\u_",
"status",
"\\u",
"changeli",
"st_",
"=_",
"self_",
"._",
"status_",
"(_",
"scope_",
",_",
"force",
"\\u",
"mode_",
"=_",
"Mode_",
"._",
"AUTO",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Fin",
"d",
" ",
"out",
" ",
"what",
" ",
"files",
" ",
"we",
" ",
"need",
" ",
"to",
" ",
"update",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"changeli",
"st_",
"=_",
"changeli",
"st",
"\\u",
"for",
"\\u",
"items_",
"(_",
"[_",
"]_",
",_",
"mf_",
"._",
"items_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"update",
" ",
"from",
" ",
"%",
"s",
",",
" ",
"chang",
"ing",
" ",
"%",
"s",
"\"_",
",_",
"mf_",
",_",
"changeli",
"st_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"track",
"\\u",
"changeli",
"st_",
"=_",
"Change",
"list_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Filter",
" ",
"down",
" ",
"the",
" ",
"changeli",
"st",
" ",
"if",
" ",
"checking",
" ",
"out",
" ",
"/",
" ",
"track",
" ",
"only",
" ",
"specified",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"partial",
"\\u",
"mode_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"update",
"\\u",
"scope",
"\\u",
"mode_",
"(_",
"scope_",
",_",
"Mode_",
"._",
"PARTI",
"AL_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"info_",
"(_",
"\"%",
"s",
":",
" ",
"scope",
" ",
"'%",
"s",
"'",
" ",
"at",
" ",
"revis",
"ion",
" ",
"%",
"s",
" ",
"in",
" ",
"track",
"ing",
" ",
"mode",
" ",
"'%",
"s",
"'\"_",
",_",
"\"",
"track",
"\"_",
",_",
"scope_",
",_",
"mf_",
"._",
"rev_",
",_",
"Mode_",
"._",
"PARTI",
"AL_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"path",
"\\u",
"candidates_",
"=_",
"[_",
"item_",
"._",
"path_",
"for_",
"item_",
"in_",
"mf_",
"._",
"items_",
"]_",
"+_",
"list_",
"(_",
"status",
"\\u",
"changeli",
"st_",
"._",
"add",
"\\u",
"paths_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"path_",
"in_",
"expand",
"\\u",
"wildcards",
"_",
"(_",
"track",
"\\u",
"path",
"\\u",
"list_",
",_",
"path",
"\\u",
"candidates_",
",_",
"recursive_",
"=_",
"recursive_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"self_",
"._",
"\\u",
"yield",
"\\u",
"fingerprint_",
"(_",
"scope_",
",_",
"path_",
")_",
"as_",
"(_",
"fp_",
",_",
"local",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"fp_",
"is_",
"not_",
"None_",
"and_",
"fp_",
"._",
"state_",
"in_",
"File",
"State",
"Track",
"ed",
"List_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"warn_",
"(_",
"\"",
"Warn",
"ing",
":",
" ",
"scope",
" ",
"%",
"s",
" ",
"path",
" ",
"%",
"s",
" ",
"is",
" ",
"alr",
"ead",
"y",
" ",
"%",
"s",
"\"_",
",_",
"scope_",
",_",
"path_",
",_",
"fp_",
"._",
"state_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"changeli",
"st_",
"._",
"discard_",
"(_",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"track",
"\\u",
"changeli",
"st_",
"._",
"update_",
"(_",
"path_",
",_",
"Change",
"list_",
"._",
"Status_",
"._",
"ADD",
"ED_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"changeli",
"st_",
"=_",
"changeli",
"st_",
"._",
"intersect_",
"(_",
"track",
"\\u",
"changeli",
"st_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"if",
" ",
"chang",
"ing",
" ",
"mode",
" ",
"from",
" ",
"auto",
" ",
"to",
" ",
"partial",
",",
" ",
"register",
" ",
"it_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"partial",
"2a",
"uto",
"\\u",
"mode_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"update",
"\\u",
"scope",
"\\u",
"mode_",
"(_",
"scope_",
",_",
"Mode_",
"._",
"AUTO",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"info_",
"(_",
"\"%",
"s",
":",
" ",
"scope",
" ",
"'%",
"s",
"'",
" ",
"at",
" ",
"revis",
"ion",
" ",
"%",
"s",
" ",
"in",
" ",
"track",
"ing",
" ",
"mode",
" ",
"'%",
"s",
"'\"_",
",_",
"\"",
"track",
"\"_",
",_",
"scope_",
",_",
"mf_",
"._",
"rev_",
",_",
"Mode_",
"._",
"AUTO",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"mod",
"\\u",
"changeli",
"st",
" ",
"is",
" ",
"for",
" ",
"files",
" ",
"tha",
"t",
" ",
"manifest",
" ",
"has",
" ",
"but",
" ",
"local",
"ly",
" ",
"modifi",
"ed",
" ",
"or",
" ",
"deleted_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mod",
"\\u",
"changeli",
"st_",
"=_",
"status",
"\\u",
"changeli",
"st_",
"._",
"intersect_",
"(_",
"changeli",
"st_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"add",
"\\u",
"changeli",
"st",
" ",
"is",
" ",
"for",
" ",
"files",
" ",
"tha",
"t",
" ",
"manifest",
" ",
"doe",
"s",
" ",
"no",
" ",
"have",
" ",
"but",
" ",
"local",
"ly",
" ",
"newl",
"ly",
" ",
"added_",
"\\u\\u\\uNL\\u\\u\\u_",
"add",
"\\u",
"changeli",
"st_",
"=_",
"track",
"\\u",
"changeli",
"st_",
"._",
"difference_",
"(_",
"changeli",
"st_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"retra",
"ck",
"\\u",
"changeli",
"st",
" ",
"is",
" ",
"for",
" ",
"files",
" ",
"tha",
"t",
" ",
"has",
" ",
"bee",
"n",
" ",
"untracked",
" ",
"but",
" ",
"bro",
"ugh",
"t",
" ",
"back",
" ",
"to",
" ",
"be",
" ",
"tracked",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
"=_",
"changeli",
"st_",
"._",
"difference_",
"(_",
"mod",
"\\u",
"changeli",
"st_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"retra",
"ck",
"\\u",
"changeli",
"st",
"\\u",
"paths_",
"=_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
"._",
"all",
"\\u",
"paths_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"path_",
"in_",
"retra",
"ck",
"\\u",
"changeli",
"st",
"\\u",
"paths_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"self_",
"._",
"\\u",
"yield",
"\\u",
"fingerprint_",
"(_",
"scope_",
",_",
"path_",
")_",
"as_",
"(_",
"fp_",
",_",
"local",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"fp_",
"is_",
"not_",
"None_",
"and_",
"fp_",
"._",
"state_",
"in_",
"File",
"State",
"Track",
"ed",
"List_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"do",
" ",
"not",
" ",
"include",
" ",
"path",
"s",
" ",
"tha",
"t",
" ",
"are",
" ",
"alr",
"ead",
"y",
" ",
"tracked",
" ",
"sinc",
"e",
" ",
"the",
" ",
"file",
" ",
"shou",
"ld",
" ",
"be",
" ",
"there",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"check",
"out",
"\\u",
"state_",
"._",
"\\u",
"check",
"\\u",
"file",
"\\u",
"exists_",
"(_",
"local",
"\\u",
"path_",
")_",
"#",
" ",
"sanity",
" ",
"check_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
"._",
"discard_",
"(_",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"update",
" ",
"changeli",
"st",
":\\\\",
"n",
"%",
"s",
"\"_",
",_",
"changeli",
"st_",
"._",
"to",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"status",
" ",
"changeli",
"st",
":\\\\",
"n",
"%",
"s",
"\"_",
",_",
"status",
"\\u",
"changeli",
"st_",
"._",
"to",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"modifi",
"ed",
" ",
"changeli",
"st",
":\\\\",
"n",
"%",
"s",
"\"_",
",_",
"mod",
"\\u",
"changeli",
"st_",
"._",
"to",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"adde",
"d",
" ",
"changeli",
"st",
":\\\\",
"n",
"%",
"s",
"\"_",
",_",
"add",
"\\u",
"changeli",
"st_",
"._",
"to",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log_",
"._",
"debug_",
"(_",
"\"",
"retra",
"ck",
" ",
"changeli",
"st",
":\\\\",
"n",
"%",
"s",
"\"_",
",_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
"._",
"to",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"mod",
"\\u",
"changeli",
"st",
" ",
"check",
"out",
" ",
"state",
";",
" ",
"do",
" ",
"not",
" ",
"update",
" ",
"local",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"mod",
"\\u",
"changeli",
"st_",
"._",
"is",
"\\u",
"empty_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"info_",
"(_",
"\"",
"no",
" ",
"conflicting",
" ",
"local",
" ",
"change",
"s",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"info_",
"(_",
"\"",
"prese",
"rvi",
"ng",
" ",
"files",
":",
" ",
"%",
"s",
" ",
"(",
"ass",
"umi",
"ng",
" ",
"these",
" ",
"change",
"s",
" ",
"in",
" ",
"working",
" ",
"director",
"y",
" ",
"are",
" ",
"ahe",
"ad",
" ",
"of",
" ",
"tho",
"se",
" ",
"in",
" ",
"repos",
"itor",
"y",
")\"_",
",_",
"mod",
"\\u",
"changeli",
"st_",
"._",
"brief",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"path_",
"in_",
"mod",
"\\u",
"changeli",
"st_",
"._",
"all",
"\\u",
"paths_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"self_",
"._",
"\\u",
"yield",
"\\u",
"fingerprint_",
"(_",
"scope_",
",_",
"path_",
")_",
"as_",
"(_",
"fp_",
",_",
"local",
"\\u",
"path_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"fp_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"assert_",
"False_",
"#",
" ",
"sinc",
"e",
" ",
"it",
" ",
"is",
" ",
"picked",
"-",
"upe",
"d",
" ",
"by",
" ",
"status",
" ",
"change",
",",
" ",
"there",
" ",
"must",
" ",
"be",
" ",
"a",
" ",
"fingerprint_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fp_",
"._",
"state_",
"=_",
"File",
"State_",
"._",
"Track",
"ed_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fp_",
"._",
"md5_",
"=_",
"INVALID",
"\\u",
"MD",
"5_",
"#",
" ",
"for",
" ",
"prec",
"aut",
"ion",
" ",
"sinc",
"e",
" ",
"this",
" ",
"md5",
" ",
"coul",
"d",
" ",
"be",
" ",
"outdate",
"d",
".",
" ",
"No",
" ",
"need",
" ",
"to",
" ",
"invalidate",
" ",
"size",
".",
" ",
"Thi",
"s",
" ",
"file",
" ",
"is",
" ",
"marked",
" ",
"as",
" ",
"MODIFIE",
"D",
" ",
"or",
" ",
"REMOVE",
"D",
" ",
"anyway",
"._",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"add",
"\\u",
"changeli",
"st",
" ",
"check",
"out",
" ",
"state",
";",
" ",
"do",
" ",
"no",
" ",
"update",
" ",
"local",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"not_",
"add",
"\\u",
"changeli",
"st_",
"._",
"is",
"\\u",
"empty_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"add",
"\\u",
"changeli",
"st",
"\\u",
"paths_",
"=_",
"add",
"\\u",
"changeli",
"st_",
"._",
"all",
"\\u",
"paths_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"path_",
"in_",
"add",
"\\u",
"changeli",
"st",
"\\u",
"paths_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"local",
"\\u",
"path_",
"=_",
"join",
"\\u",
"path_",
"(_",
"scope_",
",_",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"check",
"out",
"\\u",
"state_",
"._",
"\\u",
"check",
"\\u",
"file",
"\\u",
"exists_",
"(_",
"local",
"\\u",
"path_",
")_",
"#",
" ",
"sanity",
" ",
"check_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"log_",
"._",
"info_",
"(_",
"\"",
"newl",
"y",
" ",
"track",
"ing",
":",
" ",
"%",
"s",
" ",
"(",
"files",
" ",
"tha",
"t",
" ",
"are",
" ",
"not",
" ",
"in",
" ",
"repos",
"itor",
"y",
" ",
"ye",
"t",
")\"_",
",_",
"add",
"\\u",
"changeli",
"st_",
"._",
"brief",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"local",
"\\u",
"scope",
"\\u",
"path_",
"=_",
"join",
"\\u",
"path_",
"(_",
"self_",
"._",
"work",
"\\u",
"dir_",
",_",
"scope_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"new",
"\\u",
"fingerprint",
"s_",
"=_",
"Fingerprint",
"List_",
"._",
"of",
"\\u",
"files_",
"(_",
"local",
"\\u",
"scope",
"\\u",
"path_",
",_",
"add",
"\\u",
"changeli",
"st",
"\\u",
"paths_",
",_",
"compute",
"\\u",
"md5_",
"=_",
"True_",
",_",
"state_",
"=_",
"File",
"State_",
"._",
"To",
"Be",
"Track",
"ed_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"check",
"out",
"\\u",
"state_",
"._",
"update",
"\\u",
"from",
"\\u",
"changeli",
"st_",
"(_",
"scope_",
",_",
"add",
"\\u",
"changeli",
"st_",
",_",
"new",
"\\u",
"fingerprint",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Update",
" ",
"retra",
"ck",
" ",
"files_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
"._",
"is",
"\\u",
"empty_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"no",
"\\u",
"download_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"warn_",
"(_",
"\"",
"Warn",
"ing",
":",
" ",
"--",
"no",
"-",
"download",
" ",
"is",
" ",
"used",
",",
" ",
"even",
" ",
"tho",
"ugh",
" ",
"there",
" ",
"is",
" ",
"not",
"hing",
" ",
"to",
" ",
"download",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"log_",
"._",
"info_",
"(_",
"\"",
"updat",
"ing",
" ",
"files",
":",
" ",
"%",
"s",
"\"_",
",_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
"._",
"brief",
"\\u",
"summary_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"no",
"\\u",
"download_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"path_",
"in_",
"retra",
"ck",
"\\u",
"changeli",
"st",
"\\u",
"paths_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"local",
"\\u",
"path_",
"=_",
"join",
"\\u",
"path_",
"(_",
"scope_",
",_",
"path_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"fp_",
"=_",
"Fingerprint",
"_",
"(_",
"md5_",
"=_",
"INVALID",
"\\u",
"MD",
"5_",
",_",
"mtime_",
"=_",
"INVALID",
"\\u",
"MT",
"IME",
"_",
",_",
"size_",
"=_",
"INVALID",
"\\u",
"SIZE_",
",_",
"state_",
"=_",
"File",
"State_",
"._",
"Track",
"ed_",
")_",
"#",
" ",
"fake",
" ",
"MD",
"5",
" ",
"in",
" ",
"order",
" ",
"to",
" ",
"pass",
" ",
"sanity",
" ",
"checks",
" ",
"later_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"check",
"out",
"\\u",
"state_",
"._",
"fingerprint",
"s_",
"._",
"update",
"\\u",
"fingerprint_",
"(_",
"local",
"\\u",
"path_",
",_",
"fp_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"new",
"\\u",
"fingerprint",
"s_",
"=_",
"self_",
"._",
"\\u",
"update",
"\\u",
"local",
"\\u",
"files_",
"(_",
"scope_",
",_",
"mf_",
"._",
"items_",
",_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
",_",
"delete",
"\\u",
"all_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Change",
"s",
" ",
"to",
" ",
"files",
" ",
"are",
" ",
"don",
"e",
".",
" ",
"Update",
" ",
"check",
"out",
" ",
"state",
".",
" ",
"We",
" ",
"alr",
"ead",
"y",
" ",
"have",
" ",
"hashe",
"s",
" ",
"in",
" ",
"new",
"\\u",
"fingerprint",
"s",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"check",
"out",
"\\u",
"state_",
"._",
"update",
"\\u",
"from",
"\\u",
"changeli",
"st_",
"(_",
"scope_",
",_",
"retra",
"ck",
"\\u",
"changeli",
"st_",
",_",
"new",
"\\u",
"fingerprint",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"\\u",
"write",
"\\u",
"check",
"out",
"\\u",
"state_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"mf_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | dimagi/commcare-hq/corehq/apps/reports/forms.py | [
{
"content": "from django.utils.translation import ugettext\nfrom corehq.apps.style.crispy import FormActions, B3MultiField\nimport langcodes\n\nfrom django import forms\nfrom django.core.validators import MinLengthValidator\nfrom django.template.loader import render_to_string\nfrom corehq.apps.style.forms.fields import MultiEmailField\nfrom corehq.apps.userreports.reports.view import ConfigurableReport\nfrom crispy_forms import layout as crispy\nfrom crispy_forms.helper import FormHelper\nfrom .models import (\n DEFAULT_REPORT_NOTIF_SUBJECT,\n ReportConfig,\n ReportNotification,\n)\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class LanguageSelect(forms.Select):\n class Media:\n js = ('reports/javascripts/language_field.js',)",
"metadata": "root.LanguageSelect",
"header": "['module', '___EOS___']",
"index": 18
},
{
"content": "class SavedReportConfigForm(forms.Form):\n name = forms.CharField()\n description = forms.CharField(\n required=False,\n widget=forms.Textarea(),\n )\n start_date = forms.DateField(\n required=False,\n )\n end_date = forms.DateField(\n required=False,\n )\n datespan_slug = forms.CharField(\n required=False,\n widget=forms.HiddenInput(),\n )\n date_range = forms.CharField(\n required=False,\n widget=forms.HiddenInput(),\n )\n days = forms.IntegerField(\n required=False,\n widget=forms.HiddenInput(),\n )\n _id = forms.CharField(\n required=False,\n widget=forms.HiddenInput(),\n )\n report_slug = forms.CharField(\n required=False,\n widget=forms.HiddenInput(),\n )\n report_type = forms.CharField(\n required=False,\n widget=forms.HiddenInput(),\n )\n subreport_slug = forms.CharField(\n required=False,\n widget=forms.HiddenInput(),\n )\n\n",
"metadata": "root.SavedReportConfigForm",
"header": "['module', '___EOS___']",
"index": 23
},
{
"content": " def __init__(self, domain, user_id, *args, **kwargs):\n self.domain = domain\n self.user_id = user_id\n super(SavedReportConfigForm, self).__init__(*args, **kwargs)",
"metadata": "root.SavedReportConfigForm.__init__",
"header": "['class', 'SavedReportConfigForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']",
"index": 64
},
{
"content": " def clean(self):\n name = self.cleaned_data['name']\n _id = self.cleaned_data['_id']\n\n user_configs = ReportConfig.by_domain_and_owner(self.domain, self.user_id)\n if not _id and name in [c.name for c in user_configs]:\n raise forms.ValidationError(\n \"A saved report with the name '%(name)s' already exists.\" % {\n 'name': name,\n }\n )\n\n date_range = self.cleaned_data['date_range']\n\n if (\n self.cleaned_data['report_type'] == ConfigurableReport.prefix\n and not self.cleaned_data['datespan_slug']\n ):\n self.cleaned_data['date_range'] = None\n else:\n if date_range == 'last7':\n self.cleaned_data['days'] = 7\n elif date_range == 'last30':\n self.cleaned_data['days'] = 30\n elif (date_range == 'lastn' and self.cleaned_data.get('days') is None\n and self.cleaned_data['report_type'] != ConfigurableReport.prefix):\n raise forms.ValidationError(\n \"Field 'days' was expected but not provided.\"\n )\n\n return self.cleaned_data",
"metadata": "root.SavedReportConfigForm.clean",
"header": "['class', 'SavedReportConfigForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']",
"index": 69
},
{
"content": "class ScheduledReportForm(forms.Form):\n config_ids = forms.MultipleChoiceField(\n label=\"Saved report(s)\",\n validators=[MinLengthValidator(1)],\n help_text='Note: not all built-in reports support email delivery, so'\n ' some of your saved reports may not appear in this list')\n\n interval = forms.TypedChoiceField(\n label='Interval',\n choices=[(\"daily\", \"Daily\"), (\"weekly\", \"Weekly\"), (\"monthly\", \"Monthly\")])\n\n day = forms.TypedChoiceField(\n label=\"Day\",\n coerce=int,\n required=False,\n choices=[(i, i) for i in range(0, 32)])\n\n hour = forms.TypedChoiceField(\n label='Time',\n coerce=int,\n choices=ReportNotification.hour_choices())\n\n send_to_owner = forms.BooleanField(\n label='Send to me',\n required=False)\n\n attach_excel = forms.BooleanField(\n label='Attach Excel Report',\n required=False)\n\n recipient_emails = MultiEmailField(\n label='Other recipients',\n required=False\n )\n email_subject = forms.CharField(\n required=False,\n help_text='Translated into recipient\\'s language if set to \"%(default_subject)s\".' % {\n 'default_subject': DEFAULT_REPORT_NOTIF_SUBJECT,\n },\n )\n\n language = forms.ChoiceField(\n label='Language',\n required=False,\n choices=[('', '')] + langcodes.get_all_langs_for_select(),\n widget=LanguageSelect()\n )\n\n",
"metadata": "root.ScheduledReportForm",
"header": "['module', '___EOS___']",
"index": 102
},
{
"content": " def __init__(self, *args, **kwargs):\n self.helper = FormHelper()\n self.helper.form_class = 'form-horizontal'\n self.helper.form_id = 'id-scheduledReportForm'\n self.helper.label_class = 'col-sm-3 col-md-2'\n self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'\n self.helper.add_layout(\n crispy.Layout(\n crispy.Fieldset(\n ugettext(\"Configure Scheduled Report\"),\n 'config_ids',\n 'interval',\n 'day',\n 'hour',\n B3MultiField(\n ugettext(\"Send Options\"),\n 'send_to_owner'\n ),\n B3MultiField(\n ugettext(\"Excel Attachment\"),\n 'attach_excel'\n ),\n crispy.Field(\n 'email_subject',\n css_class='input-xlarge',\n ),\n 'recipient_emails',\n 'language',\n crispy.HTML(\n render_to_string('reports/partials/privacy_disclaimer.html')\n )\n ),\n FormActions(\n crispy.Submit('submit_btn', 'Submit')\n )\n )\n )\n\n super(ScheduledReportForm, self).__init__(*args, **kwargs)",
"metadata": "root.ScheduledReportForm.__init__",
"header": "['class', 'ScheduledReportForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']",
"index": 150
},
{
"content": " def clean(self):\n cleaned_data = super(ScheduledReportForm, self).clean()\n if cleaned_data[\"interval\"] == \"daily\":\n del cleaned_data[\"day\"]\n _verify_email(cleaned_data)\n return cleaned_data",
"metadata": "root.ScheduledReportForm.clean",
"header": "['class', 'ScheduledReportForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']",
"index": 190
},
{
"content": "class EmailReportForm(forms.Form):\n subject = forms.CharField(required=False)\n send_to_owner = forms.BooleanField(required=False)\n attach_excel = forms.BooleanField(required=False)\n recipient_emails = MultiEmailField(required=False)\n notes = forms.CharField(required=False)\n",
"metadata": "root.EmailReportForm",
"header": "['module', '___EOS___']",
"index": 198
},
{
"content": " def clean(self):\n cleaned_data = super(EmailReportForm, self).clean()\n _verify_email(cleaned_data)\n return cleaned_data",
"metadata": "root.EmailReportForm.clean",
"header": "['class', 'EmailReportForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']",
"index": 205
},
{
"content": "def _verify_email(cleaned_data):\n if ('recipient_emails' in cleaned_data\n and not (cleaned_data['recipient_emails'] or\n cleaned_data['send_to_owner'])):\n raise forms.ValidationError(\"You must specify at least one \"\n \"valid recipient\")",
"metadata": "root._verify_email",
"header": "['module', '___EOS___']",
"index": 211
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"django_",
"._",
"utils_",
"._",
"translation_",
"import_",
"ugettext_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core",
"hq",
"_",
"._",
"apps_",
"._",
"style_",
"._",
"crisp",
"y_",
"import_",
"Form",
"Actions_",
",_",
"B3",
"Multi",
"Field_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"lang",
"codes_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"import_",
"forms_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"core_",
"._",
"validators_",
"import_",
"Min",
"Length",
"Validator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"template_",
"._",
"loader_",
"import_",
"render",
"\\u",
"to",
"\\u",
"string_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core",
"hq",
"_",
"._",
"apps_",
"._",
"style_",
"._",
"forms_",
"._",
"fields_",
"import_",
"Multi",
"Ema",
"il",
"Field_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"core",
"hq",
"_",
"._",
"apps_",
"._",
"user",
"reports_",
"._",
"reports_",
"._",
"view_",
"import_",
"Configura",
"ble",
"Report_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"crisp",
"y",
"\\u",
"forms_",
"import_",
"layout_",
"as_",
"crisp",
"y_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"crisp",
"y",
"\\u",
"forms_",
"._",
"helper_",
"import_",
"Form",
"Helper_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"._",
"models_",
"import_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"DEF",
"AUL",
"T",
"\\u",
"REPORT",
"\\u",
"NOTIF",
"\\u",
"SUBJECT",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Report",
"Config_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Report",
"Notification_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Lang",
"ua",
"ge",
"Select_",
"(_",
"forms_",
"._",
"Select_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"class_",
"Media_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"js_",
"=_",
"(_",
"'",
"report",
"s",
"/",
"javascript",
"s",
"/",
"language",
"\\u",
"field",
".",
"js",
"'_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Save",
"d",
"Report",
"Config",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"description_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Textarea_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"start",
"\\u",
"date_",
"=_",
"forms_",
"._",
"Date",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"end",
"\\u",
"date_",
"=_",
"forms_",
"._",
"Date",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"dates",
"pan",
"\\u",
"slug_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"date",
"\\u",
"range_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"days_",
"=_",
"forms_",
"._",
"Integer",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"id_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"report",
"\\u",
"slug_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"report",
"\\u",
"type_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"subre",
"port",
"\\u",
"slug_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"forms_",
"._",
"Hi",
"dde",
"n",
"Input_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Save",
"d",
"Report",
"Config",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"domain_",
",_",
"user",
"\\u",
"id_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"domain_",
"=_",
"domain_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"user",
"\\u",
"id_",
"=_",
"user",
"\\u",
"id_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"Save",
"d",
"Report",
"Config",
"Form_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Save",
"d",
"Report",
"Config",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"clean_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"name_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"name",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"id_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'\\u",
"id",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"user",
"\\u",
"configs_",
"=_",
"Report",
"Config_",
"._",
"by",
"\\u",
"domain",
"\\u",
"and",
"\\u",
"owner_",
"(_",
"self_",
"._",
"domain_",
",_",
"self_",
"._",
"user",
"\\u",
"id_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"\\u",
"id_",
"and_",
"name_",
"in_",
"[_",
"c_",
"._",
"name_",
"for_",
"c_",
"in_",
"user",
"\\u",
"configs_",
"]_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"forms_",
"._",
"Validat",
"ion",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"A",
" ",
"saved",
" ",
"report",
" ",
"with",
" ",
"the",
" ",
"name",
" ",
"'%",
"(",
"name",
")",
"s",
"'",
" ",
"alr",
"ead",
"y",
" ",
"exist",
"s",
".\"_",
"%_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"date",
"\\u",
"range_",
"=_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"date",
"\\u",
"range",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"report",
"\\u",
"type",
"'_",
"]_",
"==_",
"Configura",
"ble",
"Report_",
"._",
"prefix_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"not_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"dates",
"pan",
"\\u",
"slug",
"'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"date",
"\\u",
"range",
"'_",
"]_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"date",
"\\u",
"range_",
"==_",
"'",
"last",
"7",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"day",
"s",
"'_",
"]_",
"=_",
"7_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"date",
"\\u",
"range_",
"==_",
"'",
"last",
"30",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"day",
"s",
"'_",
"]_",
"=_",
"30_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"elif_",
"(_",
"date",
"\\u",
"range_",
"==_",
"'",
"last",
"n",
"'_",
"and_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"._",
"get_",
"(_",
"'",
"day",
"s",
"'_",
")_",
"is_",
"None_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"report",
"\\u",
"type",
"'_",
"]_",
"!=_",
"Configura",
"ble",
"Report_",
"._",
"prefix_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"forms_",
"._",
"Validat",
"ion",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Field",
" ",
"'",
"day",
"s",
"'",
" ",
"was",
" ",
"expected",
" ",
"but",
" ",
"not",
" ",
"provided",
".\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"._",
"clean",
"ed",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Schedule",
"d",
"Report",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"config",
"\\u",
"ids_",
"=_",
"forms_",
"._",
"Multipl",
"e",
"Choi",
"ce",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"\"",
"Save",
"d",
" ",
"report",
"(",
"s",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"validators_",
"=_",
"[_",
"Min",
"Length",
"Validator_",
"(_",
"1_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"Not",
"e",
":",
" ",
"not",
" ",
"all",
" ",
"bui",
"lt",
"-",
"in",
" ",
"report",
"s",
" ",
"support",
" ",
"email",
" ",
"delivery",
",",
" ",
"so",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
" ",
"some",
" ",
"of",
" ",
"your",
" ",
"saved",
" ",
"report",
"s",
" ",
"may",
" ",
"not",
" ",
"appear",
" ",
"in",
" ",
"this",
" ",
"list",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"interval_",
"=_",
"forms_",
"._",
"Type",
"d",
"Choi",
"ce",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"'",
"Interv",
"al",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"choices_",
"=_",
"[_",
"(_",
"\"",
"daily",
"\"_",
",_",
"\"",
"Da",
"il",
"y",
"\"_",
")_",
",_",
"(_",
"\"",
"week",
"ly",
"\"_",
",_",
"\"",
"Week",
"ly",
"\"_",
")_",
",_",
"(_",
"\"",
"month",
"ly",
"\"_",
",_",
"\"",
"Mont",
"hl",
"y",
"\"_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"day_",
"=_",
"forms_",
"._",
"Type",
"d",
"Choi",
"ce",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"\"",
"Day",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"coerce",
"_",
"=_",
"int_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"choices_",
"=_",
"[_",
"(_",
"i_",
",_",
"i_",
")_",
"for_",
"i_",
"in_",
"range_",
"(_",
"0_",
",_",
"32_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"hour_",
"=_",
"forms_",
"._",
"Type",
"d",
"Choi",
"ce",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"'",
"Time",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"coerce",
"_",
"=_",
"int_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"choices_",
"=_",
"Report",
"Notification_",
"._",
"hour",
"\\u",
"choices_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"send",
"\\u",
"to",
"\\u",
"owner_",
"=_",
"forms_",
"._",
"Boo",
"lean",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"'",
"Sen",
"d",
" ",
"to",
" ",
"me",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"attach",
"\\u",
"excel_",
"=_",
"forms_",
"._",
"Boo",
"lean",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"'",
"Attach",
" ",
"Exce",
"l",
" ",
"Report",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"recip",
"ient",
"\\u",
"emails_",
"=_",
"Multi",
"Ema",
"il",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"'",
"Ot",
"her",
" ",
"recip",
"ients",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"email",
"\\u",
"subject_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help",
"\\u",
"text_",
"=_",
"'",
"Translate",
"d",
" ",
"int",
"o",
" ",
"recip",
"ient",
"\\\\'",
"s",
" ",
"language",
" ",
"if",
" ",
"set",
" ",
"to",
" ",
"\"%",
"(",
"default",
"\\u",
"subject",
")",
"s",
"\".'_",
"%_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"default",
"\\u",
"subject",
"'_",
":_",
"DEF",
"AUL",
"T",
"\\u",
"REPORT",
"\\u",
"NOTIF",
"\\u",
"SUBJECT",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"language_",
"=_",
"forms_",
"._",
"Choi",
"ce",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"label_",
"=_",
"'",
"Lang",
"ua",
"ge",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"required_",
"=_",
"False_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"choices_",
"=_",
"[_",
"(_",
"''_",
",_",
"''_",
")_",
"]_",
"+_",
"lang",
"codes_",
"._",
"get",
"\\u",
"all",
"\\u",
"lang",
"s",
"\\u",
"for",
"\\u",
"select_",
"(_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"widget_",
"=_",
"Lang",
"ua",
"ge",
"Select_",
"(_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Schedule",
"d",
"Report",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"helper_",
"=_",
"Form",
"Helper_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"helper_",
"._",
"form",
"\\u",
"class_",
"=_",
"'",
"form",
"-",
"horizon",
"tal",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"helper_",
"._",
"form",
"\\u",
"id_",
"=_",
"'",
"id",
"-",
"schedule",
"d",
"Report",
"Form",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"helper_",
"._",
"label",
"\\u",
"class_",
"=_",
"'",
"col",
"-",
"sm",
"-",
"3",
" ",
"col",
"-",
"md",
"-",
"2",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"helper_",
"._",
"field",
"\\u",
"class_",
"=_",
"'",
"col",
"-",
"sm",
"-",
"9",
" ",
"col",
"-",
"md",
"-",
"8",
" ",
"col",
"-",
"lg",
"-",
"6",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"helper_",
"._",
"add",
"\\u",
"layout_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"crisp",
"y_",
"._",
"Layout_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"crisp",
"y_",
"._",
"Field",
"set_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"ugettext_",
"(_",
"\"",
"Configure",
" ",
"Schedule",
"d",
" ",
"Report",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"config",
"\\u",
"ids",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"interval",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"day",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"hour",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B3",
"Multi",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"ugettext_",
"(_",
"\"",
"Sen",
"d",
" ",
"Optio",
"ns",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"send",
"\\u",
"to",
"\\u",
"owner",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"B3",
"Multi",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"ugettext_",
"(_",
"\"",
"Exce",
"l",
" ",
"Attach",
"ment",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"attach",
"\\u",
"exce",
"l",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"crisp",
"y_",
"._",
"Field_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"email",
"\\u",
"subject",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"css",
"\\u",
"class_",
"=_",
"'",
"input",
"-",
"xla",
"rge",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"recip",
"ient",
"\\u",
"email",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"language",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"crisp",
"y_",
"._",
"HTML_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"render",
"\\u",
"to",
"\\u",
"string_",
"(_",
"'",
"report",
"s",
"/",
"partial",
"s",
"/",
"privacy",
"\\u",
"discl",
"aime",
"r",
".",
"html",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Form",
"Actions_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"crisp",
"y_",
"._",
"Submit",
"_",
"(_",
"'",
"submit",
"\\u",
"btn",
"'_",
",_",
"'",
"Submit",
"'_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"super_",
"(_",
"Schedule",
"d",
"Report",
"Form_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Schedule",
"d",
"Report",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"clean_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"clean",
"ed",
"\\u",
"data_",
"=_",
"super_",
"(_",
"Schedule",
"d",
"Report",
"Form_",
",_",
"self_",
")_",
"._",
"clean_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"clean",
"ed",
"\\u",
"data_",
"[_",
"\"",
"interval",
"\"_",
"]_",
"==_",
"\"",
"daily",
"\"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"del_",
"clean",
"ed",
"\\u",
"data_",
"[_",
"\"",
"day",
"\"_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u",
"verify",
"\\u",
"email_",
"(_",
"clean",
"ed",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"clean",
"ed",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Ema",
"il",
"Report",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"subject_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"send",
"\\u",
"to",
"\\u",
"owner_",
"=_",
"forms_",
"._",
"Boo",
"lean",
"Field_",
"(_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"attach",
"\\u",
"excel_",
"=_",
"forms_",
"._",
"Boo",
"lean",
"Field_",
"(_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"recip",
"ient",
"\\u",
"emails_",
"=_",
"Multi",
"Ema",
"il",
"Field_",
"(_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"notes_",
"=_",
"forms_",
"._",
"Char",
"Field_",
"(_",
"required_",
"=_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Ema",
"il",
"Report",
"Form_",
"(_",
"forms_",
"._",
"Form_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"clean_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"clean",
"ed",
"\\u",
"data_",
"=_",
"super_",
"(_",
"Ema",
"il",
"Report",
"Form_",
",_",
"self_",
")_",
"._",
"clean_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u",
"verify",
"\\u",
"email_",
"(_",
"clean",
"ed",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"clean",
"ed",
"\\u",
"data_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"verify",
"\\u",
"email_",
"(_",
"clean",
"ed",
"\\u",
"data_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"'",
"recip",
"ient",
"\\u",
"email",
"s",
"'_",
"in_",
"clean",
"ed",
"\\u",
"data_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"not_",
"(_",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"recip",
"ient",
"\\u",
"email",
"s",
"'_",
"]_",
"or_",
"\\u\\u\\uNL\\u\\u\\u_",
"clean",
"ed",
"\\u",
"data_",
"[_",
"'",
"send",
"\\u",
"to",
"\\u",
"owner",
"'_",
"]_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"forms_",
"._",
"Validat",
"ion",
"Error_",
"(_",
"\"",
"You",
" ",
"must",
" ",
"speci",
"fy",
" ",
"at",
" ",
"leas",
"t",
" ",
"one",
" ",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"valid",
" ",
"recip",
"ient",
"\"_",
")_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | CenterForOpenScience/scrapi/tests/utils.py | [
{
"content": "from __future__ import unicode_literals\n\nimport copy\nfrom six.moves import xrange\n\nfrom scrapi.base import XMLHarvester\nfrom scrapi.base.schemas import DOESCHEMA\nfrom scrapi.linter.document import RawDocument\nfrom scrapi.base.helpers import updated_schema, build_properties, single_result\n\n\nRAW_DOC = {\n 'doc': b'{}',\n 'docID': 'someID',\n 'timestamps': {\n 'harvestFinished': '2012-11-30T17:05:48+00:00',\n 'harvestStarted': '2012-11-30T17:05:48+00:00',\n 'harvestTaskCreated': '2012-11-30T17:05:48+00:00'\n },\n 'filetype': 'json',\n 'source': 'test'\n}\n\nPOSTGRES_RAW_DOC = copy.copy(RAW_DOC)\nPOSTGRES_RAW_DOC['doc'] = '{}'\n\nNORMALIZED_DOC = {\n 'title': 'No',\n 'contributors': [{'name': ''}],\n 'source': 'test',\n 'providerUpdatedDateTime': '2014-04-04T00:00:00Z',\n 'uris': {\n 'canonicalUri': 'http://example.com/direct'\n }\n}\n\nRECORD = {\n 'title': 'Using Table Stable Carbon in Gold and STAR Isotopes',\n 'contributors': [\n {\n 'name': 'DEVON Get The Tables DUDLEY',\n 'givenName': 'DEVON',\n 'additionalName': 'Get The Tables',\n 'familyName': 'DUDLEY',\n 'email': '[email protected]',\n 'sameAs': ['http://example.com/me']\n }\n ],\n 'uris': {\n 'canonicalUri': 'http://www.plosone.org/article'\n },\n 'otherProperties': [{\n 'name': 'figures',\n 'properties': {\n 'figures': 'http://www.plosone.org/article/image.png',\n }\n }, {\n 'name': 'type',\n 'properties': {\n 'type': 'text',\n 'yep': 'A property'\n }\n }],\n 'description': 'This study seeks to understand how humans impact\\\n the dietary patterns of eight free-ranging vervet monkey\\\n (Chlorocebus pygerythrus) groups in South Africa using stable\\\n isotope analysis.',\n 'providerUpdatedDateTime': '2015-02-23T00:00:00Z',\n 'shareProperties': {\n 'source': 'test',\n 'docID': 'test1'\n }\n}\n\n\nTEST_SCHEMA = updated_schema(DOESCHEMA, {\n \"title\": (\"//dc:title/node()\", lambda x: \"Title overwritten\"),\n \"otherProperties\": build_properties(\n (\"title1\", (\"//dc:title/node()\", single_result)),\n (\"title2\", (\"//dc:title/node()\", lambda x: single_result(x).lower())),\n (\"title3\", (\"//dc:title/node()\", \"//dc:title/node()\", lambda x, y: single_result(x) + single_result(y).lower()))\n )\n})\n\n\nTEST_NAMESPACES = {\n 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n 'dc': 'http://purl.org/dc/elements/1.1/',\n 'dcq': 'http://purl.org/dc/terms/'\n}\n\n\nTEST_XML_DOC = b'''\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcq=\"http://purl.org/dc/terms/\">\n <records count=\"97\" morepages=\"true\" start=\"1\" end=\"10\">\n <record rownumber=\"1\">\n <dc:title>Test</dc:title>\n <dc:creator>\n Raveh-Sadka, Tali; Thomas, Brian C; Singh, Andrea; Firek, Brian; Brooks,\n Brandon; Castelle, Cindy J; Sharon, Itai; Baker, Robyn; Good, Misty; Morowitz,\n Michael J; Banfield, Jillian F\n </dc:creator>\n <dc:subject/>\n <dc:subjectRelated/>\n <dc:description/>\n <dcq:publisher>\n eLife Sciences Publications, Ltd.\n </dcq:publisher>\n <dcq:publisherAvailability/>\n <dcq:publisherResearch>\n None\n </dcq:publisherResearch>\n <dcq:publisherSponsor>\n USDOE\n </dcq:publisherSponsor>\n <dcq:publisherCountry>\n Country unknown/Code not available\n </dcq:publisherCountry>\n <dc:date>\n 2015-03-03\n </dc:date>\n <dc:language>\n English\n </dc:language>\n <dc:type>\n Journal Article\n </dc:type>\n <dcq:typeQualifier/>\n <dc:relation>\n Journal Name: eLife; Journal Volume: 4\n </dc:relation>\n <dc:coverage/>\n <dc:format>\n Medium: X\n </dc:format>\n <dc:identifier>\n OSTI ID: 1171761, Legacy ID: OSTI ID: 1171761\n </dc:identifier>\n <dc:identifierReport>\n None\n </dc:identifierReport>\n <dcq:identifierDOEcontract>\n 5R01AI092531; Long term fellowship; SC0004918; ER65561; APSF-2012-10-05\n </dcq:identifierDOEcontract>\n <dc:identifierOther>Journal ID: ISSN 2050-084X</dc:identifierOther>\n <dc:doi>10.7554/eLife.05477</dc:doi><dc:rights/>\n <dc:dateEntry>2015-03-05</dc:dateEntry>\n <dc:dateAdded>2015-03-05</dc:dateAdded>\n <dc:ostiId>1171761</dc:ostiId>\n <dcq:identifier-purl type=\"\"/>\n <dcq:identifier-citation>\n http://www.osti.gov/pages/biblio/1171761\n </dcq:identifier-citation>\n </record>\n </records>\n </rdf:RDF>\n'''\n\nTEST_OAI_DOC = b'''\n <OAI-PMH xmlns=\"http://www.openarchives.org/OAI/2.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\">\n <responseDate>2015-03-30T18:31:29Z</responseDate>\n <request verb=\"ListRecords\" metadataPrefix=\"oai_dc\" from=\"2014-09-26T00:00:00Z\">http://repository.stcloudstate.edu/do/oai/</request>\n <ListRecords>\n <record>\n <header>\n <identifier>oai:digitalcommons.calpoly.edu:aged_rpt-1085</identifier>\n <datestamp>2014-10-07T00:30:57Z</datestamp>\n <setSpec>publication:aged_rpt</setSpec>\n <setSpec>publication:students</setSpec>\n </header>\n <metadata>\n <oai_dc:dc xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd\">\n <dc:title>Test</dc:title>\n <dc:creator>Mills, Donald W, Jr.</dc:creator>\n <dc:description>\n This internship report consists of two parts. The first section addresses the Quality Criteria in Agricultural Education for the program of agricultural instruction at Arvin High School. The second section explains the steps in remodeling the agriculture classroom and agriculture mechanics shop at Arvin High School. The remodeling of the facility was accomplished to address the occupational needs for students entering the work force immediately after high school. It was also designed to prepare students for opportunities in higher education.\n </dc:description>\n <dc:date>2014-05-01T07:00:00Z</dc:date>\n <dc:type>text</dc:type>\n <dc:format>application/pdf</dc:format>\n <dc:identifier>http://digitalcommons.calpoly.edu/aged_rpt/64</dc:identifier>\n <dc:identifier>\n http://digitalcommons.calpoly.edu/cgi/viewcontent.cgi?article=1085&context=aged_rpt\n </dc:identifier>\n <dc:source>\n Graduate Internship Reports in Agricultural Education\n </dc:source>\n <dc:publisher>DigitalCommons@CalPoly</dc:publisher>\n </oai_dc:dc>\n </metadata>\n </record>\n </ListRecords>\n </OAI-PMH>\n'''\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class TestHarvester(XMLHarvester):\n long_name = 'TEST'\n short_name = 'test'\n url = 'TEST'\n schema = TEST_SCHEMA\n namespaces = TEST_NAMESPACES\n",
"metadata": "root.TestHarvester",
"header": "['module', '___EOS___']",
"index": 196
},
{
"content": " def harvest(self, days_back=1):\n return [RawDocument({\n 'doc': TEST_XML_DOC,\n 'source': 'test',\n 'filetype': 'XML',\n 'docID': \"1\",\n 'timestamps': {\n 'harvestFinished': '2015-03-14T17:05:48+00:00',\n 'harvestStarted': '2015-03-14T17:05:48+00:00',\n 'harvestTaskCreated': '2015-03-16T17:05:48+00:00'\n }\n }) for _ in xrange(days_back)]",
"metadata": "root.TestHarvester.harvest",
"header": "['class', 'TestHarvester', '(', 'XMLHarvester', ')', ':', '___EOS___']",
"index": 203
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"from_",
"\\u\\u",
"future\\u\\u_",
"import_",
"unicode",
"\\u",
"literals_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"copy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"six_",
"._",
"moves_",
"import_",
"xrange_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"scrap",
"i_",
"._",
"base_",
"import_",
"XML",
"Harvest",
"er_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"scrap",
"i_",
"._",
"base_",
"._",
"schemas_",
"import_",
"DO",
"ESC",
"HEM",
"A_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"scrap",
"i_",
"._",
"linter",
"_",
"._",
"document_",
"import_",
"Ra",
"w",
"Document_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"scrap",
"i_",
"._",
"base_",
"._",
"helpers_",
"import_",
"update",
"d\\u",
"schema_",
",_",
"build",
"\\u",
"properties_",
",_",
"single",
"\\u",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"RA",
"W",
"\\u",
"DOC",
"_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"doc",
"'_",
":_",
"b",
"'{}'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"doc",
"ID",
"'_",
":_",
"'",
"some",
"ID",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"timestamp",
"s",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"harvest",
"Finish",
"ed",
"'_",
":_",
"'",
"2012",
"-1",
"1",
"-",
"30",
"T1",
"7",
":",
"05",
":",
"4",
"8",
"+0",
"0",
":",
"00",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"harvest",
"Start",
"ed",
"'_",
":_",
"'",
"2012",
"-1",
"1",
"-",
"30",
"T1",
"7",
":",
"05",
":",
"4",
"8",
"+0",
"0",
":",
"00",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"harvest",
"Task",
"Creat",
"ed",
"'_",
":_",
"'",
"2012",
"-1",
"1",
"-",
"30",
"T1",
"7",
":",
"05",
":",
"4",
"8",
"+0",
"0",
":",
"00",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"filet",
"ype",
"'_",
":_",
"'",
"json",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"'_",
":_",
"'",
"test",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"POST",
"GRES",
"\\u",
"RA",
"W",
"\\u",
"DOC",
"_",
"=_",
"copy_",
"._",
"copy_",
"(_",
"RA",
"W",
"\\u",
"DOC",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"POST",
"GRES",
"\\u",
"RA",
"W",
"\\u",
"DOC",
"_",
"[_",
"'",
"doc",
"'_",
"]_",
"=_",
"'{}'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"NORMALIZ",
"ED",
"\\u",
"DOC",
"_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"No",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"contributor",
"s",
"'_",
":_",
"[_",
"{_",
"'",
"name",
"'_",
":_",
"''_",
"}_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"'_",
":_",
"'",
"test",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"provide",
"r",
"Update",
"d",
"Date",
"Time",
"'_",
":_",
"'",
"2014",
"-0",
"4",
"-0",
"4",
"T",
"00",
":",
"00",
":",
"00",
"Z",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"uris",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"canonical",
"Ur",
"i",
"'_",
":_",
"'",
"http",
"://",
"example",
".",
"com",
"/",
"direct",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"RECORD",
"_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"title",
"'_",
":_",
"'",
"Us",
"ing",
" ",
"Table",
" ",
"Sta",
"ble",
" ",
"Car",
"bon",
" ",
"in",
" ",
"Gold",
" ",
"and",
" ",
"STAR",
" ",
"Iso",
"tope",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"contributor",
"s",
"'_",
":_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"DEV",
"ON",
" ",
"Get",
" ",
"The",
" ",
"Table",
"s",
" ",
"DU",
"DLE",
"Y",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"give",
"n",
"Name",
"'_",
":_",
"'",
"DEV",
"ON",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"addition",
"al",
"Name",
"'_",
":_",
"'",
"Get",
" ",
"The",
" ",
"Table",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"famil",
"y",
"Name",
"'_",
":_",
"'",
"DU",
"DLE",
"Y",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"email",
"'_",
":_",
"'",
"dud",
"ley",
".",
"boy",
"z",
"@",
"email",
".",
"uni",
".",
"edu",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"same",
"As",
"'_",
":_",
"[_",
"'",
"http",
"://",
"example",
".",
"com",
"/",
"me",
"'_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"uris",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"canonical",
"Ur",
"i",
"'_",
":_",
"'",
"http",
"://",
"www",
".",
"plo",
"son",
"e",
".",
"org",
"/",
"article",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"other",
"Proper",
"ties",
"'_",
":_",
"[_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"figure",
"s",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"proper",
"ties",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"figure",
"s",
"'_",
":_",
"'",
"http",
"://",
"www",
".",
"plo",
"son",
"e",
".",
"org",
"/",
"article",
"/",
"image",
".",
"png",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"name",
"'_",
":_",
"'",
"type",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"proper",
"ties",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"type",
"'_",
":_",
"'",
"text",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"ye",
"p",
"'_",
":_",
"'",
"A",
" ",
"property",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"description",
"'_",
":_",
"'",
"Thi",
"s",
" ",
"stud",
"y",
" ",
"seek",
"s",
" ",
"to",
" ",
"underst",
"and",
" ",
"how",
" ",
"human",
"s",
" ",
"impact",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"die",
"tar",
"y",
" ",
"pattern",
"s",
" ",
"of",
" ",
"eight",
" ",
"free",
"-",
"rang",
"ing",
" ",
"ver",
"vet",
" ",
"monkey",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"Ch",
"lor",
"oce",
"bus",
" ",
"pyg",
"ery",
"thru",
"s",
")",
" ",
"group",
"s",
" ",
"in",
" ",
"South",
" ",
"Af",
"rica",
" ",
"usi",
"ng",
" ",
"stable",
"\\\\",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"isotope",
" ",
"analys",
"is",
".'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"provide",
"r",
"Update",
"d",
"Date",
"Time",
"'_",
":_",
"'",
"201",
"5",
"-0",
"2",
"-",
"23",
"T",
"00",
":",
"00",
":",
"00",
"Z",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"share",
"Proper",
"ties",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"'_",
":_",
"'",
"test",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"doc",
"ID",
"'_",
":_",
"'",
"test",
"1",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TEST",
"\\u",
"SCHEMA_",
"=_",
"update",
"d\\u",
"schema_",
"(_",
"DO",
"ESC",
"HEM",
"A_",
",_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"title",
"\"_",
":_",
"(_",
"\"//",
"dc",
":",
"title",
"/",
"node",
"()\"_",
",_",
"lambda_",
"x_",
":_",
"\"",
"Tit",
"le",
" ",
"overwrit",
"ten",
"\"_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"other",
"Proper",
"ties",
"\"_",
":_",
"build",
"\\u",
"properties_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"title",
"1",
"\"_",
",_",
"(_",
"\"//",
"dc",
":",
"title",
"/",
"node",
"()\"_",
",_",
"single",
"\\u",
"result_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"title",
"2",
"\"_",
",_",
"(_",
"\"//",
"dc",
":",
"title",
"/",
"node",
"()\"_",
",_",
"lambda_",
"x_",
":_",
"single",
"\\u",
"result_",
"(_",
"x_",
")_",
"._",
"lower_",
"(_",
")_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"\"",
"title",
"3",
"\"_",
",_",
"(_",
"\"//",
"dc",
":",
"title",
"/",
"node",
"()\"_",
",_",
"\"//",
"dc",
":",
"title",
"/",
"node",
"()\"_",
",_",
"lambda_",
"x_",
",_",
"y_",
":_",
"single",
"\\u",
"result_",
"(_",
"x_",
")_",
"+_",
"single",
"\\u",
"result_",
"(_",
"y_",
")_",
"._",
"lower_",
"(_",
")_",
")_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TEST",
"\\u",
"NAMESPACE",
"S_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"rdf",
"'_",
":_",
"'",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"1999",
"/",
"02",
"/",
"2",
"2",
"-",
"rdf",
"-",
"synta",
"x",
"-",
"ns",
"#'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dc",
"'_",
":_",
"'",
"http",
"://",
"pur",
"l",
".",
"org",
"/",
"dc",
"/",
"element",
"s",
"/",
"1.1",
"/'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"dc",
"q",
"'_",
":_",
"'",
"http",
"://",
"pur",
"l",
".",
"org",
"/",
"dc",
"/",
"term",
"s",
"/'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TEST",
"\\u",
"XML",
"\\u",
"DOC",
"_",
"=_",
"b",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"rdf",
":",
"RDF",
" ",
"xml",
"ns",
":",
"rdf",
"=\"",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"1999",
"/",
"02",
"/",
"2",
"2",
"-",
"rdf",
"-",
"synta",
"x",
"-",
"ns",
"#\"",
" ",
"xml",
"ns",
":",
"dc",
"=\"",
"http",
"://",
"pur",
"l",
".",
"org",
"/",
"dc",
"/",
"element",
"s",
"/",
"1.1",
"/\"",
" ",
"xml",
"ns",
":",
"dc",
"q",
"=\"",
"http",
"://",
"pur",
"l",
".",
"org",
"/",
"dc",
"/",
"term",
"s",
"/\"",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"record",
"s",
" ",
"count",
"=\"",
"9",
"7",
"\"",
" ",
"more",
"page",
"s",
"=\"",
"true",
"\"",
" ",
"start",
"=\"",
"1",
"\"",
" ",
"end",
"=\"",
"10",
"\">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"record",
" ",
"rown",
"umber",
"=\"",
"1",
"\">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"title",
">",
"Test",
"</",
"dc",
":",
"title",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"creat",
"or",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ra",
"veh",
"-",
"Sa",
"dk",
"a",
",",
" ",
"Tal",
"i",
";",
" ",
"Tho",
"mas",
",",
" ",
"Brian",
" ",
"C",
";",
" ",
"Sing",
"h",
",",
" ",
"Andre",
"a",
";",
" ",
"Fire",
"k",
",",
" ",
"Brian",
";",
" ",
"Bro",
"oks",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Brand",
"on",
";",
" ",
"Cast",
"elle",
",",
" ",
"Cin",
"dy",
" ",
"J",
";",
" ",
"Shar",
"on",
",",
" ",
"It",
"ai",
";",
" ",
"Bak",
"er",
",",
" ",
"Rob",
"yn",
";",
" ",
"Good",
",",
" ",
"Mis",
"ty",
";",
" ",
"Mor",
"owi",
"tz",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Mich",
"ael",
" ",
"J",
";",
" ",
"Ban",
"field",
",",
" ",
"Jil",
"lian",
" ",
"F",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"creat",
"or",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"subject",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"subject",
"Rela",
"ted",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"description",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"publi",
"sher",
">",
"\\",
"10",
";",
" ",
" ",
"e",
"Life",
" ",
"Sci",
"ences",
" ",
"Public",
"ation",
"s",
",",
" ",
"Lt",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
"q",
":",
"publi",
"sher",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"publi",
"sher",
"Avail",
"abilit",
"y",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"publi",
"sher",
"Rese",
"arch",
">",
"\\",
"10",
";",
" ",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
"q",
":",
"publi",
"sher",
"Rese",
"arch",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"publi",
"sher",
"Spo",
"nsor",
">",
"\\",
"10",
";",
" ",
" ",
"US",
"DO",
"E",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
"q",
":",
"publi",
"sher",
"Spo",
"nsor",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"publi",
"sher",
"Count",
"ry",
">",
"\\",
"10",
";",
" ",
" ",
"Count",
"ry",
" ",
"unknown",
"/",
"Code",
" ",
"not",
" ",
"avail",
"able",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
"q",
":",
"publi",
"sher",
"Count",
"ry",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"date",
">",
"\\",
"10",
";",
" ",
" ",
"201",
"5",
"-0",
"3",
"-0",
"3",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"date",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"language",
">",
"\\",
"10",
";",
" ",
" ",
"Eng",
"lish",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"language",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"type",
">",
"\\",
"10",
";",
" ",
" ",
"Journ",
"al",
" ",
"Artic",
"le",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"type",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"type",
"Qualifier",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"relation",
">",
"\\",
"10",
";",
" ",
" ",
"Journ",
"al",
" ",
"Name",
":",
" ",
"e",
"Life",
";",
" ",
"Journ",
"al",
" ",
"Volume",
":",
" ",
"4",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"relation",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"covera",
"ge",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"format",
">",
"\\",
"10",
";",
" ",
" ",
"Medi",
"um",
":",
" ",
"X",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"format",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"identifi",
"er",
">",
"\\",
"10",
";",
" ",
" ",
"OST",
"I",
" ",
"ID",
":",
" ",
"1171",
"761",
",",
" ",
"Leg",
"ac",
"y",
" ",
"ID",
":",
" ",
"OST",
"I",
" ",
"ID",
":",
" ",
"1171",
"761",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"identifi",
"er",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"identifi",
"er",
"Report",
">",
"\\",
"10",
";",
" ",
" ",
"Non",
"e",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"identifi",
"er",
"Report",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"identifi",
"er",
"DO",
"Econ",
"tract",
">",
"\\",
"10",
";",
" ",
" ",
"5",
"R0",
"1",
"AI",
"092",
"531",
";",
" ",
"Long",
" ",
"term",
" ",
"fel",
"lows",
"hip",
";",
" ",
"SC",
"0004",
"918",
";",
" ",
"ER",
"655",
"6",
"1",
";",
" ",
"APS",
"F",
"-",
"2012",
"-1",
"0",
"-0",
"5",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
"q",
":",
"identifi",
"er",
"DO",
"Econ",
"tract",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"identifi",
"er",
"Ot",
"her",
">",
"Journ",
"al",
" ",
"ID",
":",
" ",
"ISS",
"N",
" ",
"2050",
"-0",
"84",
"X",
"</",
"dc",
":",
"identifi",
"er",
"Ot",
"her",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"doi",
">",
"10.",
"755",
"4",
"/",
"e",
"Life",
".0",
"547",
"7",
"</",
"dc",
":",
"doi",
"><",
"dc",
":",
"rights",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"date",
"Entr",
"y",
">",
"201",
"5",
"-0",
"3",
"-0",
"5",
"</",
"dc",
":",
"date",
"Entr",
"y",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"date",
"Added",
">",
"201",
"5",
"-0",
"3",
"-0",
"5",
"</",
"dc",
":",
"date",
"Added",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"ost",
"i",
"Id",
">",
"1171",
"761",
"</",
"dc",
":",
"ost",
"i",
"Id",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"identifi",
"er",
"-",
"pur",
"l",
" ",
"type",
"=\"\"",
"/>",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
"q",
":",
"identifi",
"er",
"-",
"cit",
"ation",
">",
"\\",
"10",
";",
" ",
" ",
"http",
"://",
"www",
".",
"ost",
"i",
".",
"gov",
"/",
"page",
"s",
"/",
"biblio",
"/",
"1171",
"761",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
"q",
":",
"identifi",
"er",
"-",
"cit",
"ation",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"record",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"record",
"s",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"rdf",
":",
"RDF",
">",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"TEST",
"\\u",
"OA",
"I",
"\\u",
"DOC",
"_",
"=_",
"b",
"'''",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"OA",
"I",
"-",
"PM",
"H",
" ",
"xml",
"ns",
"=\"",
"http",
"://",
"www",
".",
"opena",
"rchi",
"ves",
".",
"org",
"/",
"OA",
"I",
"/",
"2.0",
"/\"",
" ",
"xml",
"ns",
":",
"xsi",
"=\"",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"200",
"1",
"/",
"XML",
"Schema",
"-",
"instance",
"\"",
" ",
"xsi",
":",
"schema",
"Locat",
"ion",
"=\"",
"http",
"://",
"www",
".",
"opena",
"rchi",
"ves",
".",
"org",
"/",
"OA",
"I",
"/",
"2.0",
"/",
" ",
"http",
"://",
"www",
".",
"opena",
"rchi",
"ves",
".",
"org",
"/",
"OA",
"I",
"/",
"2.0",
"/",
"OA",
"I",
"-",
"PM",
"H",
".",
"xsd",
"\">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"response",
"Date",
">",
"201",
"5",
"-0",
"3",
"-",
"30",
"T1",
"8",
":",
"3",
"1",
":",
"2",
"9",
"Z",
"</",
"response",
"Date",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"request",
" ",
"verb",
"=\"",
"List",
"Record",
"s",
"\"",
" ",
"metadata",
"Pref",
"ix",
"=\"",
"oai",
"\\u",
"dc",
"\"",
" ",
"from",
"=\"",
"2014",
"-0",
"9",
"-",
"2",
"6",
"T",
"00",
":",
"00",
":",
"00",
"Z",
"\">",
"http",
"://",
"repos",
"itor",
"y",
".",
"stc",
"loud",
"state",
".",
"edu",
"/",
"do",
"/",
"oai",
"/",
"</",
"request",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"List",
"Record",
"s",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"record",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"header",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"identifi",
"er",
">",
"oai",
":",
"digital",
"common",
"s",
".",
"cal",
"poly",
".",
"edu",
":",
"age",
"d\\u",
"rpt",
"-1",
"085",
"</",
"identifi",
"er",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dates",
"tamp",
">",
"2014",
"-1",
"0",
"-0",
"7",
"T",
"00",
":",
"30",
":",
"5",
"7",
"Z",
"</",
"dates",
"tamp",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"set",
"Spec",
">",
"publicat",
"ion",
":",
"age",
"d\\u",
"rpt",
"</",
"set",
"Spec",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"set",
"Spec",
">",
"publicat",
"ion",
":",
"student",
"s",
"</",
"set",
"Spec",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"header",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"metadata",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"oai",
"\\u",
"dc",
":",
"dc",
" ",
"xml",
"ns",
":",
"oai",
"\\u",
"dc",
"=\"",
"http",
"://",
"www",
".",
"opena",
"rchi",
"ves",
".",
"org",
"/",
"OA",
"I",
"/",
"2.0",
"/",
"oai",
"\\u",
"dc",
"/\"",
" ",
"xml",
"ns",
":",
"dc",
"=\"",
"http",
"://",
"pur",
"l",
".",
"org",
"/",
"dc",
"/",
"element",
"s",
"/",
"1.1",
"/\"",
" ",
"xml",
"ns",
":",
"xsi",
"=\"",
"http",
"://",
"www",
".",
"w3",
".",
"org",
"/",
"200",
"1",
"/",
"XML",
"Schema",
"-",
"instance",
"\"",
" ",
"xsi",
":",
"schema",
"Locat",
"ion",
"=\"",
"http",
"://",
"www",
".",
"opena",
"rchi",
"ves",
".",
"org",
"/",
"OA",
"I",
"/",
"2.0",
"/",
"oai",
"\\u",
"dc",
"/",
" ",
"http",
"://",
"www",
".",
"opena",
"rchi",
"ves",
".",
"org",
"/",
"OA",
"I",
"/",
"2.0",
"/",
"oai",
"\\u",
"dc",
".",
"xsd",
"\">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"title",
">",
"Test",
"</",
"dc",
":",
"title",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"creat",
"or",
">",
"Mill",
"s",
",",
" ",
"Dona",
"ld",
" ",
"W",
",",
" ",
"J",
"r",
".",
"</",
"dc",
":",
"creat",
"or",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"description",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"intern",
"ship",
" ",
"report",
" ",
"consi",
"sts",
" ",
"of",
" ",
"two",
" ",
"part",
"s",
".",
" ",
"The",
" ",
"first",
" ",
"section",
" ",
"addresse",
"s",
" ",
"the",
" ",
"Qual",
"it",
"y",
" ",
"Criteria",
" ",
"in",
" ",
"Agr",
"icult",
"ural",
" ",
"Ed",
"uca",
"tion",
" ",
"for",
" ",
"the",
" ",
"program",
" ",
"of",
" ",
"agr",
"icult",
"ural",
" ",
"instruct",
"ion",
" ",
"at",
" ",
"Ar",
"vin",
" ",
"Hig",
"h",
" ",
"Scho",
"ol",
".",
" ",
"The",
" ",
"second",
" ",
"section",
" ",
"explain",
"s",
" ",
"the",
" ",
"step",
"s",
" ",
"in",
" ",
"remo",
"deli",
"ng",
" ",
"the",
" ",
"agr",
"icult",
"ure",
" ",
"class",
"room",
" ",
"and",
" ",
"agr",
"icult",
"ure",
" ",
"mechani",
"cs",
" ",
"shop",
" ",
"at",
" ",
"Ar",
"vin",
" ",
"Hig",
"h",
" ",
"Scho",
"ol",
".",
" ",
"The",
" ",
"remo",
"deli",
"ng",
" ",
"of",
" ",
"the",
" ",
"facilit",
"y",
" ",
"was",
" ",
"accom",
"pli",
"shed",
" ",
"to",
" ",
"address",
" ",
"the",
" ",
"occupation",
"al",
" ",
"need",
"s",
" ",
"for",
" ",
"student",
"s",
" ",
"entering",
" ",
"the",
" ",
"work",
" ",
"force",
" ",
"immediate",
"ly",
" ",
"after",
" ",
"high",
" ",
"school",
".",
" ",
"It",
" ",
"was",
" ",
"als",
"o",
" ",
"design",
"ed",
" ",
"to",
" ",
"prepar",
"e",
" ",
"student",
"s",
" ",
"for",
" ",
"opportunit",
"ies",
" ",
"in",
" ",
"higher",
" ",
"educa",
"tion",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"description",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"date",
">",
"2014",
"-0",
"5",
"-0",
"1",
"T",
"0",
"7",
":",
"00",
":",
"00",
"Z",
"</",
"dc",
":",
"date",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"type",
">",
"text",
"</",
"dc",
":",
"type",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"format",
">",
"applica",
"tion",
"/",
"pdf",
"</",
"dc",
":",
"format",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"identifi",
"er",
">",
"http",
"://",
"digital",
"common",
"s",
".",
"cal",
"poly",
".",
"edu",
"/",
"age",
"d\\u",
"rpt",
"/",
"64",
"</",
"dc",
":",
"identifi",
"er",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"identifi",
"er",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"http",
"://",
"digital",
"common",
"s",
".",
"cal",
"poly",
".",
"edu",
"/",
"cgi",
"/",
"view",
"content",
".",
"cgi",
"?",
"article",
"=",
"108",
"5",
"&",
"amp",
";",
"context",
"=",
"age",
"d\\u",
"rpt",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"identifi",
"er",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"source",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Grad",
"uat",
"e",
" ",
"Intern",
"ship",
" ",
"Report",
"s",
" ",
"in",
" ",
"Agr",
"icult",
"ural",
" ",
"Ed",
"uca",
"tion",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"dc",
":",
"source",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"<",
"dc",
":",
"publi",
"sher",
">",
"Digit",
"al",
"Common",
"s",
"@",
"Cal",
"Poly",
"</",
"dc",
":",
"publi",
"sher",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"oai",
"\\u",
"dc",
":",
"dc",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"metadata",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"record",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"List",
"Record",
"s",
">",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"</",
"OA",
"I",
"-",
"PM",
"H",
">",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Test",
"Harvest",
"er_",
"(_",
"XML",
"Harvest",
"er_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"long",
"\\u",
"name_",
"=_",
"'",
"TEST",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"short",
"\\u",
"name_",
"=_",
"'",
"test",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"url_",
"=_",
"'",
"TEST",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"schema_",
"=_",
"TEST",
"\\u",
"SCHEMA_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"namespaces_",
"=_",
"TEST",
"\\u",
"NAMESPACE",
"S_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Test",
"Harvest",
"er_",
"(_",
"XML",
"Harvest",
"er_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"harvest",
"_",
"(_",
"self_",
",_",
"day",
"s",
"\\u",
"back_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"[_",
"Ra",
"w",
"Document_",
"(_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"doc",
"'_",
":_",
"TEST",
"\\u",
"XML",
"\\u",
"DOC",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"source",
"'_",
":_",
"'",
"test",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"filet",
"ype",
"'_",
":_",
"'",
"XML",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"doc",
"ID",
"'_",
":_",
"\"",
"1",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"timestamp",
"s",
"'_",
":_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"harvest",
"Finish",
"ed",
"'_",
":_",
"'",
"201",
"5",
"-0",
"3",
"-1",
"4",
"T1",
"7",
":",
"05",
":",
"4",
"8",
"+0",
"0",
":",
"00",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"harvest",
"Start",
"ed",
"'_",
":_",
"'",
"201",
"5",
"-0",
"3",
"-1",
"4",
"T1",
"7",
":",
"05",
":",
"4",
"8",
"+0",
"0",
":",
"00",
"'_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"harvest",
"Task",
"Creat",
"ed",
"'_",
":_",
"'",
"201",
"5",
"-0",
"3",
"-1",
"6",
"T1",
"7",
":",
"05",
":",
"4",
"8",
"+0",
"0",
":",
"00",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
")_",
"for_",
"\\u_",
"in_",
"xrange_",
"(_",
"day",
"s",
"\\u",
"back_",
")_",
"]_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | tanghaibao/jcvi/formats/fasta.py | [
{
"content": "def pair(args):\n \"\"\"\n %prog pair fastafile\n\n Generate .pairs.fasta and .fragments.fasta by matching records\n into the pairs and the rest go to fragments.\n \"\"\"\n p = OptionParser(pair.__doc__)\n p.set_sep(sep=None, help=\"Separator in name to reduce to clone id\" +\\\n \"e.g. GFNQ33242/1 use /, BOT01-2453H.b1 use .\")\n p.add_option(\"-m\", dest=\"matepairs\", default=False, action=\"store_true\",\n help=\"generate .matepairs file [often used for Celera Assembler]\")\n opts, args = p.parse_args(args)\n\n if len(args) != 1:\n sys.exit(p.print_help())\n\n fastafile, = args\n qualfile = get_qual(fastafile)\n\n prefix = fastafile.rsplit(\".\", 1)[0]\n pairsfile = prefix + \".pairs.fasta\"\n fragsfile = prefix + \".frags.fasta\"\n pairsfw = open(pairsfile, \"w\")\n fragsfw = open(fragsfile, \"w\")\n\n #TODO: need a class to handle coupled fasta and qual iterating and indexing\n if opts.matepairs:\n matepairsfile = prefix + \".matepairs\"\n matepairsfw = open(matepairsfile, \"w\")\n\n if qualfile:\n pairsqualfile = pairsfile + \".qual\"\n pairsqualhandle = open(pairsqualfile, \"w\")\n fragsqualfile = fragsfile + \".qual\"\n fragsqualhandle = open(fragsqualfile, \"w\")\n\n f = Fasta(fastafile)\n if qualfile:\n q = SeqIO.index(qualfile, \"qual\")\n\n all_keys = list(f.iterkeys())\n all_keys.sort()\n sep = opts.sep\n\n if sep:\n key_fun = lambda x: x.split(sep, 1)[0]\n else:\n key_fun = lambda x: x[:-1]\n\n for key, variants in groupby(all_keys, key=key_fun):\n variants = list(variants)\n paired = (len(variants) == 2)\n\n if paired and opts.matepairs:\n print >> matepairsfw, \"\\t\".join((\"%s/1\" % key, \"%s/2\" % key))\n\n fw = pairsfw if paired else fragsfw\n if qualfile:\n qualfw = pairsqualhandle if paired else fragsqualhandle\n\n for i, var in enumerate(variants):\n rec = f[var]\n if qualfile:\n recqual = q[var]\n newid = \"%s/%d\" % (key, i + 1)\n\n rec.id = newid\n rec.description = \"\"\n SeqIO.write([rec], fw, \"fasta\")\n if qualfile:\n recqual.id = newid\n recqual.description = \"\"\n SeqIO.write([recqual], qualfw, \"qual\")\n\n logging.debug(\"sequences written to `%s` and `%s`\" % \\\n (pairsfile, fragsfile))\n if opts.matepairs:\n logging.debug(\"mates written to `%s`\" % matepairsfile)",
"metadata": "root.pair",
"header": "['module', '___EOS___']",
"index": 1586
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"pair_",
"(_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"%",
"prog",
" ",
"pair",
" ",
"fasta",
"file",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Generate",
" ",
".",
"pair",
"s",
".",
"fasta",
" ",
"and",
" ",
".",
"fragment",
"s",
".",
"fasta",
" ",
"by",
" ",
"matchi",
"ng",
" ",
"record",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"int",
"o",
" ",
"the",
" ",
"pair",
"s",
" ",
"and",
" ",
"the",
" ",
"rest",
" ",
"go",
" ",
"to",
" ",
"fragment",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"=_",
"Optio",
"n",
"Parser_",
"(_",
"pair_",
"._",
"\\u\\u",
"doc\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"._",
"set\\u",
"sep_",
"(_",
"sep_",
"=_",
"None_",
",_",
"help_",
"=_",
"\"",
"Sepa",
"rator",
" ",
"in",
" ",
"name",
" ",
"to",
" ",
"reduce",
" ",
"to",
" ",
"clone",
" ",
"id",
"\"_",
"+_",
"\"",
"e",
".",
"g",
".",
" ",
"GF",
"NQ",
"332",
"4",
"2",
"/",
"1",
" ",
"use",
" ",
"/",
",",
" ",
"BOT",
"01",
"-",
"245",
"3",
"H",
".",
"b1",
" ",
"use",
" ",
".\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"p_",
"._",
"add",
"\\u",
"option_",
"(_",
"\"-",
"m",
"\"_",
",_",
"dest_",
"=_",
"\"",
"mate",
"pair",
"s",
"\"_",
",_",
"default_",
"=_",
"False_",
",_",
"action_",
"=_",
"\"",
"store",
"\\u",
"true",
"\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"help_",
"=_",
"\"",
"generat",
"e",
" ",
".",
"mate",
"pair",
"s",
" ",
"file",
" ",
"[",
"oft",
"en",
" ",
"used",
" ",
"for",
" ",
"Cel",
"era",
" ",
"Assemble",
"r",
"]\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"opts_",
",_",
"args_",
"=_",
"p_",
"._",
"parse",
"\\u",
"args_",
"(_",
"args_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"len_",
"(_",
"args_",
")_",
"!=_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"sys_",
"._",
"exit_",
"(_",
"p_",
"._",
"print",
"\\u",
"help_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fasta",
"file_",
",_",
"=_",
"args_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"qual",
"file_",
"=_",
"get",
"\\u",
"qual_",
"(_",
"fasta",
"file_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"prefix_",
"=_",
"fasta",
"file_",
"._",
"rsplit_",
"(_",
"\".\"_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pair",
"sfile_",
"=_",
"prefix_",
"+_",
"\".",
"pair",
"s",
".",
"fasta",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"frags",
"file_",
"=_",
"prefix_",
"+_",
"\".",
"frags",
".",
"fasta",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pair",
"sf",
"w_",
"=_",
"open_",
"(_",
"pair",
"sfile_",
",_",
"\"",
"w",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"frags",
"fw_",
"=_",
"open_",
"(_",
"frags",
"file_",
",_",
"\"",
"w",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"TOD",
"O",
":",
" ",
"need",
" ",
"a",
" ",
"class",
" ",
"to",
" ",
"handle",
" ",
"couple",
"d",
" ",
"fasta",
" ",
"and",
" ",
"qual",
" ",
"iterati",
"ng",
" ",
"and",
" ",
"indexing",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"opts_",
"._",
"mate",
"pairs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"mate",
"pair",
"sfile_",
"=_",
"prefix_",
"+_",
"\".",
"mate",
"pair",
"s",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"mate",
"pair",
"sf",
"w_",
"=_",
"open_",
"(_",
"mate",
"pair",
"sfile_",
",_",
"\"",
"w",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"qual",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pair",
"squa",
"lfil",
"e_",
"=_",
"pair",
"sfile_",
"+_",
"\".",
"qual",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"pair",
"squa",
"lha",
"ndl",
"e_",
"=_",
"open_",
"(_",
"pair",
"squa",
"lfil",
"e_",
",_",
"\"",
"w",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"frags",
"qual",
"file_",
"=_",
"frags",
"file_",
"+_",
"\".",
"qual",
"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"frags",
"qual",
"handle_",
"=_",
"open_",
"(_",
"frags",
"qual",
"file_",
",_",
"\"",
"w",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"f_",
"=_",
"Fast",
"a_",
"(_",
"fasta",
"file_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"qual",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"q_",
"=_",
"Seq",
"IO_",
"._",
"index_",
"(_",
"qual",
"file_",
",_",
"\"",
"qual",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"all",
"\\u",
"keys_",
"=_",
"list_",
"(_",
"f_",
"._",
"iterkeys_",
"(_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"all",
"\\u",
"keys_",
"._",
"sort_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"sep_",
"=_",
"opts_",
"._",
"sep_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"sep_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key",
"\\u",
"fun_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"._",
"split_",
"(_",
"sep_",
",_",
"1_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"key",
"\\u",
"fun_",
"=_",
"lambda_",
"x_",
":_",
"x_",
"[_",
":_",
"-_",
"1_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"key_",
",_",
"variants_",
"in_",
"groupby_",
"(_",
"all",
"\\u",
"keys_",
",_",
"key_",
"=_",
"key",
"\\u",
"fun_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"variants_",
"=_",
"list_",
"(_",
"variants_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"paired",
"_",
"=_",
"(_",
"len_",
"(_",
"variants_",
")_",
"==_",
"2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"paired",
"_",
"and_",
"opts_",
"._",
"mate",
"pairs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"print_",
">>_",
"mate",
"pair",
"sf",
"w_",
",_",
"\"\\\\",
"t",
"\"_",
"._",
"join_",
"(_",
"(_",
"\"%",
"s",
"/",
"1",
"\"_",
"%_",
"key_",
",_",
"\"%",
"s",
"/",
"2",
"\"_",
"%_",
"key_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"fw_",
"=_",
"pair",
"sf",
"w_",
"if_",
"paired",
"_",
"else_",
"frags",
"fw_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"qual",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"qual",
"fw_",
"=_",
"pair",
"squa",
"lha",
"ndl",
"e_",
"if_",
"paired",
"_",
"else_",
"frags",
"qual",
"handle_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
",_",
"var_",
"in_",
"enumerate_",
"(_",
"variants_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rec_",
"=_",
"f_",
"[_",
"var_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"qual",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rec",
"qual_",
"=_",
"q_",
"[_",
"var_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"newi",
"d_",
"=_",
"\"%",
"s",
"/",
"%",
"d",
"\"_",
"%_",
"(_",
"key_",
",_",
"i_",
"+_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"rec_",
"._",
"id_",
"=_",
"newi",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rec_",
"._",
"description_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Seq",
"IO_",
"._",
"write_",
"(_",
"[_",
"rec_",
"]_",
",_",
"fw_",
",_",
"\"",
"fasta",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"qual",
"file_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"rec",
"qual_",
"._",
"id_",
"=_",
"newi",
"d_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"rec",
"qual_",
"._",
"description_",
"=_",
"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"Seq",
"IO_",
"._",
"write_",
"(_",
"[_",
"rec",
"qual_",
"]_",
",_",
"qual",
"fw_",
",_",
"\"",
"qual",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logging_",
"._",
"debug_",
"(_",
"\"",
"sequence",
"s",
" ",
"writt",
"en",
" ",
"to",
" ",
"`",
"%",
"s",
"`",
" ",
"and",
" ",
"`",
"%",
"s",
"`\"_",
"%_",
"(_",
"pair",
"sfile_",
",_",
"frags",
"file_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"opts_",
"._",
"mate",
"pairs_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logging_",
"._",
"debug_",
"(_",
"\"",
"mate",
"s",
" ",
"writt",
"en",
" ",
"to",
" ",
"`",
"%",
"s",
"`\"_",
"%_",
"mate",
"pair",
"sfile_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Signature mismatch in overriding method | CouchPotato/CouchPotatoServer/libs/suds/sax/text.py | [
{
"content": "class Text(unicode):\n \"\"\"\n An XML text object used to represent text content.\n @ivar lang: The (optional) language flag.\n @type lang: bool\n @ivar escaped: The (optional) XML special character escaped flag.\n @type escaped: bool\n \"\"\"\n __slots__ = ('lang', 'escaped',)\n \n \n \n \n \n \n \n \n ",
"metadata": "root.Text",
"header": "['module', '___EOS___']",
"index": 24
},
{
"content": " @classmethod\n def __valid(cls, *args):\n return ( len(args) and args[0] is not None )",
"metadata": "root.Text.__valid",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 34
},
{
"content": " def __new__(cls, *args, **kwargs):\n if cls.__valid(*args):\n lang = kwargs.pop('lang', None)\n escaped = kwargs.pop('escaped', False)\n result = super(Text, cls).__new__(cls, *args, **kwargs)\n result.lang = lang\n result.escaped = escaped\n else:\n result = None\n return result",
"metadata": "root.Text.__new__",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 38
},
{
"content": " def escape(self):\n \"\"\"\n Encode (escape) special XML characters.\n @return: The text with XML special characters escaped.\n @rtype: L{Text}\n \"\"\"\n if not self.escaped:\n post = sax.encoder.encode(self)\n escaped = ( post != self )\n return Text(post, lang=self.lang, escaped=escaped)\n return self",
"metadata": "root.Text.escape",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 49
},
{
"content": " def unescape(self):\n \"\"\"\n Decode (unescape) special XML characters.\n @return: The text with escaped XML special characters decoded.\n @rtype: L{Text}\n \"\"\"\n if self.escaped:\n post = sax.encoder.decode(self)\n return Text(post, lang=self.lang)\n return self",
"metadata": "root.Text.unescape",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 61
},
{
"content": " def trim(self):\n post = self.strip()\n return Text(post, lang=self.lang, escaped=self.escaped)",
"metadata": "root.Text.trim",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 72
},
{
"content": " def __add__(self, other):\n joined = u''.join((self, other))\n result = Text(joined, lang=self.lang, escaped=self.escaped)\n if isinstance(other, Text):\n result.escaped = ( self.escaped or other.escaped )\n return result",
"metadata": "root.Text.__add__",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 76
},
{
"content": " def __repr__(self):\n s = [self]\n if self.lang is not None:\n s.append(' [%s]' % self.lang)\n if self.escaped:\n s.append(' <escaped>')\n return ''.join(s)",
"metadata": "root.Text.__repr__",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 83
},
{
"content": " def __getstate__(self):\n state = {}\n for k in self.__slots__:\n state[k] = getattr(self, k)\n return state",
"metadata": "root.Text.__getstate__",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 91
},
{
"content": " def __setstate__(self, state):\n for k in self.__slots__:\n setattr(self, k, state[k])",
"metadata": "root.Text.__setstate__",
"header": "['class', 'Text', '(', 'unicode', ')', ':', '___EOS___']",
"index": 97
},
{
"content": "class Raw(Text):\n \"\"\"\n Raw text which is not XML escaped.\n This may include I{string} XML.\n \"\"\"\n \n ",
"metadata": "root.Raw",
"header": "['module', '___EOS___']",
"index": 102
},
{
"content": " def escape(self):\n return self",
"metadata": "root.Raw.escape",
"header": "['class', 'Raw', '(', 'Text', ')', ':', '___EOS___']",
"index": 107
},
{
"content": " def unescape(self):\n return self",
"metadata": "root.Raw.unescape",
"header": "['class', 'Raw', '(', 'Text', ')', ':', '___EOS___']",
"index": 110
},
{
"content": " def __add__(self, other):\n joined = u''.join((self, other))\n return Raw(joined, lang=self.lang)",
"metadata": "root.Raw.__add__",
"header": "['class', 'Raw', '(', 'Text', ')', ':', '___EOS___']",
"index": 113
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Signature_",
"mismatch_",
"in_",
"overrid",
"ing_",
"method_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"An",
" ",
"XML",
" ",
"text",
" ",
"object",
" ",
"used",
" ",
"to",
" ",
"represent",
" ",
"text",
" ",
"content",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"ivar",
" ",
"lang",
":",
" ",
"The",
" ",
"(",
"option",
"al",
")",
" ",
"language",
" ",
"flag",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"lang",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"ivar",
" ",
"escaped",
":",
" ",
"The",
" ",
"(",
"option",
"al",
")",
" ",
"XML",
" ",
"special",
" ",
"character",
" ",
"escaped",
" ",
"flag",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"type",
" ",
"escaped",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u",
"slots\\u\\u_",
"=_",
"(_",
"'",
"lang",
"'_",
",_",
"'",
"escaped",
"'_",
",_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"@_",
"classmethod_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"\\u\\u",
"valid_",
"(_",
"cls_",
",_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"(_",
"len_",
"(_",
"args_",
")_",
"and_",
"args_",
"[_",
"0_",
"]_",
"is_",
"not_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"new\\u\\u_",
"(_",
"cls_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"cls_",
"._",
"\\u\\u",
"valid_",
"(_",
"*_",
"args_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"lang_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"'",
"lang",
"'_",
",_",
"None_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"escaped",
"_",
"=_",
"kwargs_",
"._",
"pop_",
"(_",
"'",
"escaped",
"'_",
",_",
"False_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"super_",
"(_",
"Text_",
",_",
"cls_",
")_",
"._",
"\\u\\u",
"new\\u\\u_",
"(_",
"cls_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"lang_",
"=_",
"lang_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"._",
"escaped",
"_",
"=_",
"escaped",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"escape_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Encode",
" ",
"(",
"escape",
")",
" ",
"special",
" ",
"XML",
" ",
"character",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"return",
":",
" ",
"The",
" ",
"text",
" ",
"with",
" ",
"XML",
" ",
"special",
" ",
"character",
"s",
" ",
"escaped",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"L",
"{",
"Text",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"self_",
"._",
"escaped",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"post_",
"=_",
"sax_",
"._",
"encoder_",
"._",
"encode_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"escaped",
"_",
"=_",
"(_",
"post_",
"!=_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Text_",
"(_",
"post_",
",_",
"lang_",
"=_",
"self_",
"._",
"lang_",
",_",
"escaped",
"_",
"=_",
"escaped",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"unescape_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Decode",
" ",
"(",
"unescape",
")",
" ",
"special",
" ",
"XML",
" ",
"character",
"s",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"return",
":",
" ",
"The",
" ",
"text",
" ",
"with",
" ",
"escaped",
" ",
"XML",
" ",
"special",
" ",
"character",
"s",
" ",
"decode",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"@",
"rty",
"pe",
":",
" ",
"L",
"{",
"Text",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"escaped",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"post_",
"=_",
"sax_",
"._",
"encoder_",
"._",
"decode_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Text_",
"(_",
"post_",
",_",
"lang_",
"=_",
"self_",
"._",
"lang_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"trim_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"post_",
"=_",
"self_",
"._",
"strip_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Text_",
"(_",
"post_",
",_",
"lang_",
"=_",
"self_",
"._",
"lang_",
",_",
"escaped",
"_",
"=_",
"self_",
"._",
"escaped",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"add\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"joined_",
"=_",
"u",
"''_",
"._",
"join_",
"(_",
"(_",
"self_",
",_",
"other_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"result_",
"=_",
"Text_",
"(_",
"joined_",
",_",
"lang_",
"=_",
"self_",
"._",
"lang_",
",_",
"escaped",
"_",
"=_",
"self_",
"._",
"escaped",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"isinstance_",
"(_",
"other_",
",_",
"Text_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result_",
"._",
"escaped",
"_",
"=_",
"(_",
"self_",
"._",
"escaped",
"_",
"or_",
"other_",
"._",
"escaped",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"result_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"repr\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"s_",
"=_",
"[_",
"self_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"lang_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"s_",
"._",
"append_",
"(_",
"'",
" ",
"[",
"%",
"s",
"]'_",
"%_",
"self_",
"._",
"lang_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"escaped",
"_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"s_",
"._",
"append_",
"(_",
"'",
" ",
"<",
"escaped",
">'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"''_",
"._",
"join_",
"(_",
"s_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"getstate",
"\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"state_",
"=_",
"{_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"k_",
"in_",
"self_",
"._",
"\\u\\u",
"slots\\u\\u_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"state_",
"[_",
"k_",
"]_",
"=_",
"getattr_",
"(_",
"self_",
",_",
"k_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"state_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Text_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"setstate",
"\\u\\u_",
"(_",
"self_",
",_",
"state_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"k_",
"in_",
"self_",
"._",
"\\u\\u",
"slots\\u\\u_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"setattr_",
"(_",
"self_",
",_",
"k_",
",_",
"state_",
"[_",
"k_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Raw_",
"(_",
"Text_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ra",
"w",
" ",
"text",
" ",
"whi",
"ch",
" ",
"is",
" ",
"not",
" ",
"XML",
" ",
"escaped",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Thi",
"s",
" ",
"may",
" ",
"include",
" ",
"I",
"{",
"string",
"}",
" ",
"XML",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Raw_",
"(_",
"Text_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"escape_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Raw_",
"(_",
"Text_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"unescape_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Raw_",
"(_",
"Text_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"add\\u\\u_",
"(_",
"self_",
",_",
"other_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"joined_",
"=_",
"u",
"''_",
"._",
"join_",
"(_",
"(_",
"self_",
",_",
"other_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Raw_",
"(_",
"joined_",
",_",
"lang_",
"=_",
"self_",
"._",
"lang_",
")_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2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2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Module is imported with 'import' and 'import from' | matrix-org/synapse/synapse/rest/media/v1/identicon_resource.py | [
{
"content": "# Copyright 2015, 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom pydenticon import Generator\nfrom twisted.web.resource import Resource\n\nFOREGROUND = [\n \"rgb(45,79,255)\",\n \"rgb(254,180,44)\",\n \"rgb(226,121,234)\",\n \"rgb(30,179,253)\",\n \"rgb(232,77,65)\",\n \"rgb(49,203,115)\",\n \"rgb(141,69,170)\"\n]\n\nBACKGROUND = \"rgb(224,224,224)\"\nSIZE = 5\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"#",
" ",
"Copy",
"right",
" ",
"201",
"5",
",",
" ",
"2016",
" ",
"Open",
"Market",
" ",
"Lt",
"d_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"License",
"d",
" ",
"under",
" ",
"the",
" ",
"Ap",
"ache",
" ",
"License",
",",
" ",
"Version",
" ",
"2.0",
" ",
"(",
"the",
" ",
"\"",
"License",
"\");",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"you",
" ",
"may",
" ",
"not",
" ",
"use",
" ",
"this",
" ",
"file",
" ",
"except",
" ",
"in",
" ",
"compli",
"anc",
"e",
" ",
"with",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"You",
" ",
"may",
" ",
"obtain",
" ",
"a",
" ",
"copy",
" ",
"of",
" ",
"the",
" ",
"License",
" ",
"at_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"http",
"://",
"www",
".",
"apa",
"che",
".",
"org",
"/",
"license",
"s",
"/",
"LICENSE",
"-",
"2.0_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Un",
"less",
" ",
"require",
"d",
" ",
"by",
" ",
"applica",
"ble",
" ",
"law",
" ",
"or",
" ",
"agree",
"d",
" ",
"to",
" ",
"in",
" ",
"writ",
"ing",
",",
" ",
"software",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"distributed",
" ",
"under",
" ",
"the",
" ",
"License",
" ",
"is",
" ",
"distributed",
" ",
"on",
" ",
"an",
" ",
"\"",
"AS",
" ",
"IS",
"\"",
" ",
"BAS",
"IS",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"WITH",
"OUT",
" ",
"WAR",
"RAN",
"TIES",
" ",
"OR",
" ",
"CONDITION",
"S",
" ",
"OF",
" ",
"ANY",
" ",
"KIND",
",",
" ",
"eit",
"her",
" ",
"express",
" ",
"or",
" ",
"impli",
"ed",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"See",
" ",
"the",
" ",
"License",
" ",
"for",
" ",
"the",
" ",
"specific",
" ",
"language",
" ",
"govern",
"ing",
" ",
"permissi",
"ons",
" ",
"and_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"limit",
"ation",
"s",
" ",
"under",
" ",
"the",
" ",
"License",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"pyd",
"enti",
"con_",
"import_",
"Generator_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"twisted_",
"._",
"web_",
"._",
"resource_",
"import_",
"Resource_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"FORE",
"GROU",
"ND_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"4",
"5",
",",
"7",
"9",
",",
"255",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"254",
",",
"180",
",",
"4",
"4",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"226",
",",
"121",
",",
"234",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"30",
",",
"179",
",",
"253",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"232",
",",
"7",
"7",
",",
"6",
"5",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"4",
"9",
",",
"203",
",",
"115",
")\"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"rgb",
"(",
"141",
",",
"6",
"9",
",",
"170",
")\"_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"BACKGROUND",
"_",
"=_",
"\"",
"rgb",
"(",
"224",
",",
"224",
",",
"224",
")\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"SIZE_",
"=_",
"5_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | automl/RoBO/robo/models/gaussian_process.py | [
{
"content": "'''\nCreated on Oct 12, 2015\n\n@author: Aaron Klein\n'''\n\nimport logging\nimport george\nimport numpy as np\n\nfrom scipy import optimize\nfrom copy import deepcopy\n\nfrom robo.models.base_model import BaseModel\n\nlogger = logging.getLogger(__name__)\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class GaussianProcess(BaseModel):\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root.GaussianProcess",
"header": "['module', '___EOS___']",
"index": 18
},
{
"content": " def __init__(self, kernel, prior=None,\n yerr=1e-25, use_gradients=True,\n basis_func=None, dim=None, *args, **kwargs):\n \"\"\"\n Interface to the george GP library. The GP hyperparameter are obtained\n by optimizing the marginal loglikelihood.\n\n Parameters\n ----------\n kernel : george kernel object\n Specifies the kernel that is used for all Gaussian Process\n prior : prior object\n Defines a prior for the hyperparameters of the GP. Make sure that\n it implements the Prior interface.\n yerr : float\n Noise term that is added to the diagonal of the covariance matrix\n for the cholesky decomposition.\n use_gradients : bool\n Use gradient information to optimize the negative log likelihood\n \"\"\"\n\n self.kernel = kernel\n self.model = None\n self.prior = prior\n self.yerr = yerr\n self.use_gradients = use_gradients\n self.basis_func = basis_func\n self.dim = dim",
"metadata": "root.GaussianProcess.__init__",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 20
},
{
"content": " def scale(self, x, new_min, new_max, old_min, old_max):\n return ((new_max - new_min) *\n (x - old_min) / (old_max - old_min)) + new_min",
"metadata": "root.GaussianProcess.scale",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 49
},
{
"content": " def train(self, X, Y, do_optimize=True):\n \"\"\"\n Computes the cholesky decomposition of the covariance of X and\n estimates the GP hyperparameter by optimizing the marginal\n loglikelihood. The prior mean of the GP is set to the empirical\n mean of the X.\n\n Parameters\n ----------\n X: np.ndarray (N, D)\n Input data points. The dimensionality of X is (N, D),\n with N as the number of points and D is the number of features.\n Y: np.ndarray (N, 1)\n The corresponding target values.\n do_optimize: boolean\n If set to true the hyperparameters are optimized.\n \"\"\"\n self.X = X\n # For EnvES we transform s to (1 - s)^2\n if self.basis_func is not None:\n self.X = deepcopy(X)\n self.X[:, self.dim] = self.basis_func(self.X[:, self.dim])\n self.Y = Y\n\n # Use the mean of the data as mean for the GP\n self.mean = np.mean(Y, axis=0)\n self.model = george.GP(self.kernel, mean=self.mean)\n\n # Precompute the covariance\n while(True):\n try:\n self.model.compute(self.X, yerr=self.yerr)\n break\n except np.linalg.LinAlgError:\n if self.yerr == 0.0:\n self.yerr = 1e-25\n else:\n self.yerr *= 10\n logger.error(\n \"Cholesky decomposition for the covariance matrix \\\n of the GP failed. \\\n Add %s noise on the diagonal.\" %\n self.yerr)\n\n if do_optimize:\n self.hypers = self.optimize()\n logger.info(\"HYPERS: \" + str(self.hypers))\n self.model.kernel[:] = self.hypers\n else:\n self.hypers = self.model.kernel[:]",
"metadata": "root.GaussianProcess.train",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 53
},
{
"content": " def get_noise(self):\n # Assumes a kernel of the form amp * (kernel1 + noise_kernel)\n # FIXME: How to determine the noise of george gp in general?\n return self.yerr\n assert self.kernel.k2.k2.kernel_type == 1\n return self.kernel.k2.k2.pars[0]",
"metadata": "root.GaussianProcess.get_noise",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 104
},
{
"content": " def nll(self, theta):\n \"\"\"\n Returns the negative marginal log likelihood (+ the prior) for\n a hyperparameter configuration theta.\n (negative because we use scipy minimize for optimization)\n\n Parameters\n ----------\n theta : np.ndarray(H)\n Hyperparameter vector. Note that all hyperparameter are\n on a log scale.\n\n Returns\n ----------\n float\n lnlikelihood + prior\n \"\"\"\n\n # Specify bounds to keep things sane\n if np.any((-10 > theta) + (theta > 10)):\n return 1e25\n\n self.model.kernel[:] = theta\n ll = self.model.lnlikelihood(self.Y[:, 0], quiet=True)\n\n # Add prior\n if self.prior is not None:\n ll += self.prior.lnprob(theta)\n\n # We add a minus here because scipy is minimizing\n return -ll if np.isfinite(ll) else 1e25",
"metadata": "root.GaussianProcess.nll",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 111
},
{
"content": " def grad_nll(self, theta):\n self.model.kernel[:] = theta\n\n gll = self.model.grad_lnlikelihood(self.Y[:, 0], quiet=True)\n\n if self.prior is not None:\n gll += self.prior.gradient(theta)\n return -gll",
"metadata": "root.GaussianProcess.grad_nll",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 143
},
{
"content": " def optimize(self):\n # Start optimization from the previous hyperparameter configuration\n p0 = self.model.kernel.vector\n if self.use_gradients:\n results = optimize.minimize(self.nll, p0, jac=self.grad_nll)\n else:\n results = optimize.minimize(self.nll, p0)\n return results.x",
"metadata": "root.GaussianProcess.optimize",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 152
},
{
"content": " def predict_variance(self, X1, X2):\n r\"\"\"\n Predicts the variance between two test points X1, X2 by\n math: \\sigma(X_1, X_2) = k_{X_1,X_2} - k_{X_1,X} * (K_{X,X}\n + \\sigma^2*\\mathds{I})^-1 * k_{X,X_2})\n\n Parameters\n ----------\n X1: np.ndarray (N, D)\n First test point\n X2: np.ndarray (N, D)\n Second test point\n Returns\n ----------\n np.array(N,1)\n predictive variance\n\n \"\"\"\n # For EnvES we transform s to (1 - s)^2\n if self.basis_func is not None:\n X_test_1 = deepcopy(X1)\n X_test_1[:, self.dim] = self.basis_func(X_test_1[:, self.dim])\n X_test_2 = deepcopy(X2)\n X_test_2[:, self.dim] = self.basis_func(X_test_2[:, self.dim])\n else:\n X_test_1 = X1\n X_test_2 = X2\n x_ = np.concatenate((X_test_1, X_test_2))\n _, var = self.predict(x_)\n var = var[:-1, -1, np.newaxis]\n\n return var",
"metadata": "root.GaussianProcess.predict_variance",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 161
},
{
"content": " def predict(self, X, **kwargs):\n r\"\"\"\n Returns the predictive mean and variance of the objective function at\n the specified test point.\n\n Parameters\n ----------\n X: np.ndarray (N, D)\n Input test points\n\n Returns\n ----------\n np.array(N,1)\n predictive mean\n np.array(N,1)\n predictive variance\n\n \"\"\"\n # For EnvES we transform s to (1 - s)^2\n if self.basis_func is not None:\n X_test = deepcopy(X)\n X_test[:, self.dim] = self.basis_func(X_test[:, self.dim])\n else:\n X_test = X\n\n if self.model is None:\n logger.error(\"The model has to be trained first!\")\n raise ValueError\n\n mu, var = self.model.predict(self.Y[:, 0], X_test)\n\n # Clip negative variances and set them to the smallest\n # positive float values\n if var.shape[0] == 1:\n var = np.clip(var, np.finfo(var.dtype).eps, np.inf)\n else:\n var[np.diag_indices(var.shape[0])] = np.clip(\n var[np.diag_indices(var.shape[0])],\n np.finfo(var.dtype).eps, np.inf)\n var[np.where((var < np.finfo(var.dtype).eps) & (var > -np.finfo(var.dtype).eps))] = 0\n\n return mu[:, np.newaxis], var",
"metadata": "root.GaussianProcess.predict",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 194
},
{
"content": " def sample_functions(self, X_test, n_funcs=1):\n \"\"\"\n Samples F function values from the current posterior at the N\n specified test point.\n\n Parameters\n ----------\n X_test: np.ndarray (N, D)\n Input test points\n n_funcs: int\n Number of function values that are drawn at each test point.\n\n Returns\n ----------\n np.array(F,N)\n The F function values drawn at the N test points.\n \"\"\"\n\n return self.model.sample_conditional(self.Y[:, 0], X_test, n_funcs)",
"metadata": "root.GaussianProcess.sample_functions",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 237
},
{
"content": " def predictive_gradients(self, X_test):\n dmdx, dvdx = self.m.predictive_gradients(Xnew)\n return dmdx[:, 0, :], dvdx",
"metadata": "root.GaussianProcess.predictive_gradients",
"header": "['class', 'GaussianProcess', '(', 'BaseModel', ')', ':', '___EOS___']",
"index": 257
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"'''",
"\\",
"10",
";",
"Creat",
"ed",
" ",
"on",
" ",
"Oct",
" ",
"1",
"2",
",",
" ",
"201",
"5",
"\\",
"10",
";",
"\\",
"10",
";",
"@",
"author",
":",
" ",
"Aa",
"ron",
" ",
"Kl",
"ein",
"\\",
"10",
";'",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"import_",
"logging_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"geor",
"ge_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"import_",
"numpy_",
"as_",
"np_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"scipy_",
"import_",
"optimize_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"copy_",
"import_",
"deepcopy_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"robo",
"_",
"._",
"models_",
"._",
"base",
"\\u",
"model_",
"import_",
"Base",
"Model_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"logger_",
"=_",
"logging_",
"._",
"get",
"Logger_",
"(_",
"\\u\\u",
"name\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"kernel_",
",_",
"prior_",
"=_",
"None_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"yerr_",
"=_",
"1e-",
"25_",
",_",
"use",
"\\u",
"gradients_",
"=_",
"True_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"basi",
"s",
"\\u",
"func_",
"=_",
"None_",
",_",
"dim_",
"=_",
"None_",
",_",
"*_",
"args_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Interface",
" ",
"to",
" ",
"the",
" ",
"geor",
"ge",
" ",
"GP",
" ",
"librar",
"y",
".",
" ",
"The",
" ",
"GP",
" ",
"hyperparam",
"eter",
" ",
"are",
" ",
"obtain",
"ed",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"by",
" ",
"optim",
"izi",
"ng",
" ",
"the",
" ",
"marginal",
" ",
"loglik",
"eli",
"hood",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"kernel",
" ",
":",
" ",
"geor",
"ge",
" ",
"kernel",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Specifie",
"s",
" ",
"the",
" ",
"kernel",
" ",
"tha",
"t",
" ",
"is",
" ",
"used",
" ",
"for",
" ",
"all",
" ",
"Gaussian",
" ",
"Process",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"prior",
" ",
":",
" ",
"prior",
" ",
"object",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Define",
"s",
" ",
"a",
" ",
"prior",
" ",
"for",
" ",
"the",
" ",
"hyperparameters",
" ",
"of",
" ",
"the",
" ",
"GP",
".",
" ",
"Make",
" ",
"sure",
" ",
"tha",
"t",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"it",
" ",
"implement",
"s",
" ",
"the",
" ",
"Prior",
" ",
"interface",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"yer",
"r",
" ",
":",
" ",
"float",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"No",
"ise",
" ",
"term",
" ",
"tha",
"t",
" ",
"is",
" ",
"adde",
"d",
" ",
"to",
" ",
"the",
" ",
"diagonal",
" ",
"of",
" ",
"the",
" ",
"covariance",
" ",
"matrix",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"for",
" ",
"the",
" ",
"choles",
"ky",
" ",
"decomposition",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"use",
"\\u",
"gradi",
"ents",
" ",
":",
" ",
"bool",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Us",
"e",
" ",
"gradi",
"ent",
" ",
"informati",
"on",
" ",
"to",
" ",
"optimize",
" ",
"the",
" ",
"negati",
"ve",
" ",
"log",
" ",
"likelihood",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"kernel_",
"=_",
"kernel_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"model_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"prior_",
"=_",
"prior_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"yerr_",
"=_",
"yerr_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"use",
"\\u",
"gradients_",
"=_",
"use",
"\\u",
"gradients_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"=_",
"basi",
"s",
"\\u",
"func_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"dim_",
"=_",
"dim_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"scale_",
"(_",
"self_",
",_",
"x_",
",_",
"new",
"\\u",
"min_",
",_",
"new",
"\\u",
"max_",
",_",
"old",
"\\u",
"min_",
",_",
"old",
"\\u",
"max_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"(_",
"(_",
"new",
"\\u",
"max_",
"-_",
"new",
"\\u",
"min_",
")_",
"*_",
"\\u\\u\\uNL\\u\\u\\u_",
"(_",
"x_",
"-_",
"old",
"\\u",
"min_",
")_",
"/_",
"(_",
"old",
"\\u",
"max_",
"-_",
"old",
"\\u",
"min_",
")_",
")_",
"+_",
"new",
"\\u",
"min_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"train_",
"(_",
"self_",
",_",
"X_",
",_",
"Y_",
",_",
"do",
"\\u",
"optimize_",
"=_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Compute",
"s",
" ",
"the",
" ",
"choles",
"ky",
" ",
"decomposition",
" ",
"of",
" ",
"the",
" ",
"covariance",
" ",
"of",
" ",
"X",
" ",
"and",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"estimate",
"s",
" ",
"the",
" ",
"GP",
" ",
"hyperparam",
"eter",
" ",
"by",
" ",
"optim",
"izi",
"ng",
" ",
"the",
" ",
"marginal",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"loglik",
"eli",
"hood",
".",
" ",
"The",
" ",
"prior",
" ",
"mean",
" ",
"of",
" ",
"the",
" ",
"GP",
" ",
"is",
" ",
"set",
" ",
"to",
" ",
"the",
" ",
"empir",
"ical",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"mean",
" ",
"of",
" ",
"the",
" ",
"X",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"X",
":",
" ",
"np",
".",
"ndar",
"ray",
" ",
"(",
"N",
",",
" ",
"D",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Inp",
"ut",
" ",
"data",
" ",
"points",
".",
" ",
"The",
" ",
"dimensionality",
" ",
"of",
" ",
"X",
" ",
"is",
" ",
"(",
"N",
",",
" ",
"D",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"with",
" ",
"N",
" ",
"as",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"points",
" ",
"and",
" ",
"D",
" ",
"is",
" ",
"the",
" ",
"number",
" ",
"of",
" ",
"features",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Y",
":",
" ",
"np",
".",
"ndar",
"ray",
" ",
"(",
"N",
",",
" ",
"1",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"correspond",
"ing",
" ",
"target",
" ",
"values",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"do",
"\\u",
"optimize",
":",
" ",
"boolean",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"If",
" ",
"set",
" ",
"to",
" ",
"true",
" ",
"the",
" ",
"hyperparameters",
" ",
"are",
" ",
"optimize",
"d",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"X_",
"=_",
"X_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"For",
" ",
"Env",
"ES",
" ",
"we",
" ",
"transform",
" ",
"s",
" ",
"to",
" ",
"(",
"1",
" ",
"-",
" ",
"s",
")",
"^",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"X_",
"=_",
"deepcopy_",
"(_",
"X_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"X_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
"=_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"(_",
"self_",
"._",
"X_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"Y_",
"=_",
"Y_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Us",
"e",
" ",
"the",
" ",
"mean",
" ",
"of",
" ",
"the",
" ",
"data",
" ",
"as",
" ",
"mean",
" ",
"for",
" ",
"the",
" ",
"GP",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"mean_",
"=_",
"np_",
"._",
"mean_",
"(_",
"Y_",
",_",
"axis_",
"=_",
"0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"model_",
"=_",
"geor",
"ge_",
"._",
"GP",
"_",
"(_",
"self_",
"._",
"kernel_",
",_",
"mean_",
"=_",
"self_",
"._",
"mean_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Prec",
"omp",
"ute",
" ",
"the",
" ",
"covariance_",
"\\u\\u\\uNL\\u\\u\\u_",
"while_",
"(_",
"True_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"model_",
"._",
"compute_",
"(_",
"self_",
"._",
"X_",
",_",
"yerr_",
"=_",
"self_",
"._",
"yerr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"break_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"np_",
"._",
"linalg_",
"._",
"Lin",
"Alg",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"self_",
"._",
"yerr_",
"==_",
"0.0_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"yerr_",
"=_",
"1e-",
"25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"self_",
"._",
"yerr_",
"*=_",
"10_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"logger_",
"._",
"error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"Cho",
"les",
"ky",
" ",
"decomposition",
" ",
"for",
" ",
"the",
" ",
"covariance",
" ",
"matrix",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
"of",
" ",
"the",
" ",
"GP",
" ",
"fail",
"ed",
".",
" ",
"\\\\",
"\\",
"10",
";",
" ",
" ",
"Add",
" ",
"%",
"s",
" ",
"noise",
" ",
"on",
" ",
"the",
" ",
"diagonal",
".\"_",
"%_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"yerr_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"do",
"\\u",
"optimize_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"hypers",
"_",
"=_",
"self_",
"._",
"optimize_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"logger_",
"._",
"info_",
"(_",
"\"",
"HYP",
"ERS",
":",
" ",
"\"_",
"+_",
"str_",
"(_",
"self_",
"._",
"hypers",
"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"model_",
"._",
"kernel_",
"[_",
":_",
"]_",
"=_",
"self_",
"._",
"hypers",
"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"hypers",
"_",
"=_",
"self_",
"._",
"model_",
"._",
"kernel_",
"[_",
":_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"get",
"\\u",
"noise_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Assume",
"s",
" ",
"a",
" ",
"kernel",
" ",
"of",
" ",
"the",
" ",
"form",
" ",
"amp",
" ",
"*",
" ",
"(",
"kernel",
"1",
" ",
"+",
" ",
"noise",
"\\u",
"kernel",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"FIX",
"ME",
":",
" ",
"Ho",
"w",
" ",
"to",
" ",
"dete",
"rmin",
"e",
" ",
"the",
" ",
"noise",
" ",
"of",
" ",
"geor",
"ge",
" ",
"gp",
" ",
"in",
" ",
"genera",
"l",
"?",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"yerr_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"assert_",
"self_",
"._",
"kernel_",
"._",
"k2_",
"._",
"k2_",
"._",
"kernel",
"\\u",
"type_",
"==_",
"1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"self_",
"._",
"kernel_",
"._",
"k2_",
"._",
"k2_",
"._",
"pars_",
"[_",
"0_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"nl",
"l_",
"(_",
"self_",
",_",
"theta_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"negati",
"ve",
" ",
"marginal",
" ",
"log",
" ",
"likelihood",
" ",
"(",
"+",
" ",
"the",
" ",
"prior",
")",
" ",
"for",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"a",
" ",
"hyperparam",
"eter",
" ",
"configura",
"tion",
" ",
"theta",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(",
"negati",
"ve",
" ",
"bec",
"aus",
"e",
" ",
"we",
" ",
"use",
" ",
"sci",
"py",
" ",
"minimize",
" ",
"for",
" ",
"optimization",
")",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"theta",
" ",
":",
" ",
"np",
".",
"ndar",
"ray",
"(",
"H",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Hyper",
"parameter",
" ",
"vector",
".",
" ",
"Not",
"e",
" ",
"tha",
"t",
" ",
"all",
" ",
"hyperparam",
"eter",
" ",
"are",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"on",
" ",
"a",
" ",
"log",
" ",
"scale",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"float",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"ln",
"likelihood",
" ",
"+",
" ",
"prior",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Speci",
"fy",
" ",
"bound",
"s",
" ",
"to",
" ",
"keep",
" ",
"thing",
"s",
" ",
"sane",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"np_",
"._",
"any_",
"(_",
"(_",
"-_",
"10_",
">_",
"theta_",
")_",
"+_",
"(_",
"theta_",
">_",
"10_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"1e",
"25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"model_",
"._",
"kernel_",
"[_",
":_",
"]_",
"=_",
"theta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"ll_",
"=_",
"self_",
"._",
"model_",
"._",
"ln",
"likelihood_",
"(_",
"self_",
"._",
"Y_",
"[_",
":_",
",_",
"0_",
"]_",
",_",
"quiet_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"prior_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"prior_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"ll_",
"+=_",
"self_",
"._",
"prior_",
"._",
"lnp",
"rob",
"_",
"(_",
"theta_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"We",
" ",
"add",
" ",
"a",
" ",
"minu",
"s",
" ",
"here",
" ",
"bec",
"aus",
"e",
" ",
"sci",
"py",
" ",
"is",
" ",
"minim",
"izi",
"ng_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"-_",
"ll_",
"if_",
"np_",
"._",
"isfinite_",
"(_",
"ll_",
")_",
"else_",
"1e",
"25_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"grad",
"\\u",
"nl",
"l_",
"(_",
"self_",
",_",
"theta_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"model_",
"._",
"kernel_",
"[_",
":_",
"]_",
"=_",
"theta_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"gl",
"l_",
"=_",
"self_",
"._",
"model_",
"._",
"grad",
"\\u",
"ln",
"likelihood_",
"(_",
"self_",
"._",
"Y_",
"[_",
":_",
",_",
"0_",
"]_",
",_",
"quiet_",
"=_",
"True_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"prior_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"gl",
"l_",
"+=_",
"self_",
"._",
"prior_",
"._",
"gradient_",
"(_",
"theta_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"-_",
"gl",
"l_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"optimize_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Start",
" ",
"optimization",
" ",
" ",
"from",
" ",
"the",
" ",
"previ",
"ous",
" ",
"hyperparam",
"eter",
" ",
"configuration_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"p0_",
"=_",
"self_",
"._",
"model_",
"._",
"kernel_",
"._",
"vector_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"self_",
"._",
"use",
"\\u",
"gradients_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"results_",
"=_",
"optimize_",
"._",
"minimize_",
"(_",
"self_",
"._",
"nl",
"l_",
",_",
"p0_",
",_",
"jac_",
"=_",
"self_",
"._",
"grad",
"\\u",
"nl",
"l_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"results_",
"=_",
"optimize_",
"._",
"minimize_",
"(_",
"self_",
"._",
"nl",
"l_",
",_",
"p0_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"results_",
"._",
"x_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"predi",
"ct",
"\\u",
"variance_",
"(_",
"self_",
",_",
"X1_",
",_",
"X2_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Predic",
"ts",
" ",
"the",
" ",
"varian",
"ce",
" ",
"bet",
"ween",
" ",
"two",
" ",
"test",
" ",
"points",
" ",
"X1",
",",
" ",
"X",
"2",
" ",
"by",
"\\",
"10",
";",
" ",
" ",
" ",
"math",
":",
" ",
"\\\\",
"sigma",
"(",
"X",
"\\u",
"1",
",",
" ",
"X",
"\\u",
"2",
")",
" ",
"=",
" ",
"k",
"\\u{",
"X",
"\\u",
"1",
",",
"X",
"\\u",
"2",
"}",
" ",
"-",
" ",
"k",
"\\u{",
"X",
"\\u",
"1",
",",
"X",
"}",
" ",
"*",
" ",
"(",
"K",
"\\u{",
"X",
",",
"X",
"}",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
" ",
"+",
" ",
"\\\\",
"sigma",
"^",
"2",
"*\\\\",
"math",
"ds",
"{",
"I",
"})",
"^",
"-1",
" ",
"*",
" ",
"k",
"\\u{",
"X",
",",
"X",
"\\u",
"2",
"})",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"X1",
":",
" ",
"np",
".",
"ndar",
"ray",
" ",
"(",
"N",
",",
" ",
"D",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Fi",
"rst",
" ",
"test",
" ",
"point",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"X",
"2",
":",
" ",
"np",
".",
"ndar",
"ray",
" ",
"(",
"N",
",",
" ",
"D",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Second",
" ",
"test",
" ",
"point",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"np",
".",
"array",
"(",
"N",
",",
"1",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"predicti",
"ve",
" ",
"varian",
"ce",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"For",
" ",
"Env",
"ES",
" ",
"we",
" ",
"transform",
" ",
"s",
" ",
"to",
" ",
"(",
"1",
" ",
"-",
" ",
"s",
")",
"^",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"X",
"\\u",
"test\\u",
"1_",
"=_",
"deepcopy_",
"(_",
"X1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X",
"\\u",
"test\\u",
"1_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
"=_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"(_",
"X",
"\\u",
"test\\u",
"1_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X",
"\\u",
"test\\u",
"2_",
"=_",
"deepcopy_",
"(_",
"X2_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X",
"\\u",
"test\\u",
"2_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
"=_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"(_",
"X",
"\\u",
"test\\u",
"2_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"X",
"\\u",
"test\\u",
"1_",
"=_",
"X1_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X",
"\\u",
"test\\u",
"2_",
"=_",
"X2_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"x\\u_",
"=_",
"np_",
"._",
"concatenate_",
"(_",
"(_",
"X",
"\\u",
"test\\u",
"1_",
",_",
"X",
"\\u",
"test\\u",
"2_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u_",
",_",
"var_",
"=_",
"self_",
"._",
"predict_",
"(_",
"x\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"var_",
"=_",
"var_",
"[_",
":_",
"-_",
"1_",
",_",
"-_",
"1_",
",_",
"np_",
"._",
"newaxis_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"var_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"predict_",
"(_",
"self_",
",_",
"X_",
",_",
"**_",
"kwargs_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
" ",
"the",
" ",
"predicti",
"ve",
" ",
"mean",
" ",
"and",
" ",
"varian",
"ce",
" ",
"of",
" ",
"the",
" ",
"objecti",
"ve",
" ",
"function",
" ",
"at",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"specified",
" ",
"test",
" ",
"point",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"X",
":",
" ",
"np",
".",
"ndar",
"ray",
" ",
"(",
"N",
",",
" ",
"D",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Inp",
"ut",
" ",
"test",
" ",
"points",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"np",
".",
"array",
"(",
"N",
",",
"1",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"predicti",
"ve",
" ",
"mean",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"np",
".",
"array",
"(",
"N",
",",
"1",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"predicti",
"ve",
" ",
"varian",
"ce",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"For",
" ",
"Env",
"ES",
" ",
"we",
" ",
"transform",
" ",
"s",
" ",
"to",
" ",
"(",
"1",
" ",
"-",
" ",
"s",
")",
"^",
"2_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"X",
"\\u",
"test_",
"=_",
"deepcopy_",
"(_",
"X_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"X",
"\\u",
"test_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
"=_",
"self_",
"._",
"basi",
"s",
"\\u",
"func_",
"(_",
"X",
"\\u",
"test_",
"[_",
":_",
",_",
"self_",
"._",
"dim_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"X",
"\\u",
"test_",
"=_",
"X_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"model_",
"is_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"logger_",
"._",
"error_",
"(_",
"\"",
"The",
" ",
"model",
" ",
"has",
" ",
"to",
" ",
"be",
" ",
"trained",
" ",
"first",
"!\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"raise_",
"Value",
"Error_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"mu_",
",_",
"var_",
"=_",
"self_",
"._",
"model_",
"._",
"predict_",
"(_",
"self_",
"._",
"Y_",
"[_",
":_",
",_",
"0_",
"]_",
",_",
"X",
"\\u",
"test_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Clip",
" ",
"negati",
"ve",
" ",
"varian",
"ces",
" ",
"and",
" ",
"set",
" ",
"them",
" ",
"to",
" ",
"the",
" ",
"smallest",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"posit",
"ive",
" ",
"float",
" ",
"values_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"var_",
"._",
"shape_",
"[_",
"0_",
"]_",
"==_",
"1_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"var_",
"=_",
"np_",
"._",
"clip_",
"(_",
"var_",
",_",
"np_",
"._",
"finfo",
"_",
"(_",
"var_",
"._",
"dtype_",
")_",
"._",
"eps_",
",_",
"np_",
"._",
"inf_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"var_",
"[_",
"np_",
"._",
"diag",
"\\u",
"indices_",
"(_",
"var_",
"._",
"shape_",
"[_",
"0_",
"]_",
")_",
"]_",
"=_",
"np_",
"._",
"clip_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"var_",
"[_",
"np_",
"._",
"diag",
"\\u",
"indices_",
"(_",
"var_",
"._",
"shape_",
"[_",
"0_",
"]_",
")_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"np_",
"._",
"finfo",
"_",
"(_",
"var_",
"._",
"dtype_",
")_",
"._",
"eps_",
",_",
"np_",
"._",
"inf_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"var_",
"[_",
"np_",
"._",
"where_",
"(_",
"(_",
"var_",
"<_",
"np_",
"._",
"finfo",
"_",
"(_",
"var_",
"._",
"dtype_",
")_",
"._",
"eps_",
")_",
"&_",
"(_",
"var_",
">_",
"-_",
"np_",
"._",
"finfo",
"_",
"(_",
"var_",
"._",
"dtype_",
")_",
"._",
"eps_",
")_",
")_",
"]_",
"=_",
"0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"mu_",
"[_",
":_",
",_",
"np_",
"._",
"newaxis_",
"]_",
",_",
"var_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"sample",
"\\u",
"functions_",
"(_",
"self_",
",_",
"X",
"\\u",
"test_",
",_",
"n",
"\\u",
"funcs_",
"=_",
"1_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Sampl",
"es",
" ",
"F",
" ",
"function",
" ",
"values",
" ",
"from",
" ",
"the",
" ",
"current",
" ",
"posterior",
" ",
"at",
" ",
"the",
" ",
"N",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"specified",
" ",
"test",
" ",
"point",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Parameter",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"X",
"\\u",
"test",
":",
" ",
"np",
".",
"ndar",
"ray",
" ",
"(",
"N",
",",
" ",
"D",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Inp",
"ut",
" ",
"test",
" ",
"points",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"n",
"\\u",
"funcs",
":",
" ",
"int",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Number",
" ",
"of",
" ",
"function",
" ",
"values",
" ",
"tha",
"t",
" ",
"are",
" ",
"draw",
"n",
" ",
"at",
" ",
"each",
" ",
"test",
" ",
"point",
".",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Return",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"----------",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"np",
".",
"array",
"(",
"F",
",",
"N",
")",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"The",
" ",
"F",
" ",
"function",
" ",
"values",
" ",
"draw",
"n",
" ",
"at",
" ",
"the",
" ",
"N",
" ",
"test",
" ",
"points",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"self_",
"._",
"model_",
"._",
"sample",
"\\u",
"conditional",
"_",
"(_",
"self_",
"._",
"Y_",
"[_",
":_",
",_",
"0_",
"]_",
",_",
"X",
"\\u",
"test_",
",_",
"n",
"\\u",
"funcs_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Gaussian",
"Process_",
"(_",
"Base",
"Model_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"predicti",
"ve",
"\\u",
"gradients_",
"(_",
"self_",
",_",
"X",
"\\u",
"test_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"dmd",
"x_",
",_",
"dvd",
"x_",
"=_",
"self_",
"._",
"m_",
"._",
"predicti",
"ve",
"\\u",
"gradients_",
"(_",
"Xn",
"ew_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"dmd",
"x_",
"[_",
":_",
",_",
"0_",
",_",
":_",
"]_",
",_",
"dvd",
"x_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | linkyndy/remodel/tests/__init__.py | [
{
"content": " def tearDown(self):\n model_registry.clear()\n index_registry.clear()",
"metadata": "root.BaseTestCase.tearDown",
"header": "['class', 'BaseTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']",
"index": 27
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Base",
"Test",
"Case_",
"(_",
"unittest_",
"._",
"Test",
"Case_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"tear",
"Down_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"model",
"\\u",
"registry_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"index",
"\\u",
"registry_",
"._",
"clear_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | OP2/PyOP2/pyop2/fusion.py | [
{
"content": " def _tile(self):\n \"\"\"Tile consecutive loops over different iteration sets characterized\n by RAW and WAR dependencies. This requires interfacing with the SLOPE\n library.\"\"\"\n try:\n backend_map = {'sequential': 'SEQUENTIAL', 'openmp': 'OMP'}\n slope_backend = backend_map[configuration['backend']]\n slope.set_exec_mode(slope_backend)\n log_info(\"SLOPE backend set to %s\" % slope_backend)\n except KeyError:\n warning(\"Unable to set backend %s for SLOPE\" % configuration['backend'])\n\n inspector = slope.Inspector()\n\n # Build arguments types and values\n arguments = []\n insp_sets, insp_maps, insp_loops = set(), {}, []\n for loop in self._loop_chain:\n slope_desc = set()\n # Add sets\n insp_sets.add((loop.it_space.name, loop.it_space.core_size))\n for a in loop.args:\n maps = as_tuple(a.map, Map)\n # Add maps (there can be more than one per argument if the arg\n # is actually a Mat - in which case there are two maps - or if\n # a MixedMap) and relative descriptors\n if not maps:\n slope_desc.add(('DIRECT', a.access._mode))\n continue\n for i, map in enumerate(maps):\n for j, m in enumerate(map):\n map_name = \"%s%d_%d\" % (m.name, i, j)\n insp_maps[m.name] = (map_name, m.iterset.name,\n m.toset.name, m.values)\n slope_desc.add((map_name, a.access._mode))\n # Add loop\n insp_loops.append((loop.kernel.name, loop.it_space.name, list(slope_desc)))\n # Provide structure of loop chain to the SLOPE's inspector\n arguments.extend([inspector.add_sets(insp_sets)])\n arguments.extend([inspector.add_maps(insp_maps.values())])\n inspector.add_loops(insp_loops)\n # Get type and value of any additional arguments that the SLOPE's inspector\n # expects\n arguments.extend([inspector.set_external_dats()])\n\n # Set a specific tile size\n arguments.extend([inspector.set_tile_size(self._tile_size)])\n\n # Arguments types and values\n argtypes, argvalues = zip(*arguments)\n\n # Generate inspector C code\n src = inspector.generate_code()\n\n # Return type of the inspector\n rettype = slope.Executor.meta['py_ctype_exec']\n\n # Compiler and linker options\n slope_dir = os.environ['SLOPE_DIR']\n compiler = coffee.plan.compiler.get('name')\n cppargs = slope.get_compile_opts(compiler)\n cppargs += ['-I%s/%s' % (slope_dir, slope.get_include_dir())]\n ldargs = ['-L%s/%s' % (slope_dir, slope.get_lib_dir()),\n '-l%s' % slope.get_lib_name()]\n\n # Compile and run inspector\n fun = compilation.load(src, \"cpp\", \"inspector\", cppargs, ldargs,\n argtypes, rettype, compiler)\n inspection = fun(*argvalues)\n\n # Finally, get the Executor representation, to be used at executor\n # code generation time\n executor = slope.Executor(inspector)\n\n self._schedule = TilingSchedule(self._schedule, inspection, executor)",
"metadata": "root.Inspector._tile",
"header": "['class', 'Inspector', '(', 'Cached', ')', ':', '___EOS___']",
"index": 1073
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Inspector",
"_",
"(_",
"Cache",
"d_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"tile_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Til",
"e",
" ",
"consec",
"uti",
"ve",
" ",
"loop",
"s",
" ",
"over",
" ",
"different",
" ",
"iterati",
"on",
" ",
"sets",
" ",
"character",
"ize",
"d",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"by",
" ",
"RA",
"W",
" ",
"and",
" ",
"WAR",
" ",
"dependen",
"cies",
".",
" ",
"Thi",
"s",
" ",
"require",
"s",
" ",
"interf",
"acing",
" ",
"with",
" ",
"the",
" ",
"SLO",
"PE",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"librar",
"y",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"back",
"end",
"\\u",
"map_",
"=_",
"{_",
"'",
"sequential",
"'_",
":_",
"'",
"SEQ",
"UE",
"NTI",
"AL",
"'_",
",_",
"'",
"openm",
"p",
"'_",
":_",
"'",
"OMP",
"'_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slope",
"\\u",
"backend_",
"=_",
"back",
"end",
"\\u",
"map_",
"[_",
"configuration_",
"[_",
"'",
"back",
"end",
"'_",
"]_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slope_",
"._",
"set\\u",
"exec",
"\\u",
"mode_",
"(_",
"slope",
"\\u",
"backend_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"log",
"\\u",
"info_",
"(_",
"\"",
"SLO",
"PE",
" ",
"back",
"end",
" ",
"set",
" ",
"to",
" ",
"%",
"s",
"\"_",
"%_",
"slope",
"\\u",
"backend_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Key",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"warning_",
"(_",
"\"",
"Una",
"ble",
" ",
"to",
" ",
"set",
" ",
"back",
"end",
" ",
"%",
"s",
" ",
"for",
" ",
"SLO",
"PE",
"\"_",
"%_",
"configuration_",
"[_",
"'",
"back",
"end",
"'_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"inspector_",
"=_",
"slope_",
"._",
"Inspector",
"_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Build",
" ",
"argu",
"ment",
"s",
" ",
"types",
" ",
"and",
" ",
"values_",
"\\u\\u\\uNL\\u\\u\\u_",
"arguments_",
"=_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"insp",
"\\u",
"sets_",
",_",
"insp",
"\\u",
"maps_",
",_",
"insp",
"\\u",
"loops_",
"=_",
"set_",
"(_",
")_",
",_",
"{_",
"}_",
",_",
"[_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"loop_",
"in_",
"self_",
"._",
"\\u",
"loop",
"\\u",
"chain_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"slope",
"\\u",
"desc_",
"=_",
"set_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"sets_",
"\\u\\u\\uNL\\u\\u\\u_",
"insp",
"\\u",
"sets_",
"._",
"add_",
"(_",
"(_",
"loop_",
"._",
"it",
"\\u",
"space_",
"._",
"name_",
",_",
"loop_",
"._",
"it",
"\\u",
"space_",
"._",
"core",
"\\u",
"size_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"a_",
"in_",
"loop_",
"._",
"args_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"maps_",
"=_",
"as",
"\\u",
"tuple_",
"(_",
"a_",
"._",
"map_",
",_",
"Map_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"maps",
" ",
"(",
"there",
" ",
"can",
" ",
"be",
" ",
"more",
" ",
"than",
" ",
"one",
" ",
"per",
" ",
"argu",
"ment",
" ",
"if",
" ",
"the",
" ",
"arg_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"is",
" ",
"actual",
"ly",
" ",
"a",
" ",
"Mat",
" ",
"-",
" ",
"in",
" ",
"whi",
"ch",
" ",
"case",
" ",
"there",
" ",
"are",
" ",
"two",
" ",
"maps",
" ",
"-",
" ",
"or",
" ",
"if_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"a",
" ",
"Mix",
"ed",
"Map",
")",
" ",
"and",
" ",
"relative",
" ",
"descriptors_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"maps_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"slope",
"\\u",
"desc_",
"._",
"add_",
"(_",
"(_",
"'",
"DIRECT",
"'_",
",_",
"a_",
"._",
"access_",
"._",
"\\u",
"mode_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"continue_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"for_",
"i_",
",_",
"map_",
"in_",
"enumerate_",
"(_",
"maps_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"for_",
"j_",
",_",
"m_",
"in_",
"enumerate_",
"(_",
"map_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
" _",
"map",
"\\u",
"name_",
"=_",
"\"%",
"s",
"%",
"d\\u",
"%",
"d",
"\"_",
"%_",
"(_",
"m_",
"._",
"name_",
",_",
"i_",
",_",
"j_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"insp",
"\\u",
"maps_",
"[_",
"m_",
"._",
"name_",
"]_",
"=_",
"(_",
"map",
"\\u",
"name_",
",_",
"m_",
"._",
"iters",
"et_",
"._",
"name_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"m_",
"._",
"tos",
"et_",
"._",
"name_",
",_",
"m_",
"._",
"values_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"slope",
"\\u",
"desc_",
"._",
"add_",
"(_",
"(_",
"map",
"\\u",
"name_",
",_",
"a_",
"._",
"access_",
"._",
"\\u",
"mode_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Add",
" ",
"loop_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"insp",
"\\u",
"loops_",
"._",
"append_",
"(_",
"(_",
"loop_",
"._",
"kernel_",
"._",
"name_",
",_",
"loop_",
"._",
"it",
"\\u",
"space_",
"._",
"name_",
",_",
"list_",
"(_",
"slope",
"\\u",
"desc_",
")_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Prov",
"ide",
" ",
"structure",
" ",
"of",
" ",
"loop",
" ",
"chain",
" ",
"to",
" ",
"the",
" ",
"SLO",
"PE",
"'",
"s",
" ",
"inspector_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"arguments_",
"._",
"extend_",
"(_",
"[_",
"inspector_",
"._",
"add",
"\\u",
"sets_",
"(_",
"insp",
"\\u",
"sets_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"arguments_",
"._",
"extend_",
"(_",
"[_",
"inspector_",
"._",
"add",
"\\u",
"maps_",
"(_",
"insp",
"\\u",
"maps_",
"._",
"values_",
"(_",
")_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"inspector_",
"._",
"add",
"\\u",
"loops_",
"(_",
"insp",
"\\u",
"loops_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#",
" ",
"Get",
" ",
"type",
" ",
"and",
" ",
"value",
" ",
"of",
" ",
"any",
" ",
"addition",
"al",
" ",
"argu",
"ment",
"s",
" ",
"tha",
"t",
" ",
"the",
" ",
"SLO",
"PE",
"'",
"s",
" ",
"inspector_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"expect",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"arguments_",
"._",
"extend_",
"(_",
"[_",
"inspector_",
"._",
"set\\u",
"external",
"\\u",
"dat",
"s_",
"(_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Set",
" ",
"a",
" ",
"specific",
" ",
"tile",
" ",
"size_",
"\\u\\u\\uNL\\u\\u\\u_",
"arguments_",
"._",
"extend_",
"(_",
"[_",
"inspector_",
"._",
"set\\u",
"tile",
"\\u",
"size_",
"(_",
"self_",
"._",
"\\u",
"tile",
"\\u",
"size_",
")_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Arg",
"ument",
"s",
" ",
"types",
" ",
"and",
" ",
"values_",
"\\u\\u\\uNL\\u\\u\\u_",
"argtypes_",
",_",
"argv",
"alues",
"_",
"=_",
"zip_",
"(_",
"*_",
"arguments_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Generate",
" ",
"inspector",
" ",
"C",
" ",
"code_",
"\\u\\u\\uNL\\u\\u\\u_",
"src_",
"=_",
"inspector_",
"._",
"generat",
"e\\u",
"code_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Return",
" ",
"type",
" ",
"of",
" ",
"the",
" ",
"inspector_",
"\\u\\u\\uNL\\u\\u\\u_",
"rett",
"ype_",
"=_",
"slope_",
"._",
"Executor_",
"._",
"meta_",
"[_",
"'",
"py",
"\\u",
"ctype",
"\\u",
"exec",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Compil",
"er",
" ",
"and",
" ",
"linker",
" ",
"options_",
"\\u\\u\\uNL\\u\\u\\u_",
"slope",
"\\u",
"dir_",
"=_",
"os_",
"._",
"environ_",
"[_",
"'",
"SLO",
"PE",
"\\u",
"DIR",
"'_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"compiler_",
"=_",
"cof",
"fee_",
"._",
"plan_",
"._",
"compiler_",
"._",
"get_",
"(_",
"'",
"name",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cpp",
"args_",
"=_",
"slope_",
"._",
"get",
"\\u",
"compile",
"\\u",
"opts_",
"(_",
"compiler_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"cpp",
"args_",
"+=_",
"[_",
"'-",
"I",
"%",
"s",
"/",
"%",
"s",
"'_",
"%_",
"(_",
"slope",
"\\u",
"dir_",
",_",
"slope_",
"._",
"get",
"\\u",
"include",
"\\u",
"dir_",
"(_",
")_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"lda",
"rgs_",
"=_",
"[_",
"'-",
"L",
"%",
"s",
"/",
"%",
"s",
"'_",
"%_",
"(_",
"slope",
"\\u",
"dir_",
",_",
"slope_",
"._",
"get",
"\\u",
"lib",
"\\u",
"dir_",
"(_",
")_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"l",
"%",
"s",
"'_",
"%_",
"slope_",
"._",
"get",
"\\u",
"lib",
"\\u",
"name_",
"(_",
")_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Compil",
"e",
" ",
"and",
" ",
"run",
" ",
"inspector_",
"\\u\\u\\uNL\\u\\u\\u_",
"fun_",
"=_",
"compilation",
"_",
"._",
"load_",
"(_",
"src_",
",_",
"\"",
"cpp",
"\"_",
",_",
"\"",
"inspector",
"\"_",
",_",
"cpp",
"args_",
",_",
"lda",
"rgs_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"argtypes_",
",_",
"rett",
"ype_",
",_",
"compiler_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"inspection",
"_",
"=_",
"fun_",
"(_",
"*_",
"argv",
"alues",
"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"Final",
"ly",
",",
" ",
"get",
" ",
"the",
" ",
"Execut",
"or",
" ",
"represent",
"ation",
",",
" ",
"to",
" ",
"be",
" ",
"used",
" ",
"at",
" ",
"executor_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
"code",
" ",
"generat",
"ion",
" ",
"time_",
"\\u\\u\\uNL\\u\\u\\u_",
"executor_",
"=_",
"slope_",
"._",
"Executor_",
"(_",
"inspector_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"\\u",
"schedule_",
"=_",
"Til",
"ing",
"Schedule_",
"(_",
"self_",
"._",
"\\u",
"schedule_",
",_",
"inspection",
"_",
",_",
"executor_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
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|
Variable defined multiple times | celery/kombu/examples/simple_eventlet_send.py | [
{
"content": "def send_many(n):\n\n #: Create connection\n #: If hostname, userid, password and virtual_host is not specified\n #: the values below are the default, but listed here so it can\n #: be easily changed.\n with Connection('amqp://guest:guest@localhost:5672//') as connection:\n\n #: SimpleQueue mimics the interface of the Python Queue module.\n #: First argument can either be a queue name or a kombu.Queue object.\n #: If a name, then the queue will be declared with the name as the\n #: queue name, exchange name and routing key.\n with connection.SimpleQueue('kombu_demo') as queue:\n\n def send_message(i):\n queue.put({'hello': 'world%s' % (i,)})\n\n pool = eventlet.GreenPool(10)\n for i in range(n):\n pool.spawn(send_message, i)\n pool.waitall()",
"metadata": "root.send_many",
"header": "['module', '___EOS___']",
"index": 17
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"send",
"\\u",
"many_",
"(_",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Creat",
"e",
" ",
"connection_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"If",
" ",
"host",
"name",
",",
" ",
"user",
"id",
",",
" ",
"password",
" ",
"and",
" ",
"virtual",
"\\u",
"host",
" ",
"is",
" ",
"not",
" ",
"specified",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"the",
" ",
"values",
" ",
"belo",
"w",
" ",
"are",
" ",
"the",
" ",
"default",
",",
" ",
"but",
" ",
"liste",
"d",
" ",
"here",
" ",
"so",
" ",
"it",
" ",
"can_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"be",
" ",
"easi",
"ly",
" ",
"change",
"d",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"Connection_",
"(_",
"'",
"amqp",
"://",
"guest",
":",
"guest",
"@",
"local",
"host",
":",
"567",
"2",
"//",
"'_",
")_",
"as_",
"connection_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Simple",
"Queue",
" ",
"mimic",
"s",
" ",
"the",
" ",
"interface",
" ",
"of",
" ",
"the",
" ",
"Pyth",
"on",
" ",
"Queue",
" ",
"module",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"Fi",
"rst",
" ",
"argu",
"ment",
" ",
"can",
" ",
"eit",
"her",
" ",
"be",
" ",
"a",
" ",
"queue",
" ",
"name",
" ",
"or",
" ",
"a",
" ",
"kom",
"bu",
".",
"Queue",
" ",
"object",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"If",
" ",
"a",
" ",
"name",
",",
" ",
"then",
" ",
"the",
" ",
"queue",
" ",
"will",
" ",
"be",
" ",
"declared",
" ",
"with",
" ",
"the",
" ",
"name",
" ",
"as",
" ",
"the_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
":",
" ",
"queue",
" ",
"name",
",",
" ",
"exchange",
" ",
"name",
" ",
"and",
" ",
"routin",
"g",
" ",
"key",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"with_",
"connection_",
"._",
"Simple",
"Queue_",
"(_",
"'",
"kom",
"bu",
"\\u",
"demo",
"'_",
")_",
"as_",
"queue_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"send",
"\\u",
"message_",
"(_",
"i_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"queue_",
"._",
"put_",
"(_",
"{_",
"'",
"hell",
"o",
"'_",
":_",
"'",
"world",
"%",
"s",
"'_",
"%_",
"(_",
"i_",
",_",
")_",
"}_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"pool_",
"=_",
"eventlet_",
"._",
"Green",
"Pool_",
"(_",
"10_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"for_",
"i_",
"in_",
"range_",
"(_",
"n_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pool_",
"._",
"spawn_",
"(_",
"send",
"\\u",
"message_",
",_",
"i_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"pool_",
"._",
"wait",
"all_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Comparison of constants | dropbox/hermes/hermes/handlers/api.py | [
{
"content": " def post(self):\n \"\"\"\n Pass through post to the external query handler\n \"\"\"\n\n json_data = json.loads(self.request.body)\n response = PluginHelper.request_post(json_body=json_data)\n if (\n response.status_code == 200\n and response.json()[\"status\"] == \"ok\"\n ):\n result_json = {\n \"results\": response.json()[\"results\"],\n }\n else:\n raise exc.BadRequest(\"Bad host query: {}\".format(\n self.request.body\n ))\n\n self.success(result_json)",
"metadata": "root.ExtQueryHandler.post",
"header": "['class', 'ExtQueryHandler', '(', 'ApiHandler', ')', ':', '___EOS___']",
"index": 2564
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Compari",
"son_",
"of_",
"constants_",
"[SEP]_",
"class_",
"Ext",
"Query",
"Handler_",
"(_",
"Ap",
"i",
"Handler_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"post_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Pass",
" ",
"through",
" ",
"post",
" ",
"to",
" ",
"the",
" ",
"external",
" ",
"query",
" ",
"handler",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"json",
"\\u",
"data_",
"=_",
"json_",
"._",
"loads_",
"(_",
"self_",
"._",
"request_",
"._",
"body_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"response_",
"=_",
"Plug",
"in",
"Helper_",
"._",
"request",
"\\u",
"post_",
"(_",
"json",
"\\u",
"body_",
"=_",
"json",
"\\u",
"data_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"response_",
"._",
"status",
"\\u",
"code_",
"==_",
"200_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"response_",
"._",
"json_",
"(_",
")_",
"[_",
"\"",
"status",
"\"_",
"]_",
"==_",
"\"",
"ok",
"\"_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"result",
"\\u",
"json_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"",
"results",
"\"_",
":_",
"response_",
"._",
"json_",
"(_",
")_",
"[_",
"\"",
"results",
"\"_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"exc_",
"._",
"Ba",
"d",
"Request_",
"(_",
"\"",
"Ba",
"d",
" ",
"host",
" ",
"query",
":",
" ",
"{}\"_",
"._",
"format_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"self_",
"._",
"request_",
"._",
"body_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"success_",
"(_",
"result",
"\\u",
"json_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
First parameter of a method is not named 'self' | lifted-studios/AutoCopyright/UpdateCopyrightCommand.py | [
{
"content": " def __replace_match(self, region, oldYear, newYear):\n \"\"\"Replace the old copyright text with the new copyright text.\"\"\"\n owner = self.patterns[self.matched_pattern]\n fileName = self.get_fileName();\n message = self.format_text(oldYear + \"-\" + newYear, owner, fileName)\n self.view.replace(self.edit, region, message)\n self.edit = None",
"metadata": "root.UpdateCopyrightCommand.__replace_match",
"header": "['class', 'UpdateCopyrightCommand', '(', 'CopyrightCommand', ')', ':', '___EOS___']",
"index": 104
}
] | [] | [] | 0 | true | [
"[CLS]_",
"First_",
"parameter_",
"of_",
"a_",
"method_",
"is_",
"not_",
"named_",
"'",
"self",
"'_",
"[SEP]_",
"class_",
"Update",
"Copy",
"right",
"Command_",
"(_",
"Copy",
"right",
"Command_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"replace",
"\\u",
"match_",
"(_",
"self_",
",_",
"region_",
",_",
"old",
"Year_",
",_",
"new",
"Year_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"Replace",
" ",
"the",
" ",
"old",
" ",
"copyr",
"ight",
" ",
"text",
" ",
"with",
" ",
"the",
" ",
"new",
" ",
"copyr",
"ight",
" ",
"text",
".\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"owner_",
"=_",
"self_",
"._",
"patterns_",
"[_",
"self_",
"._",
"matche",
"d\\u",
"pattern_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"file",
"Name_",
"=_",
"self_",
"._",
"get",
"\\u",
"file",
"Name_",
"(_",
")_",
";_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"message_",
"=_",
"self_",
"._",
"format\\u",
"text_",
"(_",
"old",
"Year_",
"+_",
"\"-\"_",
"+_",
"new",
"Year_",
",_",
"owner_",
",_",
"file",
"Name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"view_",
"._",
"replace_",
"(_",
"self_",
"._",
"edit_",
",_",
"region_",
",_",
"message_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"edit_",
"=_",
"None_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | Dav1dde/glad/glad/lang/c/generator.py | [
{
"content": " def write_enums(self, f, written, extensions):\n for ext in extensions:\n for enum in ext.enums:\n if not enum.name in written:\n f.write('#define {} {}\\n'.format(enum.name, enum.value))\n written.add(enum.name)",
"metadata": "root.CGenerator.write_enums",
"header": "['class', 'CGenerator', '(', 'Generator', ')', ':', '___EOS___']",
"index": 226
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"CG",
"enera",
"tor_",
"(_",
"Generator_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"write",
"\\u",
"enums_",
"(_",
"self_",
",_",
"f_",
",_",
"written_",
",_",
"extensions_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"ext_",
"in_",
"extensions_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"for_",
"enum_",
"in_",
"ext_",
"._",
"enums_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"not_",
"enum_",
"._",
"name_",
"in_",
"written_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" ",
"_",
"f_",
"._",
"write_",
"(_",
"'#",
"defin",
"e",
" ",
"{}",
" ",
"{}",
"\\\\",
"n",
"'_",
"._",
"format_",
"(_",
"enum_",
"._",
"name_",
",_",
"enum_",
"._",
"value_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"written_",
"._",
"add_",
"(_",
"enum_",
"._",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused import | pbs/django-cms-pagetags/pagetags/templatetags/page_tags.py | [
{
"content": "import re\n\nfrom django import template\nfrom django.conf import settings\nfrom django.db.models import Q\nfrom cms.models import Page\n\nfrom tagging.models import TaggedItem\nfrom tagging.utils import parse_tag_input\nfrom pagetags.models import PageTagging\n\n\nregister = template.Library()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
},
{
"content": "class StaticSlug(unicode):",
"metadata": "root.StaticSlug",
"header": "['module', '___EOS___']",
"index": 15
},
{
"content": " def bind(self, context):\n pass",
"metadata": "root.StaticSlug.bind",
"header": "['class', 'StaticSlug', '(', 'unicode', ')', ':', '___EOS___']",
"index": 16
},
{
"content": "class DynamicSlug():\n\n",
"metadata": "root.DynamicSlug",
"header": "['module', '___EOS___']",
"index": 20
},
{
"content": " def __init__(self, varname):\n self.varname = varname\n self._value = u''",
"metadata": "root.DynamicSlug.__init__",
"header": "['class', 'DynamicSlug', '(', ')', ':', '___EOS___']",
"index": 21
},
{
"content": " def bind(self, context):\n self._value = context[self.varname]",
"metadata": "root.DynamicSlug.bind",
"header": "['class', 'DynamicSlug', '(', ')', ':', '___EOS___']",
"index": 25
},
{
"content": " def __unicode__(self):\n return self._value",
"metadata": "root.DynamicSlug.__unicode__",
"header": "['class', 'DynamicSlug', '(', ')', ':', '___EOS___']",
"index": 28
},
{
"content": "class StaticTags(list):\n",
"metadata": "root.StaticTags",
"header": "['module', '___EOS___']",
"index": 32
},
{
"content": " def __init__(self, tags):\n super(StaticTags, self).__init__(parse_tag_input(tags))",
"metadata": "root.StaticTags.__init__",
"header": "['class', 'StaticTags', '(', 'list', ')', ':', '___EOS___']",
"index": 33
},
{
"content": " def bind(self, context):\n pass",
"metadata": "root.StaticTags.bind",
"header": "['class', 'StaticTags', '(', 'list', ')', ':', '___EOS___']",
"index": 36
},
{
"content": "class DynamicTags(list):\n",
"metadata": "root.DynamicTags",
"header": "['module', '___EOS___']",
"index": 40
},
{
"content": " def __init__(self, varname):\n self.varname = varname\n super(DynamicTags, self).__init__()",
"metadata": "root.DynamicTags.__init__",
"header": "['class', 'DynamicTags', '(', 'list', ')', ':', '___EOS___']",
"index": 41
},
{
"content": " def bind(self, context):\n self[:] = parse_tag_input(context.get(self.varname, ''))",
"metadata": "root.DynamicTags.bind",
"header": "['class', 'DynamicTags', '(', 'list', ')', ':', '___EOS___']",
"index": 45
},
{
"content": "class TaggedPagesNode(template.Node):\n",
"metadata": "root.TaggedPagesNode",
"header": "['module', '___EOS___']",
"index": 49
},
{
"content": " def __init__(self, parsed_tags, ordering, limit, var_name):\n self.parsed_tags = parsed_tags\n self.ordering = ordering or 'chronological'\n self.limit = limit\n self.var_name = var_name",
"metadata": "root.TaggedPagesNode.__init__",
"header": "['class', 'TaggedPagesNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']",
"index": 50
},
{
"content": " def render(self, context):\n self.parsed_tags.bind(context)\n pagetaggings_from_site = PageTagging.objects.filter(\n page__site=settings.SITE_ID\n ).select_related()\n\n if self.ordering == 'alphabetical':\n pagetaggings_from_site = pagetaggings_from_site.order_by(\n 'page__title_set__title'\n )\n\n if self.ordering == 'chronological':\n pagetaggings_from_site = pagetaggings_from_site.order_by(\n '-page__publication_date'\n )\n\n page_taggings = TaggedItem.objects.get_by_model(\n pagetaggings_from_site, self.parsed_tags\n )[:self.limit]\n\n context[self.var_name] = [\n page_tagging.page for page_tagging in page_taggings\n ]\n return ''",
"metadata": "root.TaggedPagesNode.render",
"header": "['class', 'TaggedPagesNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']",
"index": 56
},
{
"content": "class SimilarPagesNode(template.Node):\n",
"metadata": "root.SimilarPagesNode",
"header": "['module', '___EOS___']",
"index": 82
},
{
"content": " def __init__(self, parsed_slug, limit, var_name):\n self.parsed_slug = parsed_slug\n self.limit = limit\n self.var_name = var_name",
"metadata": "root.SimilarPagesNode.__init__",
"header": "['class', 'SimilarPagesNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']",
"index": 83
},
{
"content": " def render(self, context):\n self.parsed_slug.bind(context)\n try:\n page = Page.objects.get(\n Q(site=settings.SITE_ID),\n Q(title_set__slug=self.parsed_slug)\n )\n except Page.DoesNotExist:\n return ''\n\n page_taggings = TaggedItem.objects.get_related(\n page.pagetagging,\n PageTagging.objects.select_related().filter(\n page__site=settings.SITE_ID\n )\n )[:self.limit]\n context[self.var_name] = [\n page_tagging.page for page_tagging in page_taggings\n ]\n return ''",
"metadata": "root.SimilarPagesNode.render",
"header": "['class', 'SimilarPagesNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']",
"index": 88
},
{
"content": "def _extract_tag_content(token):\n try:\n tag_name, arg = token.contents.split(None, 1)\n except ValueError:\n raise template.TemplateSyntaxError(\n \"%r tag requires additional arguments\" % token.contents.split()[0]\n )\n return tag_name, arg",
"metadata": "root._extract_tag_content",
"header": "['module', '___EOS___']",
"index": 110
},
{
"content": "def parsed_tags(quoted_or_var):\n if (quoted_or_var[0] == quoted_or_var[-1]\n and quoted_or_var[0] in ('\"', \"'\")):\n return StaticTags(tags=quoted_or_var[1:-1])\n return DynamicTags(varname=quoted_or_var)",
"metadata": "root.parsed_tags",
"header": "['module', '___EOS___']",
"index": 120
},
{
"content": "def parse_slug(quoted_or_var):\n if (quoted_or_var[0] == quoted_or_var[-1]\n and quoted_or_var[0] in ('\"', \"'\")):\n return StaticSlug(quoted_or_var[1:-1])\n return DynamicSlug(varname=quoted_or_var)",
"metadata": "root.parse_slug",
"header": "['module', '___EOS___']",
"index": 127
},
{
"content": "@register.tag\ndef pages_with_tags(parser, token):\n parsed_tags, ordering, limit, var_name = _parse_pages_with_tags(token)\n return TaggedPagesNode(parsed_tags, ordering, limit, var_name)",
"metadata": "root.pages_with_tags",
"header": "['module', '___EOS___']",
"index": 134
},
{
"content": "def _parse_pages_with_tags(token):\n tag_name, arg = _extract_tag_content(token)\n\n m = re.search(r\"\"\"\n (.*?) # taglist or varname\n\n (\\s+ order # optional order clause\n \\s+(alphabetical|chronological) # order combinations\n )*\n\n (\\s+ limit \\s+ (\\d+))* # optional limit clause\n\n \\s+ as \\s+ (\\w+) \\s* # collector variable\n \"\"\", arg, flags=re.VERBOSE)\n\n if not m:\n raise template.TemplateSyntaxError(\n \"%r tag had invalid arguments\" % tag_name\n )\n tags, _, ordering, _, limit, var_name = m.groups()\n\n return parsed_tags(tags), ordering, limit and int(limit), var_name",
"metadata": "root._parse_pages_with_tags",
"header": "['module', '___EOS___']",
"index": 140
},
{
"content": "@register.tag\ndef pages_similar_with(parser, token):\n parsed_slug, limit, var_name = _parse_pages_similar_with(token)\n return SimilarPagesNode(parsed_slug, limit, var_name)",
"metadata": "root.pages_similar_with",
"header": "['module', '___EOS___']",
"index": 164
},
{
"content": "def _parse_pages_similar_with(token):\n tag_name, arg = _extract_tag_content(token)\n\n m = re.search(r\"\"\"\n (.*?) # slug or varname\n\n (\\s+ limit \\s+ (\\d+))* # optional limit clause\n\n \\s+ as \\s+ (\\w+) \\s* # collector variable\n \"\"\", arg, flags=re.VERBOSE)\n if not m:\n raise template.TemplateSyntaxError(\n \"%r tag had invalid arguments\" % tag_name\n )\n page_slug, _, limit, var_name = m.groups()\n\n return parse_slug(page_slug), limit and int(limit), var_name",
"metadata": "root._parse_pages_similar_with",
"header": "['module', '___EOS___']",
"index": 170
}
] | [] | [] | 0 | false | [
"[CLS]_",
"Un",
"used_",
"import_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"import_",
"re_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"django_",
"import_",
"template_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"conf_",
"import_",
"settings_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"django_",
"._",
"db_",
"._",
"models_",
"import_",
"Q_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"cms_",
"._",
"models_",
"import_",
"Page_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"tagging",
"_",
"._",
"models_",
"import_",
"Tagg",
"ed",
"Item_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"tagging",
"_",
"._",
"utils_",
"import_",
"parse",
"\\u",
"tag",
"\\u",
"input_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"from_",
"page",
"tags_",
"._",
"models_",
"import_",
"Page",
"Tagg",
"ing_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"register_",
"=_",
"template_",
"._",
"Library_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"class_",
"Static",
"Sl",
"ug_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Static",
"Sl",
"ug_",
"(_",
"unicode_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"bind_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Dynamic",
"Sl",
"ug_",
"(_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Dynamic",
"Sl",
"ug_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"varname_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"varname_",
"=_",
"varname_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"\\u",
"value_",
"=_",
"u",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Dynamic",
"Sl",
"ug_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"bind_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"\\u",
"value_",
"=_",
"context_",
"[_",
"self_",
"._",
"varname_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Dynamic",
"Sl",
"ug_",
"(_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u\\u",
"unicode\\u\\u_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"self_",
"._",
"\\u",
"value_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Static",
"Tags_",
"(_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Static",
"Tags_",
"(_",
"list_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"tags_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"super_",
"(_",
"Static",
"Tags_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"parse",
"\\u",
"tag",
"\\u",
"input_",
"(_",
"tags_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Static",
"Tags_",
"(_",
"list_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"bind_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"pass_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Dynamic",
"Tags_",
"(_",
"list_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Dynamic",
"Tags_",
"(_",
"list_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"varname_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"varname_",
"=_",
"varname_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"super_",
"(_",
"Dynamic",
"Tags_",
",_",
"self_",
")_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Dynamic",
"Tags_",
"(_",
"list_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"bind_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"[_",
":_",
"]_",
"=_",
"parse",
"\\u",
"tag",
"\\u",
"input_",
"(_",
"context_",
"._",
"get_",
"(_",
"self_",
"._",
"varname_",
",_",
"''_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Tagg",
"ed",
"Page",
"s",
"Node_",
"(_",
"template_",
"._",
"Node_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Tagg",
"ed",
"Page",
"s",
"Node_",
"(_",
"template_",
"._",
"Node_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"tags_",
",_",
"ordering_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"parsed",
"\\u",
"tags_",
"=_",
"parsed",
"\\u",
"tags_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"ordering_",
"=_",
"ordering_",
"or_",
"'",
"chrono",
"logical",
"'_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"limit_",
"=_",
"limit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"var",
"\\u",
"name_",
"=_",
"var",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Tagg",
"ed",
"Page",
"s",
"Node_",
"(_",
"template_",
"._",
"Node_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"parsed",
"\\u",
"tags_",
"._",
"bind_",
"(_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"page",
"tagging",
"s",
"\\u",
"from",
"\\u",
"site_",
"=_",
"Page",
"Tagg",
"ing_",
"._",
"objects_",
"._",
"filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"page",
"\\u\\u",
"site_",
"=_",
"settings_",
"._",
"SITE",
"\\u",
"ID_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"._",
"select",
"\\u",
"related_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"self_",
"._",
"ordering_",
"==_",
"'",
"alphabetic",
"al",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"page",
"tagging",
"s",
"\\u",
"from",
"\\u",
"site_",
"=_",
"page",
"tagging",
"s",
"\\u",
"from",
"\\u",
"site_",
"._",
"order",
"\\u",
"by_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"page",
"\\u\\u",
"title",
"\\u",
"set\\u",
"\\u",
"title",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"self_",
"._",
"ordering_",
"==_",
"'",
"chrono",
"logical",
"'_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"page",
"tagging",
"s",
"\\u",
"from",
"\\u",
"site_",
"=_",
"page",
"tagging",
"s",
"\\u",
"from",
"\\u",
"site_",
"._",
"order",
"\\u",
"by_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"'-",
"page",
"\\u\\u",
"publicat",
"ion",
"\\u",
"date",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"page",
"\\u",
"tagging",
"s_",
"=_",
"Tagg",
"ed",
"Item_",
"._",
"objects_",
"._",
"get",
"\\u",
"by",
"\\u",
"model_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"page",
"tagging",
"s",
"\\u",
"from",
"\\u",
"site_",
",_",
"self_",
"._",
"parsed",
"\\u",
"tags_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"[_",
":_",
"self_",
"._",
"limit_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"context_",
"[_",
"self_",
"._",
"var",
"\\u",
"name_",
"]_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"page",
"\\u",
"tagging",
"_",
"._",
"page_",
"for_",
"page",
"\\u",
"tagging",
"_",
"in_",
"page",
"\\u",
"tagging",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"class_",
"Simil",
"ar",
"Page",
"s",
"Node_",
"(_",
"template_",
"._",
"Node_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"[SEP]_",
"class_",
"Simil",
"ar",
"Page",
"s",
"Node_",
"(_",
"template_",
"._",
"Node_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"parsed",
"\\u",
"slug_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"parsed",
"\\u",
"slug_",
"=_",
"parsed",
"\\u",
"slug_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"limit_",
"=_",
"limit_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"var",
"\\u",
"name_",
"=_",
"var",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"class_",
"Simil",
"ar",
"Page",
"s",
"Node_",
"(_",
"template_",
"._",
"Node_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"render_",
"(_",
"self_",
",_",
"context_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"parsed",
"\\u",
"slug_",
"._",
"bind_",
"(_",
"context_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"page_",
"=_",
"Page_",
"._",
"objects_",
"._",
"get_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"Q_",
"(_",
"site_",
"=_",
"settings_",
"._",
"SITE",
"\\u",
"ID_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Q_",
"(_",
"title",
"\\u",
"set\\u",
"\\u",
"slug_",
"=_",
"self_",
"._",
"parsed",
"\\u",
"slug_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Page_",
"._",
"Do",
"es",
"Not",
"Exist_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"page",
"\\u",
"tagging",
"s_",
"=_",
"Tagg",
"ed",
"Item_",
"._",
"objects_",
"._",
"get",
"\\u",
"related_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"page_",
"._",
"page",
"tagging",
"_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"Page",
"Tagg",
"ing_",
"._",
"objects_",
"._",
"select",
"\\u",
"related_",
"(_",
")_",
"._",
"filter_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"page",
"\\u\\u",
"site_",
"=_",
"settings_",
"._",
"SITE",
"\\u",
"ID_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"[_",
":_",
"self_",
"._",
"limit_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"context_",
"[_",
"self_",
"._",
"var",
"\\u",
"name_",
"]_",
"=_",
"[_",
"\\u\\u\\uNL\\u\\u\\u_",
"page",
"\\u",
"tagging",
"_",
"._",
"page_",
"for_",
"page",
"\\u",
"tagging",
"_",
"in_",
"page",
"\\u",
"tagging",
"s_",
"\\u\\u\\uNL\\u\\u\\u_",
"]_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"''_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"extract",
"\\u",
"tag",
"\\u",
"content_",
"(_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"try_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag",
"\\u",
"name_",
",_",
"arg_",
"=_",
"token_",
"._",
"contents_",
"._",
"split_",
"(_",
"None_",
",_",
"1_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"except_",
"Value",
"Error_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"template_",
"._",
"Templa",
"te",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"r",
" ",
"tag",
" ",
"require",
"s",
" ",
"addition",
"al",
" ",
"argu",
"ment",
"s",
"\"_",
"%_",
"token_",
"._",
"contents_",
"._",
"split_",
"(_",
")_",
"[_",
"0_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"tag",
"\\u",
"name_",
",_",
"arg_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"parsed",
"\\u",
"tags_",
"(_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"0_",
"]_",
"==_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"0_",
"]_",
"in_",
"(_",
"'\"'_",
",_",
"\"'\"_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Static",
"Tags_",
"(_",
"tags_",
"=_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"1_",
":_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Dynamic",
"Tags_",
"(_",
"varname_",
"=_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"parse",
"\\u",
"slug_",
"(_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"if_",
"(_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"0_",
"]_",
"==_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"-_",
"1_",
"]_",
"\\u\\u\\uNL\\u\\u\\u_",
"and_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"0_",
"]_",
"in_",
"(_",
"'\"'_",
",_",
"\"'\"_",
")_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"return_",
"Static",
"Sl",
"ug_",
"(_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
"[_",
"1_",
":_",
"-_",
"1_",
"]_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"return_",
"Dynamic",
"Sl",
"ug_",
"(_",
"varname_",
"=_",
"quoted",
"\\u",
"or",
"\\u",
"var_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"register_",
"._",
"tag_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"page",
"s",
"\\u",
"with",
"\\u",
"tags_",
"(_",
"parser_",
",_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parsed",
"\\u",
"tags_",
",_",
"ordering_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
"=_",
"\\u",
"parse",
"\\u",
"page",
"s",
"\\u",
"with",
"\\u",
"tags_",
"(_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Tagg",
"ed",
"Page",
"s",
"Node_",
"(_",
"parsed",
"\\u",
"tags_",
",_",
"ordering_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"parse",
"\\u",
"page",
"s",
"\\u",
"with",
"\\u",
"tags_",
"(_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag",
"\\u",
"name_",
",_",
"arg_",
"=_",
"\\u",
"extract",
"\\u",
"tag",
"\\u",
"content_",
"(_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"m_",
"=_",
"re_",
"._",
"search_",
"(_",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(.*?)",
" ",
" ",
" ",
" ",
" ",
"#",
" ",
"tagli",
"st",
" ",
"or",
" ",
"varname",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(\\\\",
"s",
"+",
" ",
"order",
" ",
" ",
" ",
" ",
"#",
" ",
"option",
"al",
" ",
"order",
" ",
"clause",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\\\",
"s",
"+(",
"alphabetic",
"al",
"|",
"chrono",
"logical",
")",
" ",
"#",
" ",
"order",
" ",
"combinat",
"ion",
"s",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
")*",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(\\\\",
"s",
"+",
" ",
"limit",
" ",
"\\\\",
"s",
"+",
" ",
"(\\\\",
"d",
"+))",
"*",
" ",
" ",
" ",
" ",
" ",
" ",
"#",
" ",
"option",
"al",
" ",
"limit",
" ",
"clause",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\\\",
"s",
"+",
" ",
"as",
" ",
"\\\\",
"s",
"+",
" ",
"(\\\\",
"w",
"+)",
" ",
"\\\\",
"s",
"*",
" ",
" ",
"#",
" ",
"collect",
"or",
" ",
"variab",
"le",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
",_",
"arg_",
",_",
"flags_",
"=_",
"re_",
"._",
"VERBOSE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"not_",
"m_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"template_",
"._",
"Templa",
"te",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"r",
" ",
"tag",
" ",
"had",
" ",
"invalid",
" ",
"argu",
"ment",
"s",
"\"_",
"%_",
"tag",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"tags_",
",_",
"\\u_",
",_",
"ordering_",
",_",
"\\u_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
"=_",
"m_",
"._",
"groups_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"parsed",
"\\u",
"tags_",
"(_",
"tags_",
")_",
",_",
"ordering_",
",_",
"limit_",
"and_",
"int_",
"(_",
"limit_",
")_",
",_",
"var",
"\\u",
"name_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"@_",
"register_",
"._",
"tag_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"def_",
"page",
"s",
"\\u",
"similar",
"\\u",
"with_",
"(_",
"parser_",
",_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"parsed",
"\\u",
"slug_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
"=_",
"\\u",
"parse",
"\\u",
"page",
"s",
"\\u",
"similar",
"\\u",
"with_",
"(_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"return_",
"Simil",
"ar",
"Page",
"s",
"Node_",
"(_",
"parsed",
"\\u",
"slug_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"\\u",
"parse",
"\\u",
"page",
"s",
"\\u",
"similar",
"\\u",
"with_",
"(_",
"token_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"tag",
"\\u",
"name_",
",_",
"arg_",
"=_",
"\\u",
"extract",
"\\u",
"tag",
"\\u",
"content_",
"(_",
"token_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"m_",
"=_",
"re_",
"._",
"search_",
"(_",
"r",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(.*?)",
" ",
" ",
" ",
" ",
" ",
"#",
" ",
"slug",
" ",
"or",
" ",
"varname",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"(\\\\",
"s",
"+",
" ",
"limit",
" ",
"\\\\",
"s",
"+",
" ",
"(\\\\",
"d",
"+))",
"*",
" ",
" ",
" ",
" ",
" ",
" ",
"#",
" ",
"option",
"al",
" ",
"limit",
" ",
"clause",
"\\",
"10",
";",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\\\\",
"s",
"+",
" ",
"as",
" ",
"\\\\",
"s",
"+",
" ",
"(\\\\",
"w",
"+)",
" ",
"\\\\",
"s",
"*",
" ",
" ",
"#",
" ",
"collect",
"or",
" ",
"variab",
"le",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
",_",
"arg_",
",_",
"flags_",
"=_",
"re_",
"._",
"VERBOSE_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"if_",
"not_",
"m_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"template_",
"._",
"Templa",
"te",
"Syntax",
"Error_",
"(_",
"\\u\\u\\uNL\\u\\u\\u_",
"\"%",
"r",
" ",
"tag",
" ",
"had",
" ",
"invalid",
" ",
"argu",
"ment",
"s",
"\"_",
"%_",
"tag",
"\\u",
"name_",
"\\u\\u\\uNL\\u\\u\\u_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"page",
"\\u",
"slug_",
",_",
"\\u_",
",_",
"limit_",
",_",
"var",
"\\u",
"name_",
"=_",
"m_",
"._",
"groups_",
"(_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"return_",
"parse",
"\\u",
"slug_",
"(_",
"page",
"\\u",
"slug_",
")_",
",_",
"limit_",
"and_",
"int_",
"(_",
"limit_",
")_",
",_",
"var",
"\\u",
"name_"
] | [
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Variable defined multiple times | nii-cloud/dodai-compute/nova/tests/api/openstack/test_limits.py | [
{
"content": " def test_delay_POST(self):\n \"\"\"\n Ensure the 8th POST will result in a delay of 6.0 seconds until\n the next request will be granced.\n \"\"\"\n expected = [None] * 7\n results = list(self._check(7, \"POST\", \"/anything\"))\n self.assertEqual(expected, results)\n\n expected = 60.0 / 7.0\n results = self._check_sum(1, \"POST\", \"/anything\")\n self.failUnlessAlmostEqual(expected, results, 8)",
"metadata": "root.LimiterTest.test_delay_POST",
"header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']",
"index": 616
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Variable_",
"defined_",
"multiple_",
"times_",
"[SEP]_",
"class_",
"Limit",
"er",
"Test_",
"(_",
"Base",
"Limit",
"Test",
"Suite_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"def_",
"test\\u",
"dela",
"y",
"\\u",
"POST_",
"(_",
"self_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"\"\"\"",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"Ensur",
"e",
" ",
"the",
" ",
"8",
"th",
" ",
"POST",
" ",
"will",
" ",
"result",
" ",
"in",
" ",
"a",
" ",
"dela",
"y",
" ",
"of",
" ",
"6.0",
" ",
"second",
"s",
" ",
"unti",
"l",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"the",
" ",
"next",
" ",
"request",
" ",
"will",
" ",
"be",
" ",
"gran",
"ced",
".",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"expected_",
"=_",
"[_",
"None_",
"]_",
"*_",
"7_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"list_",
"(_",
"self_",
"._",
"\\u",
"check_",
"(_",
"7_",
",_",
"\"",
"POST",
"\"_",
",_",
"\"/",
"anyt",
"hing",
"\"_",
")_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"assert",
"Equal_",
"(_",
"expected_",
",_",
"results_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"expected_",
"=_",
"60.0_",
"/_",
"7.0_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"results_",
"=_",
"self_",
"._",
"\\u",
"check",
"\\u",
"sum_",
"(_",
"1_",
",_",
"\"",
"POST",
"\"_",
",_",
"\"/",
"anyt",
"hing",
"\"_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"self_",
"._",
"fail",
"Un",
"less",
"Al",
"most",
"Equal_",
"(_",
"expected_",
",_",
"results_",
",_",
"8_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Unused local variable | necaris/python3-openid/openid/extensions/ax.py | [
{
"content": " def __init__(self, succeeded=True, error_message=None):\n AXMessage.__init__(self)\n\n if succeeded and error_message is not None:\n raise AXError('An error message may only be included in a '\n 'failing fetch response')\n if succeeded:\n self.mode = self.SUCCESS_MODE\n else:\n self.mode = self.FAILURE_MODE\n\n self.error_message = error_message",
"metadata": "root.StoreResponse.__init__",
"header": "['class', 'StoreResponse', '(', 'AXMessage', ')', ':', '___EOS___']",
"index": 759
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Un",
"used_",
"local_",
"variable_",
"[SEP]_",
"class_",
"Stor",
"e",
"Response_",
"(_",
"AX",
"Message_",
")_",
":_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"def_",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
",_",
"succeeded_",
"=_",
"True_",
",_",
"error",
"\\u",
"message_",
"=_",
"None_",
")_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"AX",
"Message_",
"._",
"\\u\\u",
"init\\u\\u_",
"(_",
"self_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"if_",
"succeeded_",
"and_",
"error",
"\\u",
"message_",
"is_",
"not_",
"None_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"raise_",
"AX",
"Error_",
"(_",
"'",
"An",
" ",
"error",
" ",
"message",
" ",
"may",
" ",
"only",
" ",
"be",
" ",
"include",
"d",
" ",
"in",
" ",
"a",
" ",
"'_",
"\\u\\u\\uNL\\u\\u\\u_",
"'",
"faili",
"ng",
" ",
"fetch",
" ",
"response",
"'_",
")_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"if_",
"succeeded_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"mode_",
"=_",
"self_",
"._",
"SUCCESS",
"\\u",
"MODE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"else_",
":_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uINDENT\\u\\u\\u ",
" _",
"self_",
"._",
"mode_",
"=_",
"self_",
"._",
"FAIL",
"URE",
"\\u",
"MODE_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"self_",
"._",
"error",
"\\u",
"message_",
"=_",
"error",
"\\u",
"message_",
"\\u\\u\\uNEWLINE\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
] |
Module is imported with 'import' and 'import from' | ipython/ipython-py3k/IPython/parallel/controller/dictdb.py | [
{
"content": "\"\"\"A Task logger that presents our DB interface, \nbut exists entirely in memory and implemented with dicts.\n\nAuthors:\n\n* Min RK\n\n\nTaskRecords are dicts of the form:\n{\n 'msg_id' : str(uuid),\n 'client_uuid' : str(uuid),\n 'engine_uuid' : str(uuid) or None,\n 'header' : dict(header),\n 'content': dict(content),\n 'buffers': list(buffers),\n 'submitted': datetime,\n 'started': datetime or None,\n 'completed': datetime or None,\n 'resubmitted': datetime or None,\n 'result_header' : dict(header) or None,\n 'result_content' : dict(content) or None,\n 'result_buffers' : list(buffers) or None,\n}\nWith this info, many of the special categories of tasks can be defined by query:\n\npending: completed is None\nclient's outstanding: client_uuid = uuid && completed is None\nMIA: arrived is None (and completed is None)\netc.\n\nEngineRecords are dicts of the form:\n{\n 'eid' : int(id),\n 'uuid': str(uuid)\n}\nThis may be extended, but is currently.\n\nWe support a subset of mongodb operators:\n $lt,$gt,$lte,$gte,$ne,$in,$nin,$all,$mod,$exists\n\"\"\"\n#-----------------------------------------------------------------------------\n# Copyright (C) 2010-2011 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n\nfrom datetime import datetime\n\nfrom IPython.config.configurable import LoggingConfigurable\n\nfrom IPython.utils.traitlets import Dict, Unicode, Instance\n\nfilters = {\n '$lt' : lambda a,b: a < b,\n '$gt' : lambda a,b: b > a,\n '$eq' : lambda a,b: a == b,\n '$ne' : lambda a,b: a != b,\n '$lte': lambda a,b: a <= b,\n '$gte': lambda a,b: a >= b,\n '$in' : lambda a,b: a in b,\n '$nin': lambda a,b: a not in b,\n '$all': lambda a,b: all([ a in bb for bb in b ]),\n '$mod': lambda a,b: a%b[0] == b[1],\n '$exists' : lambda a,b: (b and a is not None) or (a is None and not b)\n}\n\n\n\n\n",
"metadata": "root",
"header": "['module', '___EOS___']",
"index": 0
}
] | [] | [] | 0 | true | [
"[CLS]_",
"Module_",
"is_",
"imported_",
"with_",
"'",
"import",
"'_",
"and_",
"'",
"import",
" ",
"from",
"'_",
"[SEP]_",
"module_",
"\\u\\u\\uEOS\\u\\u\\u_",
"\"\"\"",
"A",
" ",
"Task",
" ",
"logg",
"er",
" ",
"tha",
"t",
" ",
"presen",
"ts",
" ",
"our",
" ",
"DB",
" ",
"interface",
",",
" ",
"\\",
"10",
";",
"but",
" ",
"exist",
"s",
" ",
"entire",
"ly",
" ",
"in",
" ",
"memory",
" ",
"and",
" ",
"implemented",
" ",
"with",
" ",
"dict",
"s",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Author",
"s",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"*",
" ",
"Min",
" ",
"RK",
"\\",
"10",
";",
"\\",
"10",
";",
"\\",
"10",
";",
"Task",
"Record",
"s",
" ",
"are",
" ",
"dict",
"s",
" ",
"of",
" ",
"the",
" ",
"form",
":",
"\\",
"10",
";",
"{",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"msg",
"\\u",
"id",
"'",
" ",
":",
" ",
"str",
"(",
"uuid",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"client",
"\\u",
"uuid",
"'",
" ",
":",
" ",
"str",
"(",
"uuid",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"eng",
"ine",
"\\u",
"uuid",
"'",
" ",
":",
" ",
"str",
"(",
"uuid",
")",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"header",
"'",
" ",
":",
" ",
"dict",
"(",
"header",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"content",
"':",
" ",
"dict",
"(",
"content",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"buffer",
"s",
"':",
" ",
"list",
"(",
"buffer",
"s",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"submitted",
"':",
" ",
"datetime",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"start",
"ed",
"':",
" ",
"datetime",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"complete",
"d",
"':",
" ",
"datetime",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"resu",
"bmi",
"tted",
"':",
" ",
"datetime",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"result",
"\\u",
"header",
"'",
" ",
":",
" ",
"dict",
"(",
"header",
")",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"result",
"\\u",
"content",
"'",
" ",
":",
" ",
"dict",
"(",
"content",
")",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"result",
"\\u",
"buffer",
"s",
"'",
" ",
":",
" ",
"list",
"(",
"buffer",
"s",
")",
" ",
"or",
" ",
"Non",
"e",
",",
"\\",
"10",
";}",
"\\",
"10",
";",
"With",
" ",
"this",
" ",
"info",
",",
" ",
"many",
" ",
"of",
" ",
"the",
" ",
"special",
" ",
"categor",
"ies",
" ",
"of",
" ",
"task",
"s",
" ",
"can",
" ",
"be",
" ",
"defin",
"ed",
" ",
"by",
" ",
"query",
":",
"\\",
"10",
";",
"\\",
"10",
";",
"pend",
"ing",
":",
" ",
" ",
"complete",
"d",
" ",
"is",
" ",
"Non",
"e",
"\\",
"10",
";",
"client",
"'",
"s",
" ",
"outstanding",
":",
" ",
"client",
"\\u",
"uuid",
" ",
"=",
" ",
"uuid",
" ",
"&&",
" ",
"complete",
"d",
" ",
"is",
" ",
"Non",
"e",
"\\",
"10",
";",
"MI",
"A",
":",
" ",
"arrive",
"d",
" ",
"is",
" ",
"Non",
"e",
" ",
"(",
"and",
" ",
"complete",
"d",
" ",
"is",
" ",
"Non",
"e",
")",
"\\",
"10",
";",
"etc",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"Engine",
"Record",
"s",
" ",
"are",
" ",
"dict",
"s",
" ",
"of",
" ",
"the",
" ",
"form",
":",
"\\",
"10",
";",
"{",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"eid",
"'",
" ",
":",
" ",
"int",
"(",
"id",
"),",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"'",
"uuid",
"':",
" ",
"str",
"(",
"uuid",
")",
"\\",
"10",
";}",
"\\",
"10",
";",
"Thi",
"s",
" ",
"may",
" ",
"be",
" ",
"extend",
"ed",
",",
" ",
"but",
" ",
"is",
" ",
"currentl",
"y",
".",
"\\",
"10",
";",
"\\",
"10",
";",
"We",
" ",
"support",
" ",
"a",
" ",
"subse",
"t",
" ",
"of",
" ",
"mongodb",
" ",
"opera",
"tors",
":",
"\\",
"10",
";",
" ",
" ",
" ",
" ",
"$",
"lt",
",",
"$",
"gt",
",",
"$",
"lte",
",",
"$",
"gte",
",",
"$",
"ne",
",",
"$",
"in",
",",
"$",
"nin",
",",
"$",
"all",
",",
"$",
"mod",
",",
"$",
"exist",
"s",
"\\",
"10",
";\"\"\"_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"#-",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Copy",
"right",
" ",
"(",
"C",
")",
" ",
"2010",
"-",
"2011",
" ",
" ",
"The",
" ",
"IP",
"yth",
"on",
" ",
"Dev",
"elo",
"pme",
"nt",
" ",
"Team_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"Distribut",
"ed",
" ",
"under",
" ",
"the",
" ",
"term",
"s",
" ",
"of",
" ",
"the",
" ",
"BS",
"D",
" ",
"License",
".",
" ",
" ",
"The",
" ",
"full",
" ",
"license",
" ",
"is",
" ",
"in_",
"\\u\\u\\uNL\\u\\u\\u_",
"#",
" ",
" ",
"the",
" ",
"file",
" ",
"COPY",
"ING",
",",
" ",
"distributed",
" ",
"as",
" ",
"part",
" ",
"of",
" ",
"this",
" ",
"software",
"._",
"\\u\\u\\uNL\\u\\u\\u_",
"#-",
"--------------",
"--------------",
"--------------",
"--------------",
"--------------",
"------",
"_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"datetime_",
"import_",
"datetime_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"IP",
"ython_",
"._",
"config_",
"._",
"configurable",
"_",
"import_",
"Log",
"ging",
"Configura",
"ble_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"from_",
"IP",
"ython_",
"._",
"utils_",
"._",
"tra",
"itle",
"ts_",
"import_",
"Dict_",
",_",
"Unicode_",
",_",
"Instance_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"filters_",
"=_",
"{_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"lt",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"<_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"gt",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"b_",
">_",
"a_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"eq",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"==_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"ne",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"!=_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"lte",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"<=_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"gte",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
">=_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"in",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"in_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"nin",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"not_",
"in_",
"b_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"all",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"all_",
"(_",
"[_",
"a_",
"in_",
"bb_",
"for_",
"bb_",
"in_",
"b_",
"]_",
")_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"mod",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"a_",
"%_",
"b_",
"[_",
"0_",
"]_",
"==_",
"b_",
"[_",
"1_",
"]_",
",_",
"\\u\\u\\uNL\\u\\u\\u_",
"'$",
"exist",
"s",
"'_",
":_",
"lambda_",
"a_",
",_",
"b_",
":_",
"(_",
"b_",
"and_",
"a_",
"is_",
"not_",
"None_",
")_",
"or_",
"(_",
"a_",
"is_",
"None_",
"and_",
"not_",
"b_",
")_",
"\\u\\u\\uNL\\u\\u\\u_",
"}_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uNEWLINE\\u\\u\\u_",
"\\u\\u\\uNL\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_",
"\\u\\u\\uDEDENT\\u\\u\\u_"
] | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,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