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
Imprecise assert
foundit/Piped/piped/test/test_dependencies.py
[ { "content": " def test_duplicate_named_dependencies(self):\n \"\"\" Test that duplicate names does not affect the dependency manager. \"\"\"\n class C:\n def configure(self, runtime_environment):\n self.runtime_environment = runtime_environment\n self.runtime_environment.resource_manager.register('C', provider=self)\n\n def add_consumer(self, resource_dependency):\n # We use a tuple to ensure that the resource comes from this provider, and an object to\n # make every resource provided unique.\n resource = 'provided-by-c', object()\n resource_dependency.on_resource_ready(resource)\n\n class F:\n resource = 'provided-by-f'\n def configure(self, runtime_environment):\n self.runtime_environment = runtime_environment\n self.runtime_environment.resource_manager.register('F', provider=self)\n\n def add_consumer(self, resource_dependency):\n # This provider returns the same resource for all calls\n resource_dependency.on_resource_ready(self.resource)\n\n dep_a = dependencies.ResourceDependency(provider='C', manager=self.dependency_manager)\n dep_b = dependencies.ResourceDependency(provider='C', manager=self.dependency_manager)\n\n dep_d = dependencies.ResourceDependency(provider='F', manager=self.dependency_manager)\n dep_e = dependencies.ResourceDependency(provider='F', manager=self.dependency_manager)\n\n self.dependency_manager.create_dependency_map(self, a=dep_a, b=dep_b, d=dep_d, e=dep_e)\n\n C().configure(self.runtime_environment)\n F().configure(self.runtime_environment)\n\n self.dependency_manager.resolve_initial_states()\n\n # these should get a tuple of (an_unique_object, 'provided-by-c')\n self.assertTrue(dep_a.get_resource() != dep_b.get_resource())\n self.assertEquals(dep_a.get_resource()[0], 'provided-by-c')\n self.assertEquals(dep_b.get_resource()[0], 'provided-by-c')\n\n # f provides a simple string.\n self.assertEquals(dep_d.get_resource(), 'provided-by-f')\n self.assertEquals(dep_e.get_resource(), 'provided-by-f')", "metadata": "root.DependencyManagerTest.test_duplicate_named_dependencies", "header": "['class', 'DependencyManagerTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 253 }, { "content": " def test_on_dependency_only_fires_on_changes(self):\n \"\"\"\n A\n / \\\n B C\n \\ / \\\n D E\n \"\"\"\n a_ready_calls = list()\n a_lost_calls = list()\n\n def reset_calls():\n a_ready_calls[:] = list()\n a_lost_calls[:] = list()\n\n def assertCalls(ready=list(), lost=list(), msg=''):\n self.assertEquals(sorted(a_ready_calls), sorted(ready), msg=msg)\n self.assertEquals(sorted(a_lost_calls), sorted(lost), msg=msg)\n\n def add_ready_call(dependency):\n a_ready_calls.append(dependency)\n\n def add_lost_call(dependency, reason):\n a_lost_calls.append(dependency)\n\n a_dependency = self.dependency_manager.as_dependency('A')\n a_dependency.on_dependency_ready += add_ready_call\n a_dependency.on_dependency_lost += add_lost_call\n\n b_dependency = self.dependency_manager.as_dependency('B')\n c_dependency = self.dependency_manager.as_dependency('C')\n d_dependency = self.dependency_manager.as_dependency('D')\n e_dependency = self.dependency_manager.as_dependency('E')\n\n self.dependency_manager.add_dependency(a_dependency, b_dependency)\n self.dependency_manager.add_dependency(a_dependency, c_dependency)\n self.dependency_manager.add_dependency(b_dependency, d_dependency)\n self.dependency_manager.add_dependency(c_dependency, d_dependency)\n self.dependency_manager.add_dependency(c_dependency, e_dependency)\n\n # assert that no calls have been made\n assertCalls()\n\n # resolving the initial states should result in one lost call, then one ready call for each dependency\n self.dependency_manager.resolve_initial_states()\n # The dependencies will be made available to A:\n assertCalls([b_dependency, c_dependency])\n reset_calls()\n\n # a change in a direct dependency should result in a single lost call\n for direct_dependency in b_dependency, c_dependency:\n direct_dependency.fire_on_lost('lost dependency')\n assertCalls(lost=[direct_dependency])\n reset_calls()\n\n direct_dependency.fire_on_ready()\n assertCalls(ready=[direct_dependency])\n reset_calls()\n\n # bringing down D should result in both B and C going down\n d_dependency.fire_on_lost('lost dependency')\n assertCalls(lost=[b_dependency, c_dependency])\n reset_calls()\n\n # if E goes up or down, nothing should change for A\n e_dependency.fire_on_lost('lost dependency')\n e_dependency.fire_on_ready()\n assertCalls()\n\n # when d comes up again, both b and c should become ready\n d_dependency.fire_on_ready()\n assertCalls(ready=[b_dependency, c_dependency])\n reset_calls()\n\n # bring down the dependencies in any order, and bring them up again - that should result in only\n # one on_lost and only one on_ready per dependency\n for dependencies in itertools.permutations((b_dependency, c_dependency, d_dependency, e_dependency)):\n for dependency in dependencies:\n # since lost-events cascade, and we're triggering the on_lost manually, we have to check\n # if the dependency already is lost, as otherwise it could cause one dependency to be on_lost twice\n # (once by the cascade, then later again by this call)\n if dependency.is_ready:\n dependency.fire_on_lost('lost dependency')\n # as soon as one dependency is lost, one of As dependencies should be lost\n # wrap this in an if to avoid asserting too many times\n if dependency == dependencies[0]:\n self.assertTrue(len(a_lost_calls) >= 1)\n\n for dependency in dependencies:\n # see the above reasoning about checking .ready\n if not dependency.is_ready:\n dependency.fire_on_ready()\n\n assertCalls(lost=[b_dependency, c_dependency], ready=[b_dependency, c_dependency], msg=','.join([repr(dep) for dep in dependencies]))\n reset_calls()", "metadata": "root.DependencyManagerTest.test_on_dependency_only_fires_on_changes", "header": "['class', 'DependencyManagerTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 600 } ]
[ { "span": "self.assertTrue(dep_a.get_resource() != dep_b.get_resource())", "start_line": 290, "start_column": 8, "end_line": 290, "end_column": 69 }, { "span": "self.assertTrue(len(a_lost_calls) >= 1)", "start_line": 686, "start_column": 20, "end_line": 686, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Dependenc", "y", "Manager", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "duplicat", "e\\u", "named", "\\u", "dependencies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "tha", "t", " ", "duplicat", "e", " ", "names", " ", "doe", "s", " ", "not", " ", "affect", " ", "the", " ", "dependen", "cy", " ", "manage", "r", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "C_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "configure_", "(_", "self_", ",_", "runt", "ime", "\\u", "environment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "runt", "ime", "\\u", "environment_", "=_", "runt", "ime", "\\u", "environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "runt", "ime", "\\u", "environment_", "._", "resource", "\\u", "manager_", "._", "register_", "(_", "'", "C", "'_", ",_", "provider_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "consumer_", "(_", "self_", ",_", "resource", "\\u", "dependency_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "use", " ", "a", " ", "tuple", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "resource", " ", "come", "s", " ", "from", " ", "this", " ", "provide", "r", ",", " ", "and", " ", "an", " ", "object", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "every", " ", "resource", " ", "provided", " ", "unique", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "'", "provided", "-", "by", "-", "c", "'_", ",_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "dependency_", "._", "on", "\\u", "resource", "\\u", "ready_", "(_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "F_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "'", "provided", "-", "by", "-", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "configure_", "(_", "self_", ",_", "runt", "ime", "\\u", "environment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "runt", "ime", "\\u", "environment_", "=_", "runt", "ime", "\\u", "environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "runt", "ime", "\\u", "environment_", "._", "resource", "\\u", "manager_", "._", "register_", "(_", "'", "F", "'_", ",_", "provider_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "consumer_", "(_", "self_", ",_", "resource", "\\u", "dependency_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "provide", "r", " ", "return", "s", " ", "the", " ", "same", " ", "resource", " ", "for", " ", "all", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "dependency_", "._", "on", "\\u", "resource", "\\u", "ready_", "(_", "self_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dep", "\\u", "a_", "=_", "dependencies_", "._", "Reso", "urc", "e", "Dependency_", "(_", "provider_", "=_", "'", "C", "'_", ",_", "manager_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dep", "\\u", "b_", "=_", "dependencies_", "._", "Reso", "urc", "e", "Dependency_", "(_", "provider_", "=_", "'", "C", "'_", ",_", "manager_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dep", "\\u", "d_", "=_", "dependencies_", "._", "Reso", "urc", "e", "Dependency_", "(_", "provider_", "=_", "'", "F", "'_", ",_", "manager_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dep", "\\u", "e_", "=_", "dependencies_", "._", "Reso", "urc", "e", "Dependency_", "(_", "provider_", "=_", "'", "F", "'_", ",_", "manager_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "create", "\\u", "dependen", "cy", "\\u", "map_", "(_", "self_", ",_", "a_", "=_", "dep", "\\u", "a_", ",_", "b_", "=_", "dep", "\\u", "b_", ",_", "d_", "=_", "dep", "\\u", "d_", ",_", "e_", "=_", "dep", "\\u", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "(_", ")_", "._", "configure_", "(_", "self_", "._", "runt", "ime", "\\u", "environment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "F_", "(_", ")_", "._", "configure_", "(_", "self_", "._", "runt", "ime", "\\u", "environment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "resolve", "\\u", "initial", "\\u", "states_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "shou", "ld", " ", "get", " ", "a", " ", "tuple", " ", "of", " ", "(", "an", "\\u", "unique", "\\u", "object", ",", " ", "'", "provided", "-", "by", "-", "c", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dep", "\\u", "a_", "._", "get", "\\u", "resource_", "(_", ")_", "!=_", "dep", "\\u", "b_", "._", "get", "\\u", "resource_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dep", "\\u", "a_", "._", "get", "\\u", "resource_", "(_", ")_", "[_", "0_", "]_", ",_", "'", "provided", "-", "by", "-", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dep", "\\u", "b_", "._", "get", "\\u", "resource_", "(_", ")_", "[_", "0_", "]_", ",_", "'", "provided", "-", "by", "-", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "f", " ", "provide", "s", " ", "a", " ", "simple", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dep", "\\u", "d_", "._", "get", "\\u", "resource_", "(_", ")_", ",_", "'", "provided", "-", "by", "-", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dep", "\\u", "e_", "._", "get", "\\u", "resource_", "(_", ")_", ",_", "'", "provided", "-", "by", "-", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Manager", "Test_", "(_", "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_", "def_", "test\\u", "on", "\\u", "dependen", "cy", "\\u", "only", "\\u", "fires", "\\u", "on", "\\u", "changes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", " ", "A", "\\", "10", ";", " ", " ", " ", " ", "/", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "B", " ", " ", " ", "C", "\\", "10", ";", " ", " ", " ", " ", "\\\\", " ", "/", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "D", " ", " ", " ", "E", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "read", "y", "\\u", "calls_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "lost", "\\u", "calls_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "reset", "\\u", "calls_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "read", "y", "\\u", "calls_", "[_", ":_", "]_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "lost", "\\u", "calls_", "[_", ":_", "]_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Calls", "_", "(_", "ready_", "=_", "list_", "(_", ")_", ",_", "lost_", "=_", "list_", "(_", ")_", ",_", "msg_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "sorted_", "(_", "a", "\\u", "read", "y", "\\u", "calls_", ")_", ",_", "sorted_", "(_", "ready_", ")_", ",_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "sorted_", "(_", "a", "\\u", "lost", "\\u", "calls_", ")_", ",_", "sorted_", "(_", "lost_", ")_", ",_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "read", "y", "\\u", "call_", "(_", "dependency_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "read", "y", "\\u", "calls_", "._", "append_", "(_", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "lost", "\\u", "call_", "(_", "dependency_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "lost", "\\u", "calls_", "._", "append_", "(_", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a", "\\u", "dependency_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "as", "\\u", "dependency_", "(_", "'", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "dependency_", "._", "on", "\\u", "dependen", "cy", "\\u", "ready_", "+=_", "add", "\\u", "read", "y", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "dependency_", "._", "on", "\\u", "dependen", "cy", "\\u", "lost_", "+=_", "add", "\\u", "lost", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b", "\\u", "dependency_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "as", "\\u", "dependency_", "(_", "'", "B", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "dependency_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "as", "\\u", "dependency_", "(_", "'", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "dependency_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "as", "\\u", "dependency_", "(_", "'", "D", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "dependency_", "=_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "as", "\\u", "dependency_", "(_", "'", "E", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "add", "\\u", "dependency_", "(_", "a", "\\u", "dependency_", ",_", "b", "\\u", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "add", "\\u", "dependency_", "(_", "a", "\\u", "dependency_", ",_", "c\\u", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "add", "\\u", "dependency_", "(_", "b", "\\u", "dependency_", ",_", "d\\u", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "add", "\\u", "dependency_", "(_", "c\\u", "dependency_", ",_", "d\\u", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "add", "\\u", "dependency_", "(_", "c\\u", "dependency_", ",_", "e\\u", "dependency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", " ", "tha", "t", " ", "no", " ", "calls", " ", "have", " ", "bee", "n", " ", "made", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Calls", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resolv", "ing", " ", "the", " ", "initial", " ", "state", "s", " ", "shou", "ld", " ", "result", " ", "in", " ", "one", " ", "lost", " ", "call", ",", " ", "then", " ", "one", " ", "read", "y", " ", "call", " ", "for", " ", "each", " ", "dependency_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dependen", "cy", "\\u", "manager_", "._", "resolve", "\\u", "initial", "\\u", "states_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "dependen", "cies", " ", "will", " ", "be", " ", "made", " ", "avail", "able", " ", "to", " ", "A", ":_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Calls", "_", "(_", "[_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "calls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "change", " ", "in", " ", "a", " ", "direct", " ", "dependen", "cy", " ", "shou", "ld", " ", "result", " ", "in", " ", "a", " ", "single", " ", "lost", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "direct", "\\u", "dependency_", "in_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "direct", "\\u", "dependency_", "._", "fire", "\\u", "on", "\\u", "lost_", "(_", "'", "lost", " ", "dependen", "cy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Calls", "_", "(_", "lost_", "=_", "[_", "direct", "\\u", "dependency_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "calls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "direct", "\\u", "dependency_", "._", "fire", "\\u", "on", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Calls", "_", "(_", "ready_", "=_", "[_", "direct", "\\u", "dependency_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "calls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bring", "ing", " ", "down", " ", "D", " ", "shou", "ld", " ", "result", " ", "in", " ", "bot", "h", " ", "B", " ", "and", " ", "C", " ", "goi", "ng", " ", "down_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d\\u", "dependency_", "._", "fire", "\\u", "on", "\\u", "lost_", "(_", "'", "lost", " ", "dependen", "cy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Calls", "_", "(_", "lost_", "=_", "[_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "calls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "E", " ", "go", "es", " ", "up", " ", "or", " ", "down", ",", " ", "not", "hing", " ", "shou", "ld", " ", "change", " ", "for", " ", "A_", "\\u\\u\\uNL\\u\\u\\u_", "e\\u", "dependency_", "._", "fire", "\\u", "on", "\\u", "lost_", "(_", "'", "lost", " ", "dependen", "cy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "dependency_", "._", "fire", "\\u", "on", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Calls", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "d", " ", "come", "s", " ", "up", " ", "again", ",", " ", "bot", "h", " ", "b", " ", "and", " ", "c", " ", "shou", "ld", " ", "bec", "ome", " ", "ready_", "\\u\\u\\uNL\\u\\u\\u_", "d\\u", "dependency_", "._", "fire", "\\u", "on", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Calls", "_", "(_", "ready_", "=_", "[_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "calls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bring", " ", "down", " ", "the", " ", "dependen", "cies", " ", "in", " ", "any", " ", "order", ",", " ", "and", " ", "bring", " ", "them", " ", "up", " ", "again", " ", "-", " ", "tha", "t", " ", "shou", "ld", " ", "result", " ", "in", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "one", " ", "on", "\\u", "lost", " ", "and", " ", "only", " ", "one", " ", "on", "\\u", "read", "y", " ", "per", " ", "dependency_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dependencies_", "in_", "itertools_", "._", "permutations_", "(_", "(_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", ",_", "d\\u", "dependency_", ",_", "e\\u", "dependency_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dependency_", "in_", "dependencies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sinc", "e", " ", "lost", "-", "events", " ", "cascade", ",", " ", "and", " ", "we", "'", "re", " ", "trigger", "ing", " ", "the", " ", "on", "\\u", "lost", " ", "manu", "ally", ",", " ", "we", " ", "have", " ", "to", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "dependen", "cy", " ", "alr", "ead", "y", " ", "is", " ", "lost", ",", " ", "as", " ", "other", "wis", "e", " ", "it", " ", "coul", "d", " ", "caus", "e", " ", "one", " ", "dependen", "cy", " ", "to", " ", "be", " ", "on", "\\u", "lost", " ", "twi", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "onc", "e", " ", "by", " ", "the", " ", "cascade", ",", " ", "then", " ", "late", "r", " ", "again", " ", "by", " ", "this", " ", "call", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dependency_", "._", "is", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dependency_", "._", "fire", "\\u", "on", "\\u", "lost_", "(_", "'", "lost", " ", "dependen", "cy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "as", " ", "soo", "n", " ", "as", " ", "one", " ", "dependen", "cy", " ", "is", " ", "lost", ",", " ", "one", " ", "of", " ", "As", " ", "dependen", "cies", " ", "shou", "ld", " ", "be", " ", "lost_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wrap", " ", "this", " ", "in", " ", "an", " ", "if", " ", "to", " ", "avoid", " ", "assert", "ing", " ", "too", " ", "many", " ", "times_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dependency_", "==_", "dependencies_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "a", "\\u", "lost", "\\u", "calls_", ")_", ">=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dependency_", "in_", "dependencies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "the", " ", "above", " ", "reason", "ing", " ", "abo", "ut", " ", "checking", " ", ".", "ready_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dependency_", "._", "is", "\\u", "ready_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dependency_", "._", "fire", "\\u", "on", "\\u", "ready_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "Calls", "_", "(_", "lost_", "=_", "[_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", "]_", ",_", "ready_", "=_", "[_", "b", "\\u", "dependency_", ",_", "c\\u", "dependency_", "]_", ",_", "msg_", "=_", "','_", "._", "join_", "(_", "[_", "repr_", "(_", "dep_", ")_", "for_", "dep_", "in_", "dependencies_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reset", "\\u", "calls_", "(_", ")_", "\\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, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nyaruka/smartmin/smartmin/middleware.py
[ { "content": " def process_view(self, request, view, *args, **kwargs):\n import hotshot, hotshot.stats\n\n for item in request.META['QUERY_STRING'].split('&'):\n if item.split('=')[0] == 'profile': # profile in query string\n # catch the output, must happen before stats object is created\n # see https://bugs.launchpad.net/webpy/+bug/133080 for the details\n std_old, std_new = sys.stdout, StringIO.StringIO()\n sys.stdout = std_new\n\n # now let's do some profiling\n tmpfile = '/tmp/%s' % request.COOKIES['sessionid']\n prof = hotshot.Profile(tmpfile)\n\n # make a call to the actual view function with the given arguments\n response = prof.runcall(view, request, *args[0], **args[1])\n prof.close()\n\n # and then statistical reporting\n stats = hotshot.stats.load(tmpfile)\n stats.strip_dirs()\n stats.sort_stats('time')\n\n # do the output\n stats.print_stats(1.0)\n\n # restore default output\n sys.stdout = std_old\n\n # delete file\n os.remove(tmpfile)\n\n return HttpResponse('<pre>%s</pre>' % std_new.getvalue())\n\n return None", "metadata": "root.ProfileMiddleware.process_view", "header": "['class', 'ProfileMiddleware', '(', ')', ':', '___EOS___']", "index": 26 } ]
[ { "span": "response ", "start_line": 41, "start_column": 16, "end_line": 41, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Profil", "e", "Middleware_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "view_", "(_", "self_", ",_", "request_", ",_", "view_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "hots", "hot_", ",_", "hots", "hot_", "._", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "request_", "._", "META_", "[_", "'", "QUE", "RY", "\\u", "STRING", "'_", "]_", "._", "split_", "(_", "'&'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "._", "split_", "(_", "'='_", ")_", "[_", "0_", "]_", "==_", "'", "profile", "'_", ":_", "#", " ", "profile", " ", "in", " ", "query", " ", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "catch", " ", "the", " ", "output", ",", " ", "must", " ", "happ", "en", " ", "bef", "ore", " ", "stats", " ", "object", " ", "is", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "https", "://", "bug", "s", ".", "launch", "pad", ".", "net", "/", "webp", "y", "/", "+", "bug", "/", "133", "080", " ", "for", " ", "the", " ", "details_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "std", "\\u", "old_", ",_", "std", "\\u", "new_", "=_", "sys_", "._", "stdout_", ",_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "std", "\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "let", "'", "s", " ", "do", " ", "some", " ", "profiling", "_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "'/", "tmp", "/", "%", "s", "'_", "%_", "request_", "._", "COOKIE", "S_", "[_", "'", "sessionid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prof_", "=_", "hots", "hot_", "._", "Profile_", "(_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "call", " ", "to", " ", "the", " ", "actual", " ", "view", " ", "function", " ", "with", " ", "the", " ", "give", "n", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "prof_", "._", "runc", "all_", "(_", "view_", ",_", "request_", ",_", "*_", "args_", "[_", "0_", "]_", ",_", "**_", "args_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prof_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "then", " ", "statistic", "al", " ", "reporting", "_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "hots", "hot_", "._", "stats_", "._", "load_", "(_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "._", "strip", "\\u", "dirs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "._", "sort", "\\u", "stats_", "(_", "'", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "._", "print", "\\u", "stats_", "(_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restore", " ", "default", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "std", "\\u", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "remove_", "(_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "'<", "pre", ">", "%", "s", "</", "pre", ">'_", "%_", "std", "\\u", "new_", "._", "getvalue_", "(_", ")_", ")_", "\\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_", "None_", "\\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, 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": "class BaseChartEncoder(object):\n\n \"\"\"Base class for encoders which turn chart objects into Google Chart URLS.\n\n Object attributes:\n extra_params: Dict to add/override specific chart params. Of the\n form param:string, passed directly to the Google Chart API.\n For example, 'cht':'lti' becomes ?cht=lti in the URL.\n url_base: The prefix to use for URLs. If you want to point to a different\n server for some reason, you would override this.\n formatters: TODO: Need to explain how these work, and how they are\n different from chart formatters.\n enhanced_encoding: If True, uses enhanced encoding. If\n False, simple encoding is used.\n escape_url: If True, URL will be properly escaped. If False, characters\n like | and , will be unescapped (which makes the URL easier to\n read).\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BaseChartEncoder", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self, chart):\n self.extra_params = {} # You can add specific params here.\n self.url_base = 'http://chart.apis.google.com/chart'\n self.formatters = self._GetFormatters()\n self.chart = chart\n self.enhanced_encoding = False\n self.escape_url = True # You can turn off URL escaping for debugging.\n self._width = 0 # These are set when someone calls Url()\n self._height = 0", "metadata": "root.BaseChartEncoder.__init__", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 43 }, { "content": " def Url(self, width, height, use_html_entities=False):\n \"\"\"Get the URL for our graph.\n\n Args:\n use_html_entities: If True, reserved HTML characters (&, <, >, \") in the\n URL are replaced with HTML entities (&amp;, &lt;, etc.). Default is False.\n \"\"\"\n self._width = width\n self._height = height\n params = self._Params(self.chart)\n return util.EncodeUrl(self.url_base, params, self.escape_url,\n use_html_entities)", "metadata": "root.BaseChartEncoder.Url", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def Img(self, width, height):\n \"\"\"Get an image tag for our graph.\"\"\"\n url = self.Url(width, height, use_html_entities=True)\n tag = '<img src=\"%s\" width=\"%s\" height=\"%s\" alt=\"chart\"/>'\n return tag % (url, width, height)", "metadata": "root.BaseChartEncoder.Img", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 66 }, { "content": " def _GetType(self, chart):\n \"\"\"Return the correct chart_type param for the chart.\"\"\"\n raise NotImplementedError", "metadata": "root.BaseChartEncoder._GetType", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 72 }, { "content": " def _GetFormatters(self):\n \"\"\"Get a list of formatter functions to use for encoding.\"\"\"\n formatters = [self._GetLegendParams,\n self._GetDataSeriesParams,\n self._GetColors,\n self._GetAxisParams,\n self._GetGridParams,\n self._GetType,\n self._GetExtraParams,\n self._GetSizeParams,\n ]\n return formatters", "metadata": "root.BaseChartEncoder._GetFormatters", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": " def _Params(self, chart):\n \"\"\"Collect all the different params we need for the URL. Collecting\n all params as a dict before converting to a URL makes testing easier.\n \"\"\"\n chart = chart.GetFormattedChart()\n params = {}\n def Add(new_params):\n params.update(util.ShortenParameterNames(new_params))\n\n for formatter in self.formatters:\n Add(formatter(chart))\n\n for key in params:\n params[key] = str(params[key])\n return params", "metadata": "root.BaseChartEncoder._Params", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 89 }, { "content": " def _GetSizeParams(self, chart):\n \"\"\"Get the size param.\"\"\"\n return {'size': '%sx%s' % (int(self._width), int(self._height))}", "metadata": "root.BaseChartEncoder._GetSizeParams", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": " def _GetExtraParams(self, chart):\n \"\"\"Get any extra params (from extra_params).\"\"\"\n return self.extra_params", "metadata": "root.BaseChartEncoder._GetExtraParams", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 109 }, { "content": " def _GetDataSeriesParams(self, chart):\n \"\"\"Collect params related to the data series.\"\"\"\n y_min, y_max = chart.GetDependentAxis().min, chart.GetDependentAxis().max\n series_data = []\n markers = []\n for i, series in enumerate(chart.data):\n data = series.data\n if not data: # Drop empty series.\n continue\n series_data.append(data)\n\n for x, marker in series.markers:\n args = [marker.shape, marker.color, i, x, marker.size]\n markers.append(','.join(str(arg) for arg in args))\n\n encoder = self._GetDataEncoder(chart)\n result = util.EncodeData(chart, series_data, y_min, y_max, encoder)\n result.update(util.JoinLists(marker = markers))\n return result", "metadata": "root.BaseChartEncoder._GetDataSeriesParams", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 113 }, { "content": " def _GetColors(self, chart):\n \"\"\"Color series color parameter.\"\"\"\n colors = []\n for series in chart.data:\n if not series.data:\n continue\n colors.append(series.style.color)\n return util.JoinLists(color = colors)", "metadata": "root.BaseChartEncoder._GetColors", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 133 }, { "content": " def _GetDataEncoder(self, chart):\n \"\"\"Get a class which can encode the data the way the user requested.\"\"\"\n if not self.enhanced_encoding:\n return util.SimpleDataEncoder()\n return util.EnhancedDataEncoder()", "metadata": "root.BaseChartEncoder._GetDataEncoder", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def _GetLegendParams(self, chart):\n \"\"\"Get params for showing a legend.\"\"\"\n if chart._show_legend:\n return util.JoinLists(data_series_label = chart._legend_labels)\n return {}", "metadata": "root.BaseChartEncoder._GetLegendParams", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": " def _GetAxisLabelsAndPositions(self, axis, chart):\n \"\"\"Return axis.labels & axis.label_positions.\"\"\"\n return axis.labels, axis.label_positions", "metadata": "root.BaseChartEncoder._GetAxisLabelsAndPositions", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 154 }, { "content": " def _GetAxisParams(self, chart):\n \"\"\"Collect params related to our various axes (x, y, right-hand).\"\"\"\n axis_types = []\n axis_ranges = []\n axis_labels = []\n axis_label_positions = []\n axis_label_gridlines = []\n mark_length = max(self._width, self._height)\n for i, axis_pair in enumerate(a for a in chart._GetAxes() if a[1].labels):\n axis_type_code, axis = axis_pair\n axis_types.append(axis_type_code)\n if axis.min is not None or axis.max is not None:\n assert axis.min is not None # Sanity check: both min & max must be set.\n assert axis.max is not None\n axis_ranges.append('%s,%s,%s' % (i, axis.min, axis.max))\n\n labels, positions = self._GetAxisLabelsAndPositions(axis, chart)\n if labels:\n axis_labels.append('%s:' % i)\n axis_labels.extend(labels)\n if positions:\n positions = [i] + list(positions)\n axis_label_positions.append(','.join(str(x) for x in positions))\n if axis.label_gridlines:\n axis_label_gridlines.append(\"%d,%d\" % (i, -mark_length))\n\n return util.JoinLists(axis_type = axis_types,\n axis_range = axis_ranges,\n axis_label = axis_labels,\n axis_position = axis_label_positions,\n axis_tick_marks = axis_label_gridlines,\n )", "metadata": "root.BaseChartEncoder._GetAxisParams", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 158 }, { "content": " def _GetGridParams(self, chart):\n \"\"\"Collect params related to grid lines.\"\"\"\n x = 0\n y = 0\n if chart.bottom.grid_spacing:\n # min/max must be set for this to make sense.\n assert(chart.bottom.min is not None)\n assert(chart.bottom.max is not None)\n total = float(chart.bottom.max - chart.bottom.min)\n x = 100 * chart.bottom.grid_spacing / total\n if chart.left.grid_spacing:\n # min/max must be set for this to make sense.\n assert(chart.left.min is not None)\n assert(chart.left.max is not None)\n total = float(chart.left.max - chart.left.min)\n y = 100 * chart.left.grid_spacing / total\n if x or y:\n return dict(grid = '%.3g,%.3g,1,0' % (x, y))\n return {}", "metadata": "root.BaseChartEncoder._GetGridParams", "header": "['class', 'BaseChartEncoder', '(', 'object', ')', ':', '___EOS___']", "index": 191 }, { "content": "class LineChartEncoder(BaseChartEncoder):\n\n \"\"\"Helper class to encode LineChart objects into Google Chart URLs.\"\"\"\n\n\n", "metadata": "root.LineChartEncoder", "header": "['module', '___EOS___']", "index": 212 }, { "content": " def _GetType(self, chart):\n return {'chart_type': 'lc'}", "metadata": "root.LineChartEncoder._GetType", "header": "['class', 'LineChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 216 }, { "content": " def _GetLineStyles(self, chart):\n \"\"\"Get LineStyle parameters.\"\"\"\n styles = []\n for series in chart.data:\n style = series.style\n if style:\n styles.append('%s,%s,%s' % (style.width, style.on, style.off))\n else:\n # If one style is missing, they must all be missing\n # TODO: Add a test for this; throw a more meaningful exception\n assert (not styles)\n return util.JoinLists(line_style = styles)", "metadata": "root.LineChartEncoder._GetLineStyles", "header": "['class', 'LineChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 219 }, { "content": " def _GetFormatters(self):\n out = super(LineChartEncoder, self)._GetFormatters()\n out.insert(-2, self._GetLineStyles)\n return out", "metadata": "root.LineChartEncoder._GetFormatters", "header": "['class', 'LineChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 232 }, { "content": "class SparklineEncoder(LineChartEncoder):\n\n \"\"\"Helper class to encode Sparkline objects into Google Chart URLs.\"\"\"\n", "metadata": "root.SparklineEncoder", "header": "['module', '___EOS___']", "index": 238 }, { "content": " def _GetType(self, chart):\n return {'chart_type': 'lfi'}", "metadata": "root.SparklineEncoder._GetType", "header": "['class', 'SparklineEncoder', '(', 'LineChartEncoder', ')', ':', '___EOS___']", "index": 242 }, { "content": "class BarChartEncoder(BaseChartEncoder):\n\n \"\"\"Helper class to encode BarChart objects into Google Chart URLs.\"\"\"\n\n __STYLE_DEPRECATION = ('BarChart.display.style is deprecated.' +\n ' Use BarChart.style, instead.')\n\n\n\n\n\n\n\n\n\n style = property(__GetStyle, __SetStyle, __STYLE_DEPRECATION)", "metadata": "root.BarChartEncoder", "header": "['module', '___EOS___']", "index": 246 }, { "content": " def __init__(self, chart, style=None):\n \"\"\"Construct a new BarChartEncoder.\n\n Args:\n style: DEPRECATED. Set style on the chart object itself.\n \"\"\"\n super(BarChartEncoder, self).__init__(chart)\n if style is not None:\n warnings.warn(self.__STYLE_DEPRECATION, DeprecationWarning, stacklevel=2)\n chart.style = style", "metadata": "root.BarChartEncoder.__init__", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 253 }, { "content": " def _GetType(self, chart):\n # Vertical Stacked Type\n types = {(True, False): 'bvg',\n (True, True): 'bvs',\n (False, False): 'bhg',\n (False, True): 'bhs'}\n return {'chart_type': types[(chart.vertical, chart.stacked)]}", "metadata": "root.BarChartEncoder._GetType", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 264 }, { "content": " def _GetAxisLabelsAndPositions(self, axis, chart):\n \"\"\"Reverse labels on the y-axis in horizontal bar charts.\n (Otherwise the labels come out backwards from what you would expect)\n \"\"\"\n if not chart.vertical and axis == chart.left:\n # The left axis of horizontal bar charts needs to have reversed labels\n return reversed(axis.labels), reversed(axis.label_positions)\n return axis.labels, axis.label_positions", "metadata": "root.BarChartEncoder._GetAxisLabelsAndPositions", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 272 }, { "content": " def _GetFormatters(self):\n out = super(BarChartEncoder, self)._GetFormatters()\n # insert at -2 to allow extra_params to overwrite everything\n out.insert(-2, self._ZeroPoint)\n out.insert(-2, self._ApplyBarChartStyle)\n return out", "metadata": "root.BarChartEncoder._GetFormatters", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 281 }, { "content": " def _ZeroPoint(self, chart):\n \"\"\"Get the zero-point if any bars are negative.\"\"\"\n # (Maybe) set the zero point.\n min, max = chart.GetDependentAxis().min, chart.GetDependentAxis().max\n out = {}\n if min < 0:\n if max < 0:\n out['chp'] = 1\n else:\n out['chp'] = -min/float(max - min)\n return out", "metadata": "root.BarChartEncoder._ZeroPoint", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 288 }, { "content": " def _ApplyBarChartStyle(self, chart):\n \"\"\"If bar style is specified, fill in the missing data and apply it.\"\"\"\n # sanity checks\n if chart.style is None or not chart.data:\n return {}\n\n (bar_thickness, bar_gap, group_gap) = (chart.style.bar_thickness,\n chart.style.bar_gap,\n chart.style.group_gap)\n # Auto-size bar/group gaps\n if bar_gap is None and group_gap is not None:\n bar_gap = max(0, group_gap / 2)\n if not chart.style.use_fractional_gap_spacing:\n bar_gap = int(bar_gap)\n if group_gap is None and bar_gap is not None:\n group_gap = max(0, bar_gap * 2)\n\n # Set bar thickness to auto if it is missing\n if bar_thickness is None:\n if chart.style.use_fractional_gap_spacing:\n bar_thickness = 'r'\n else:\n bar_thickness = 'a'\n else:\n # Convert gap sizes to pixels if needed\n if chart.style.use_fractional_gap_spacing:\n if bar_gap:\n bar_gap = int(bar_thickness * bar_gap)\n if group_gap:\n group_gap = int(bar_thickness * group_gap)\n\n # Build a valid spec; ignore group gap if chart is stacked,\n # since there are no groups in that case\n spec = [bar_thickness]\n if bar_gap is not None:\n spec.append(bar_gap)\n if group_gap is not None and not chart.stacked:\n spec.append(group_gap)\n return util.JoinLists(bar_size = spec)", "metadata": "root.BarChartEncoder._ApplyBarChartStyle", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 300 }, { "content": " def __GetStyle(self):\n warnings.warn(self.__STYLE_DEPRECATION, DeprecationWarning, stacklevel=2)\n return self.chart.style", "metadata": "root.BarChartEncoder.__GetStyle", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 340 }, { "content": " def __SetStyle(self, value):\n warnings.warn(self.__STYLE_DEPRECATION, DeprecationWarning, stacklevel=2)\n self.chart.style = value", "metadata": "root.BarChartEncoder.__SetStyle", "header": "['class', 'BarChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 344 }, { "content": "class PieChartEncoder(BaseChartEncoder):\n \"\"\"Helper class for encoding PieChart objects into Google Chart URLs.\n Fuzzy frogs frolic in the forest.\n\n Object Attributes:\n is3d: if True, draw a 3d pie chart. Default is False.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.PieChartEncoder", "header": "['module', '___EOS___']", "index": 351 }, { "content": " def __init__(self, chart, is3d=False, angle=None):\n \"\"\"Construct a new PieChartEncoder.\n\n Args:\n is3d: If True, draw a 3d pie chart. Default is False. If the pie chart\n includes multiple pies, is3d must be set to False.\n angle: Angle of rotation of the pie chart, in radians.\n \"\"\"\n super(PieChartEncoder, self).__init__(chart)\n self.is3d = is3d\n self.angle = None", "metadata": "root.PieChartEncoder.__init__", "header": "['class', 'PieChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 359 }, { "content": " def _GetFormatters(self):\n \"\"\"Add a formatter for the chart angle.\"\"\"\n formatters = super(PieChartEncoder, self)._GetFormatters()\n formatters.append(self._GetAngleParams)\n return formatters", "metadata": "root.PieChartEncoder._GetFormatters", "header": "['class', 'PieChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 371 }, { "content": " def _GetType(self, chart):\n if len(chart.data) > 1:\n if self.is3d:\n warnings.warn(\n '3d charts with more than one pie not supported; rendering in 2d',\n RuntimeWarning, stacklevel=2)\n chart_type = 'pc'\n else:\n if self.is3d:\n chart_type = 'p3'\n else:\n chart_type = 'p'\n return {'chart_type': chart_type}", "metadata": "root.PieChartEncoder._GetType", "header": "['class', 'PieChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 377 }, { "content": " def _GetDataSeriesParams(self, chart):\n \"\"\"Collect params related to the data series.\"\"\"\n\n pie_points = []\n labels = []\n max_val = 1\n for pie in chart.data:\n points = []\n for segment in pie:\n if segment:\n points.append(segment.size)\n max_val = max(max_val, segment.size)\n labels.append(segment.label or '')\n if points:\n pie_points.append(points)\n\n encoder = self._GetDataEncoder(chart)\n result = util.EncodeData(chart, pie_points, 0, max_val, encoder)\n result.update(util.JoinLists(label=labels))\n return result", "metadata": "root.PieChartEncoder._GetDataSeriesParams", "header": "['class', 'PieChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 391 }, { "content": " def _GetColors(self, chart):\n if chart._colors:\n # Colors were overridden by the user\n colors = chart._colors\n else:\n # Build the list of colors from individual segments\n colors = []\n for pie in chart.data:\n for segment in pie:\n if segment and segment.color:\n colors.append(segment.color)\n return util.JoinLists(color = colors)", "metadata": "root.PieChartEncoder._GetColors", "header": "['class', 'PieChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 412 }, { "content": " def _GetAngleParams(self, chart):\n \"\"\"If the user specified an angle, add it to the params.\"\"\"\n if self.angle:\n return {'chp' : str(self.angle)}\n return {}", "metadata": "root.PieChartEncoder._GetAngleParams", "header": "['class', 'PieChartEncoder', '(', 'BaseChartEncoder', ')', ':', '___EOS___']", "index": 425 } ]
[ { "span": "self._GetFormatters()", "start_line": 46, "start_column": 22, "end_line": 46, "end_column": 43 } ]
[ { "span": "def _GetFormatters(self):", "start_line": 76, "start_column": 2, "end_line": 76, "end_column": 27 }, { "span": "def _GetFormatters(self):", "start_line": 232, "start_column": 2, "end_line": 232, "end_column": 27 }, { "span": "def _GetFormatters(self):", "start_line": 281, "start_column": 2, "end_line": 281, "end_column": 27 }, { "span": "def _GetFormatters(self):", "start_line": 371, "start_column": 2, "end_line": 371, "end_column": 27 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "encoders", " ", "whi", "ch", " ", "turn", " ", "chart", " ", "object", "s", " ", "int", "o", " ", "Goo", "gle", " ", "Char", "t", " ", "URL", "S", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Object", " ", "attribute", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "extra", "\\u", "params", ":", " ", "Dict", " ", "to", " ", "add", "/", "override", " ", "specific", " ", "chart", " ", "params", ".", " ", " ", "Of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "form", " ", "param", ":", "string", ",", " ", "pass", "ed", " ", "direct", "ly", " ", "to", " ", "the", " ", "Goo", "gle", " ", "Char", "t", " ", "API", ".", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "For", " ", "example", ",", " ", "'", "cht", "':", "'", "lti", "'", " ", "bec", "ome", "s", " ", "?", "cht", "=", "lti", " ", "in", " ", "the", " ", "URL", ".", "\\", "10", ";", " ", " ", " ", " ", "url", "\\u", "base", ":", " ", "The", " ", "prefix", " ", "to", " ", "use", " ", "for", " ", "URL", "s", ".", " ", " ", "If", " ", "you", " ", "want", " ", "to", " ", "point", " ", "to", " ", "a", " ", "different", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "server", " ", "for", " ", "some", " ", "reason", ",", " ", "you", " ", "wou", "ld", " ", "override", " ", "this", ".", "\\", "10", ";", " ", " ", " ", " ", "formatter", "s", ":", " ", "TOD", "O", ":", " ", "Ne", "ed", " ", "to", " ", "explain", " ", "how", " ", "these", " ", "work", ",", " ", "and", " ", "how", " ", "the", "y", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "different", " ", "from", " ", "chart", " ", "formatter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "enhance", "d\\u", "encoding", ":", " ", "If", " ", "Tru", "e", ",", " ", "use", "s", " ", "enhance", "d", " ", "encoding", ".", " ", " ", "If", "\\", "10", ";", " ", " ", " ", " ", " ", "Fal", "se", ",", " ", "simple", " ", "encoding", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "escape", "\\u", "url", ":", " ", "If", " ", "Tru", "e", ",", " ", "URL", " ", "will", " ", "be", " ", "proper", "ly", " ", "escaped", ".", " ", " ", "If", " ", "Fal", "se", ",", " ", "character", "s", "\\", "10", ";", " ", " ", " ", " ", "like", " ", "|", " ", "and", " ", ",", " ", "will", " ", "be", " ", "une", "scap", "ped", " ", "(", "whi", "ch", " ", "make", "s", " ", "the", " ", "URL", " ", "easi", "er", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "read", ").", "\\", "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_", "\\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_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "extra", "\\u", "params_", "=_", "{_", "}_", "#", " ", "You", " ", "can", " ", "add", " ", "specific", " ", "params", " ", "here", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url", "\\u", "base_", "=_", "'", "http", "://", "chart", ".", "apis", ".", "google", ".", "com", "/", "chart", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "formatters_", "=_", "self_", "._", "\\u", "Get", "Formatt", "ers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chart_", "=_", "chart_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enhance", "d\\u", "encoding_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "escape", "\\u", "url_", "=_", "True_", "#", " ", "You", " ", "can", " ", "turn", " ", "off", " ", "URL", " ", "esca", "ping", " ", "for", " ", "debugg", "ing", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "width_", "=_", "0_", "#", " ", "The", "se", " ", "are", " ", "set", " ", "whe", "n", " ", "some", "one", " ", "calls", " ", "Ur", "l", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "height_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Url_", "(_", "self_", ",_", "width_", ",_", "height_", ",_", "use", "\\u", "html", "\\u", "entities_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "URL", " ", "for", " ", "our", " ", "graph", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "use", "\\u", "html", "\\u", "entit", "ies", ":", " ", "If", " ", "Tru", "e", ",", " ", "reserve", "d", " ", "HTM", "L", " ", "character", "s", " ", "(", "&", ",", " ", "<", ",", " ", ">", ",", " ", "\")", " ", "in", " ", "the", "\\", "10", ";", " ", " ", "URL", " ", "are", " ", "replaced", " ", "with", " ", "HTM", "L", " ", "entit", "ies", " ", "(", "&", "amp", ";", ",", " ", "&", "lt", ";", ",", " ", "etc", ".)", ".", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "width_", "=_", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "height_", "=_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "self_", "._", "\\u", "Params_", "(_", "self_", "._", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "util_", "._", "Encode", "Url_", "(_", "self_", "._", "url", "\\u", "base_", ",_", "params_", ",_", "self_", "._", "escape", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "html", "\\u", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Img_", "(_", "self_", ",_", "width_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "an", " ", "image", " ", "tag", " ", "for", " ", "our", " ", "graph", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "Url_", "(_", "width_", ",_", "height_", ",_", "use", "\\u", "html", "\\u", "entities_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "'<", "img", " ", "src", "=\"", "%", "s", "\"", " ", "widt", "h", "=\"", "%", "s", "\"", " ", "height", "=\"", "%", "s", "\"", " ", "alt", "=\"", "chart", "\"/>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tag_", "%_", "(_", "url_", ",_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Type_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "correct", " ", "chart", "\\u", "type", " ", "param", " ", "for", " ", "the", " ", "chart", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Formatt", "ers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "list", " ", "of", " ", "formatter", " ", "function", "s", " ", "to", " ", "use", " ", "for", " ", "encoding", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatters_", "=_", "[_", "self_", "._", "\\u", "Get", "Legend", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Data", "Serie", "s", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Colors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Axi", "s", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Grid", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Extra", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Get", "Size", "Params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formatters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "all", " ", "the", " ", "different", " ", "params", " ", "we", " ", "need", " ", "for", " ", "the", " ", "URL", ".", " ", " ", "Collecti", "ng", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "params", " ", "as", " ", "a", " ", "dict", " ", "bef", "ore", " ", "convert", "ing", " ", "to", " ", "a", " ", "URL", " ", "make", "s", " ", "testi", "ng", " ", "easi", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "=_", "chart_", "._", "Get", "Formatt", "ed", "Chart_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Add_", "(_", "new", "\\u", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "._", "update_", "(_", "util_", "._", "Short", "en", "Parameter", "Names_", "(_", "new", "\\u", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "formatter_", "in_", "self_", "._", "formatters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Add_", "(_", "formatter_", "(_", "chart_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "key_", "]_", "=_", "str_", "(_", "params_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Size", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "size", " ", "param", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "size", "'_", ":_", "'%", "sx", "%", "s", "'_", "%_", "(_", "int_", "(_", "self_", "._", "\\u", "width_", ")_", ",_", "int_", "(_", "self_", "._", "\\u", "height_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Extra", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "any", " ", "extra", " ", "params", " ", "(", "from", " ", "extra", "\\u", "params", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extra", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Data", "Serie", "s", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "params", " ", "relate", "d", " ", "to", " ", "the", " ", "data", " ", "series", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "min_", ",_", "y", "\\u", "max_", "=_", "chart_", "._", "Get", "Dependent", "Axis_", "(_", ")_", "._", "min_", ",_", "chart_", "._", "Get", "Dependent", "Axis_", "(_", ")_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "series_", "in_", "enumerate_", "(_", "chart_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "series_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "#", " ", "Drop", " ", "empty", " ", "series", "._", "\\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_", "series", "\\u", "data_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", ",_", "marker_", "in_", "series_", "._", "markers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "marker_", "._", "shape_", ",_", "marker_", "._", "color_", ",_", "i_", ",_", "x_", ",_", "marker_", "._", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "._", "append_", "(_", "','_", "._", "join_", "(_", "str_", "(_", "arg_", ")_", "for_", "arg_", "in_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encoder_", "=_", "self_", "._", "\\u", "Get", "Data", "Encoder_", "(_", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "util_", "._", "Encode", "Data_", "(_", "chart_", ",_", "series", "\\u", "data_", ",_", "y", "\\u", "min_", ",_", "y", "\\u", "max_", ",_", "encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "update_", "(_", "util_", "._", "Join", "Lists_", "(_", "marker_", "=_", "markers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Colors_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Color", " ", "series", " ", "color", " ", "parameter", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "series_", "in_", "chart_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "series_", "._", "data_", ":_", "\\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_", "colors_", "._", "append_", "(_", "series_", "._", "style_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "util_", "._", "Join", "Lists_", "(_", "color_", "=_", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Data", "Encoder_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "class", " ", "whi", "ch", " ", "can", " ", "encode", " ", "the", " ", "data", " ", "the", " ", "way", " ", "the", " ", "user", " ", "request", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "enhance", "d\\u", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "util_", "._", "Simple", "Data", "Encoder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "util_", "._", "Enhance", "d", "Data", "Encoder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Legend", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "params", " ", "for", " ", "showin", "g", " ", "a", " ", "legend", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chart_", "._", "\\u", "show", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "util_", "._", "Join", "Lists_", "(_", "data\\u", "series", "\\u", "label_", "=_", "chart_", "._", "\\u", "legend", "\\u", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Axi", "s", "Label", "s", "And", "Positions_", "(_", "self_", ",_", "axis_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "axis", ".", "labels", " ", "&", " ", "axis", ".", "label", "\\u", "position", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "axis_", "._", "labels_", ",_", "axis_", "._", "label", "\\u", "positions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Axi", "s", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "params", " ", "relate", "d", " ", "to", " ", "our", " ", "vari", "ous", " ", "axes", " ", "(", "x", ",", " ", "y", ",", " ", "right", "-", "hand", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "types_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "ranges_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "labels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "label", "\\u", "positions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "label", "\\u", "gridl", "ines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "length_", "=_", "max_", "(_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "axis", "\\u", "pair_", "in_", "enumerate_", "(_", "a_", "for_", "a_", "in_", "chart_", "._", "\\u", "Get", "Axes_", "(_", ")_", "if_", "a_", "[_", "1_", "]_", "._", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis", "\\u", "type", "\\u", "code_", ",_", "axis_", "=_", "axis", "\\u", "pair_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "types_", "._", "append_", "(_", "axis", "\\u", "type", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "axis_", "._", "min_", "is_", "not_", "None_", "or_", "axis_", "._", "max_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "axis_", "._", "min_", "is_", "not_", "None_", "#", " ", "Sanit", "y", " ", "check", ":", " ", "bot", "h", " ", "min", " ", "&", " ", "max", " ", "must", " ", "be", " ", "set", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "axis_", "._", "max_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "ranges_", "._", "append_", "(_", "'%", "s", ",%", "s", ",%", "s", "'_", "%_", "(_", "i_", ",_", "axis_", "._", "min_", ",_", "axis_", "._", "max_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "labels_", ",_", "positions_", "=_", "self_", "._", "\\u", "Get", "Axi", "s", "Label", "s", "And", "Positions_", "(_", "axis_", ",_", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis", "\\u", "labels_", "._", "append_", "(_", "'%", "s", ":'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "labels_", "._", "extend_", "(_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "positions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "positions_", "=_", "[_", "i_", "]_", "+_", "list_", "(_", "positions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "\\u", "label", "\\u", "positions_", "._", "append_", "(_", "','_", "._", "join_", "(_", "str_", "(_", "x_", ")_", "for_", "x_", "in_", "positions_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "axis_", "._", "label", "\\u", "gridl", "ines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis", "\\u", "label", "\\u", "gridl", "ines_", "._", "append_", "(_", "\"%", "d", ",%", "d", "\"_", "%_", "(_", "i_", ",_", "-_", "mark", "\\u", "length_", ")_", ")_", "\\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_", "util_", "._", "Join", "Lists_", "(_", "axis", "\\u", "type_", "=_", "axis", "\\u", "types_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "range_", "=_", "axis", "\\u", "ranges_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "label_", "=_", "axis", "\\u", "labels_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "position_", "=_", "axis", "\\u", "label", "\\u", "positions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "\\u", "tick", "\\u", "marks_", "=_", "axis", "\\u", "label", "\\u", "gridl", "ines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Char", "t", "Encoder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Grid", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "params", " ", "relate", "d", " ", "to", " ", "grid", " ", "lines", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chart_", "._", "bottom_", "._", "grid", "\\u", "spacing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "min", "/", "max", " ", "must", " ", "be", " ", "set", " ", "for", " ", "this", " ", "to", " ", "make", " ", "sense", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "chart_", "._", "bottom_", "._", "min_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "chart_", "._", "bottom_", "._", "max_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "float_", "(_", "chart_", "._", "bottom_", "._", "max_", "-_", "chart_", "._", "bottom_", "._", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "100_", "*_", "chart_", "._", "bottom_", "._", "grid", "\\u", "spacing_", "/_", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "chart_", "._", "left_", "._", "grid", "\\u", "spacing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "min", "/", "max", " ", "must", " ", "be", " ", "set", " ", "for", " ", "this", " ", "to", " ", "make", " ", "sense", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "chart_", "._", "left_", "._", "min_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "chart_", "._", "left_", "._", "max_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "float_", "(_", "chart_", "._", "left_", "._", "max_", "-_", "chart_", "._", "left_", "._", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "100_", "*_", "chart_", "._", "left_", "._", "grid", "\\u", "spacing_", "/_", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "or_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "(_", "grid_", "=_", "'%", ".3", "g", ",%", ".3", "g", ",", "1", ",", "0", "'_", "%_", "(_", "x_", ",_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "Line", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "class", " ", "to", " ", "encode", " ", "Line", "Char", "t", " ", "object", "s", " ", "int", "o", " ", "Goo", "gle", " ", "Char", "t", " ", "URL", "s", ".\"\"\"_", "\\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_", "Line", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Get", "Type_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "chart", "\\u", "type", "'_", ":_", "'", "lc", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Line", "Styles", "_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "Line", "Style", " ", "parameter", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "styles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "series_", "in_", "chart_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style_", "=_", "series_", "._", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "styles_", "._", "append_", "(_", "'%", "s", ",%", "s", ",%", "s", "'_", "%_", "(_", "style_", "._", "width_", ",_", "style_", "._", "on_", ",_", "style_", "._", "off_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "one", " ", "style", " ", "is", " ", "missi", "ng", ",", " ", "the", "y", " ", "must", " ", "all", " ", "be", " ", "missing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Add", " ", "a", " ", "test", " ", "for", " ", "this", ";", " ", "throw", " ", "a", " ", "more", " ", "meaning", "ful", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "not_", "styles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "util_", "._", "Join", "Lists_", "(_", "line", "\\u", "style_", "=_", "styles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Formatt", "ers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "super_", "(_", "Line", "Char", "t", "Encoder_", ",_", "self_", ")_", "._", "\\u", "Get", "Formatt", "ers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "insert_", "(_", "-_", "2_", ",_", "self_", "._", "\\u", "Get", "Line", "Styles", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out_", "\\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_", "Spar", "kli", "ne", "Encoder_", "(_", "Line", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "class", " ", "to", " ", "encode", " ", "Spar", "kli", "ne", " ", "object", "s", " ", "int", "o", " ", "Goo", "gle", " ", "Char", "t", " ", "URL", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spar", "kli", "ne", "Encoder_", "(_", "Line", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Get", "Type_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "chart", "\\u", "type", "'_", ":_", "'", "lf", "i", "'_", "}_", "\\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_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "class", " ", "to", " ", "encode", " ", "Bar", "Char", "t", " ", "object", "s", " ", "int", "o", " ", "Goo", "gle", " ", "Char", "t", " ", "URL", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "STYLE", "\\u", "DEP", "RECA", "TION_", "=_", "(_", "'", "Bar", "Char", "t", ".", "display", ".", "style", " ", "is", " ", "depre", "cated", ".'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "Us", "e", " ", "Bar", "Char", "t", ".", "style", ",", " ", "inst", "ead", ".'_", ")_", "\\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_", "style_", "=_", "property_", "(_", "\\u\\u", "Get", "Style_", ",_", "\\u\\u", "Set", "Style_", ",_", "\\u\\u", "STYLE", "\\u", "DEP", "RECA", "TION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "chart_", ",_", "style_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "new", " ", "Bar", "Char", "t", "Encode", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "style", ":", " ", "DEP", "RECA", "TED", ".", " ", " ", "Set", " ", "style", " ", "on", " ", "the", " ", "chart", " ", "object", " ", "its", "elf", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Bar", "Char", "t", "Encoder_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "style_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "self_", "._", "\\u\\u", "STYLE", "\\u", "DEP", "RECA", "TION_", ",_", "Dep", "reca", "tion", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chart_", "._", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\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", "Type_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "Vertica", "l", " ", "Stack", "ed", " ", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "types_", "=_", "{_", "(_", "True_", ",_", "False_", ")_", ":_", "'", "bv", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "True_", ",_", "True_", ")_", ":_", "'", "bv", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "False_", ",_", "False_", ")_", ":_", "'", "bh", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "False_", ",_", "True_", ")_", ":_", "'", "bh", "s", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "chart", "\\u", "type", "'_", ":_", "types_", "[_", "(_", "chart_", "._", "vertical_", ",_", "chart_", "._", "stacked", "_", ")_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Axi", "s", "Label", "s", "And", "Positions_", "(_", "self_", ",_", "axis_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Revers", "e", " ", "labels", " ", "on", " ", "the", " ", "y", "-", "axis", " ", "in", " ", "horizon", "tal", " ", "bar", " ", "charts", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "Ot", "her", "wis", "e", " ", "the", " ", "labels", " ", "come", " ", "out", " ", "back", "ward", "s", " ", "from", " ", "what", " ", "you", " ", "wou", "ld", " ", "expect", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "chart_", "._", "vertical_", "and_", "axis_", "==_", "chart_", "._", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "left", " ", "axis", " ", "of", " ", "horizon", "tal", " ", "bar", " ", "charts", " ", "need", "s", " ", "to", " ", "have", " ", "reverse", "d", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reversed_", "(_", "axis_", "._", "labels_", ")_", ",_", "reversed_", "(_", "axis_", "._", "label", "\\u", "positions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "axis_", "._", "labels_", ",_", "axis_", "._", "label", "\\u", "positions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Formatt", "ers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "super_", "(_", "Bar", "Char", "t", "Encoder_", ",_", "self_", ")_", "._", "\\u", "Get", "Formatt", "ers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "at", " ", "-", "2", " ", "to", " ", "allow", " ", "extra", "\\u", "params", " ", "to", " ", "overwrit", "e", " ", "every", "thing_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "._", "insert_", "(_", "-_", "2_", ",_", "self_", "._", "\\u", "Zero", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "insert_", "(_", "-_", "2_", ",_", "self_", "._", "\\u", "Apply", "Bar", "Char", "t", "Style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Zero", "Point_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "zero", "-", "point", " ", "if", " ", "any", " ", "bar", "s", " ", "are", " ", "negati", "ve", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "Ma", "yb", "e", ")", " ", "set", " ", "the", " ", "zero", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "min_", ",_", "max_", "=_", "chart_", "._", "Get", "Dependent", "Axis_", "(_", ")_", "._", "min_", ",_", "chart_", "._", "Get", "Dependent", "Axis_", "(_", ")_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "max_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "[_", "'", "ch", "p", "'_", "]_", "=_", "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 ", " _", "out_", "[_", "'", "ch", "p", "'_", "]_", "=_", "-_", "min_", "/_", "float_", "(_", "max_", "-_", "min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Apply", "Bar", "Char", "t", "Style_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "bar", " ", "style", " ", "is", " ", "specified", ",", " ", "fill", " ", "in", " ", "the", " ", "missi", "ng", " ", "data", " ", "and", " ", "appl", "y", " ", "it", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sanity", " ", "checks_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "chart_", "._", "style_", "is_", "None_", "or_", "not_", "chart_", "._", "data_", ":_", "\\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_", "(_", "bar", "\\u", "thickness_", ",_", "bar", "\\u", "gap_", ",_", "group", "\\u", "gap_", ")_", "=_", "(_", "chart_", "._", "style_", "._", "bar", "\\u", "thickness_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "._", "style_", "._", "bar", "\\u", "gap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chart_", "._", "style_", "._", "group", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Auto", "-", "size", " ", "bar", "/", "group", " ", "gaps_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bar", "\\u", "gap_", "is_", "None_", "and_", "group", "\\u", "gap_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar", "\\u", "gap_", "=_", "max_", "(_", "0_", ",_", "group", "\\u", "gap_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "chart_", "._", "style_", "._", "use", "\\u", "fractional", "\\u", "gap", "\\u", "spacing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar", "\\u", "gap_", "=_", "int_", "(_", "bar", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "group", "\\u", "gap_", "is_", "None_", "and_", "bar", "\\u", "gap_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "\\u", "gap_", "=_", "max_", "(_", "0_", ",_", "bar", "\\u", "gap_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "bar", " ", "thick", "ness", " ", "to", " ", "auto", " ", "if", " ", "it", " ", "is", " ", "missing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bar", "\\u", "thickness_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "chart_", "._", "style_", "._", "use", "\\u", "fractional", "\\u", "gap", "\\u", "spacing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar", "\\u", "thickness_", "=_", "'", "r", "'_", "\\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 ", " _", "bar", "\\u", "thickness_", "=_", "'", "a", "'_", "\\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_", "#", " ", "Convert", " ", "gap", " ", "size", "s", " ", "to", " ", "pixel", "s", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "chart_", "._", "style_", "._", "use", "\\u", "fractional", "\\u", "gap", "\\u", "spacing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bar", "\\u", "gap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar", "\\u", "gap_", "=_", "int_", "(_", "bar", "\\u", "thickness_", "*_", "bar", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "group", "\\u", "gap_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "\\u", "gap_", "=_", "int_", "(_", "bar", "\\u", "thickness_", "*_", "group", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "a", " ", "valid", " ", "spec", ";", " ", "ignore", " ", "group", " ", "gap", " ", "if", " ", "chart", " ", "is", " ", "stacked", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "there", " ", "are", " ", "no", " ", "group", "s", " ", "in", " ", "tha", "t", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "bar", "\\u", "thickness_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bar", "\\u", "gap_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "._", "append_", "(_", "bar", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group", "\\u", "gap_", "is_", "not_", "None_", "and_", "not_", "chart_", "._", "stacked", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "._", "append_", "(_", "group", "\\u", "gap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "util_", "._", "Join", "Lists_", "(_", "bar", "\\u", "size_", "=_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "Get", "Style_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "self_", "._", "\\u\\u", "STYLE", "\\u", "DEP", "RECA", "TION_", ",_", "Dep", "reca", "tion", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "chart_", "._", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "Set", "Style_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "self_", "._", "\\u\\u", "STYLE", "\\u", "DEP", "RECA", "TION_", ",_", "Dep", "reca", "tion", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chart_", "._", "style_", "=_", "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_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "class", " ", "for", " ", "encoding", " ", "Pie", "Char", "t", " ", "object", "s", " ", "int", "o", " ", "Goo", "gle", " ", "Char", "t", " ", "URL", "s", ".", "\\", "10", ";", " ", "Fuzzy", " ", "fro", "gs", " ", "fro", "lic", " ", "in", " ", "the", " ", "forest", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Object", " ", "Attribute", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "is", "3d", ":", " ", "if", " ", "Tru", "e", ",", " ", "draw", " ", "a", " ", "3d", " ", "pie", " ", "chart", ".", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "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_", "[SEP]_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "chart_", ",_", "is", "3d_", "=_", "False_", ",_", "angle_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "new", " ", "Pie", "Char", "t", "Encode", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "is", "3d", ":", " ", "If", " ", "Tru", "e", ",", " ", "draw", " ", "a", " ", "3d", " ", "pie", " ", "chart", ".", " ", "Default", " ", "is", " ", "Fal", "se", ".", " ", "If", " ", "the", " ", "pie", " ", "chart", "\\", "10", ";", " ", " ", " ", " ", "include", "s", " ", "multiple", " ", "pie", "s", ",", " ", "is", "3d", " ", "must", " ", "be", " ", "set", " ", "to", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", "angle", ":", " ", "Ang", "le", " ", "of", " ", "rotati", "on", " ", "of", " ", "the", " ", "pie", " ", "chart", ",", " ", "in", " ", "radian", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Pie", "Char", "t", "Encoder_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "3d_", "=_", "is", "3d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "angle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Formatt", "ers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "formatter", " ", "for", " ", "the", " ", "chart", " ", "angle", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatters_", "=_", "super_", "(_", "Pie", "Char", "t", "Encoder_", ",_", "self_", ")_", "._", "\\u", "Get", "Formatt", "ers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatters_", "._", "append_", "(_", "self_", "._", "\\u", "Get", "Ang", "le", "Params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formatters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Type_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "chart_", "._", "data_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "3d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "3d", " ", "charts", " ", "with", " ", "more", " ", "than", " ", "one", " ", "pie", " ", "not", " ", "support", "ed", ";", " ", "render", "ing", " ", "in", " ", "2d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Run", "time", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chart", "\\u", "type_", "=_", "'", "pc", "'_", "\\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_", "self_", "._", "is", "3d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chart", "\\u", "type_", "=_", "'", "p3", "'_", "\\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 ", " _", "chart", "\\u", "type_", "=_", "'", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "chart", "\\u", "type", "'_", ":_", "chart", "\\u", "type_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Data", "Serie", "s", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Collect", " ", "params", " ", "relate", "d", " ", "to", " ", "the", " ", "data", " ", "series", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pie", "\\u", "points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "val_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pie", "_", "in_", "chart_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "segment_", "in_", "pie", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "segment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points_", "._", "append_", "(_", "segment_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "val_", "=_", "max_", "(_", "max", "\\u", "val_", ",_", "segment_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "._", "append_", "(_", "segment_", "._", "label_", "or_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pie", "\\u", "points_", "._", "append_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encoder_", "=_", "self_", "._", "\\u", "Get", "Data", "Encoder_", "(_", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "util_", "._", "Encode", "Data_", "(_", "chart_", ",_", "pie", "\\u", "points_", ",_", "0_", ",_", "max", "\\u", "val_", ",_", "encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "update_", "(_", "util_", "._", "Join", "Lists_", "(_", "label_", "=_", "labels_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Colors_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "chart_", "._", "\\u", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Color", "s", " ", "wer", "e", " ", "overrid", "den", " ", "by", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "chart_", "._", "\\u", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "list", " ", "of", " ", "colors", " ", "from", " ", "individual", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pie", "_", "in_", "chart_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "segment_", "in_", "pie", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "segment_", "and_", "segment_", "._", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "._", "append_", "(_", "segment_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\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_", "return_", "util_", "._", "Join", "Lists_", "(_", "color_", "=_", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pie", "Char", "t", "Encoder_", "(_", "Base", "Char", "t", "Encoder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Ang", "le", "Params_", "(_", "self_", ",_", "chart_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "If", " ", "the", " ", "user", " ", "specified", " ", "an", " ", "angle", ",", " ", "add", " ", "it", " ", "to", " ", "the", " ", "params", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "angle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "ch", "p", "'_", ":_", "str_", "(_", "self_", "._", "angle_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "}_" ]
[ 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, 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, 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 ]
Variable defined multiple times
modflowpy/flopy/flopy/modflow/mfuzf1.py
[ { "content": " def write_file(self):\n \"\"\"\n Write the package file.\n\n Returns\n -------\n None\n\n \"\"\"\n nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper\n # Open file for writing\n f_uzf = open(self.fn_path, 'w')\n f_uzf.write('{}\\n'.format(self.heading))\n # Dataset 1a\n specify_temp = ''\n if self.specifythtr > 0:\n specify_temp += 'SPECIFYTHTR '\n if self.specifythti > 0:\n specify_temp += 'SPECIFYTHTI '\n if self.nosurfleak > 0:\n specify_temp += 'NOSURFLEAK'\n if (self.specifythtr + self.specifythti + self.nosurfleak) > 0:\n f_uzf.write('%s\\n' % specify_temp)\n del specify_temp\n # Dataset 1b\n if self.iuzfopt > 0:\n comment = ' NUZTOP IUZFOPT IRUNFLG IETFLG IUZFCB1 IUZFCB2 NTRAIL NSETS NUZGAGES'\n f_uzf.write('{0:10d}{1:10d}{2:10d}{3:10d}{4:10d}{5:10d}{6:10d}{7:10d}{8:10d}{9:15.6E}{10:100s}\\n'. \\\n format(self.nuztop, self.iuzfopt, self.irunflg, self.ietflg, self.iuzfcb1, self.iuzfcb2, \\\n self.ntrail2, self.nsets, self.nuzgag, self.surfdep, comment))\n else:\n comment = ' NUZTOP IUZFOPT IRUNFLG IETFLG IUZFCB1 IUZFCB2 NUZGAGES'\n f_uzf.write('{0:10d}{1:10d}{2:10d}{3:10d}{4:10d}{5:10d}{6:10d}{7:15.6E}{8:100s}\\n'. \\\n format(self.nuztop, self.iuzfopt, self.irunflg, self.ietflg, self.iuzfcb1, self.iuzfcb2, \\\n self.nuzgag, self.surfdep, comment))\n f_uzf.write(self.iuzfbnd.get_file_entry())\n if self.irunflg > 0:\n f_uzf.write(self.irunbnd.get_file_entry())\n # IF the absolute value of IUZFOPT = 1: Read item 4.\n # Data Set 4\n # [VKS (NCOL, NROW)] -- U2DREL\n if abs(self.iuzfopt) == 1:\n f_uzf.write(self.vks.get_file_entry())\n if self.iuzfopt > 0:\n # Data Set 5\n # EPS (NCOL, NROW) -- U2DREL\n f_uzf.write(self.eps.get_file_entry())\n # Data Set 6a\n # THTS (NCOL, NROW) -- U2DREL\n f_uzf.write(self.thts.get_file_entry())\n # Data Set 6b\n # THTR (NCOL, NROW) -- U2DREL\n if self.specifythtr > 0.0:\n f_uzf.write(self.thtr.get_file_entry())\n # Data Set 7\n # [THTI (NCOL, NROW)] -- U2DREL\n if not self.parent.get_package('DIS').steady[0] or self.specifythti > 0.0:\n f_uzf.write(self.thti.get_file_entry())\n # If NUZGAG>0: Item 8 is repeated NUZGAG times\n # Data Set 8\n # [IUZROW] [IUZCOL] IFTUNIT [IUZOPT]\n if self.nuzgag > 0:\n for n in range(self.nuzgag):\n if self.row_col_iftunit_iuzopt[n][0][2] > 0:\n comment = ' IUZROW IUZCOL IFTUNIT IUZOPT'\n f_uzf.write('%10i%10i%10i%10i%s\\n' % (tuple(self.row_col_iftunit_iuzopt[n][0] + [comment])))\n # f_uzf.write('{0:10d}{1:10d}{2:10d}{3:10d}{4:50s}\\n'.\\\n # format(tuple(self.row_col_iftunit_iuzopt[n][0] + [comment])))\n else:\n comment = ' IFTUNIT'\n f_uzf.write('%10i%s\\n' % (tuple([self.row_col_iftunit_iuzopt[n][0][2]] + [comment])))\n for n in range(nper):\n comment = ' NUZF1 for stress period ' + str(n + 1)\n if (n < len(self.finf)):\n nuzf1 = 1\n else:\n nuzf1 = -1\n # f_uzf.write('%10i%s\\n' % (nuzf1, comment))\n f_uzf.write('{0:10d}{1:20s}\\n'.format(nuzf1, comment))\n comment = 'FINF for stress period ' + str(n + 1)\n if (n < len(self.finf)):\n f_uzf.write(self.finf[n].get_file_entry())\n comment = ' NUZF2 for stress period ' + str(n + 1)\n if self.ietflg > 0:\n if (n < len(self.pet)):\n nuzf2 = 1\n else:\n nuzf2 = -1\n # f_uzf.write('%10i%s\\n' % (nuzf2, comment))\n f_uzf.write('{0:10d}{1:20s}\\n'.format(nuzf2, comment))\n comment = 'PET for stress period ' + str(n + 1)\n if (n < len(self.pet)):\n f_uzf.write(self.pet[n].get_file_entry())\n comment = ' NUZF3 for stress period ' + str(n + 1)\n if (n < len(self.extdp)):\n nuzf3 = 1\n else:\n nuzf3 = -1\n f_uzf.write('{0:10d}{1:20s}\\n'.format(nuzf3, comment))\n comment = 'EXTDP for stress period ' + str(n + 1)\n if (n < len(self.extdp)):\n f_uzf.write(self.extdp[n].get_file_entry())\n comment = ' NUZF4 for stress period ' + str(n + 1)\n if self.iuzfopt > 0:\n if (n < len(self.extwc)):\n nuzf4 = 1\n else:\n nuzf4 = -1\n f_uzf.write('{0:10d}{1:20s}\\n'.format(nuzf4, comment))\n comment = 'EXTWC for stress period ' + str(n + 1)\n if (n < len(self.extwc)):\n f_uzf.write(self.extwc[n].get_file_entry())\n f_uzf.close()", "metadata": "root.ModflowUzf1.write_file", "header": "['class', 'ModflowUzf1', '(', 'Package', ')', ':', '___EOS___']", "index": 340 } ]
[ { "span": "comment ", "start_line": 419, "start_column": 12, "end_line": 419, "end_column": 19 }, { "span": "comment ", "start_line": 430, "start_column": 16, "end_line": 430, "end_column": 23 }, { "span": "comment ", "start_line": 439, "start_column": 16, "end_line": 439, "end_column": 23 }, { "span": "comment ", "start_line": 449, "start_column": 20, "end_line": 449, "end_column": 27 } ]
[ { "span": "comment ", "start_line": 412, "start_column": 12, "end_line": 412, "end_column": 19 }, { "span": "comment ", "start_line": 422, "start_column": 12, "end_line": 422, "end_column": 19 }, { "span": "comment ", "start_line": 433, "start_column": 16, "end_line": 433, "end_column": 23 }, { "span": "comment ", "start_line": 442, "start_column": 16, "end_line": 442, "end_column": 23 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Mod", "flow", "Uz", "f1_", "(_", "Package_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "the", " ", "package", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nrow_", ",_", "ncol_", ",_", "nla", "y_", ",_", "npe", "r_", "=_", "self_", "._", "parent_", "._", "nro", "w", "\\u", "ncol", "\\u", "nla", "y", "\\u", "npe", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Open", " ", "file", " ", "for", " ", "writ", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "f", "\\u", "uz", "f_", "=_", "open_", "(_", "self_", "._", "fn", "\\u", "path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{}", "\\\\", "n", "'_", "._", "format_", "(_", "self_", "._", "heading_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Datas", "et", " ", "1a_", "\\u\\u\\uNL\\u\\u\\u_", "speci", "fy", "\\u", "temp_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "speci", "fy", "th", "tr_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "speci", "fy", "\\u", "temp_", "+=_", "'", "SPEC", "IF", "YT", "HT", "R", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "speci", "fy", "th", "ti_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "speci", "fy", "\\u", "temp_", "+=_", "'", "SPEC", "IF", "YT", "HT", "I", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "nos", "urf", "leak", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "speci", "fy", "\\u", "temp_", "+=_", "'", "NOS", "UR", "FL", "EA", "K", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "speci", "fy", "th", "tr_", "+_", "self_", "._", "speci", "fy", "th", "ti_", "+_", "self_", "._", "nos", "urf", "leak", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'%", "s", "\\\\", "n", "'_", "%_", "speci", "fy", "\\u", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "speci", "fy", "\\u", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Datas", "et", " ", "1b", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "iu", "zf", "opt_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "'", " ", "NU", "ZT", "OP", " ", "IU", "ZF", "OPT", " ", "IR", "UN", "FL", "G", " ", "IE", "TF", "LG", " ", "IU", "ZF", "CB", "1", " ", "IU", "ZF", "CB", "2", " ", "NT", "RAI", "L", " ", "NSE", "TS", " ", "NU", "ZG", "AGE", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{", "0", ":", "10", "d", "}{", "1", ":", "10", "d", "}{", "2", ":", "10", "d", "}{", "3", ":", "10", "d", "}{", "4", ":", "10", "d", "}{", "5", ":", "10", "d", "}{", "6", ":", "10", "d", "}{", "7", ":", "10", "d", "}{", "8", ":", "10", "d", "}{", "9", ":", "15.", "6", "E", "}{", "10", ":", "100", "s", "}\\\\", "n", "'_", "._", "format_", "(_", "self_", "._", "nu", "zt", "op_", ",_", "self_", "._", "iu", "zf", "opt_", ",_", "self_", "._", "ir", "unf", "lg_", ",_", "self_", "._", "iet", "fl", "g_", ",_", "self_", "._", "iu", "zf", "cb", "1_", ",_", "self_", "._", "iu", "zf", "cb", "2_", ",_", "self_", "._", "ntra", "il", "2_", ",_", "self_", "._", "nse", "ts_", ",_", "self_", "._", "nu", "zg", "ag_", ",_", "self_", "._", "surf", "dep_", ",_", "comment_", ")_", ")_", "\\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 ", " _", "comment_", "=_", "'", " ", "NU", "ZT", "OP", " ", "IU", "ZF", "OPT", " ", "IR", "UN", "FL", "G", " ", "IE", "TF", "LG", " ", "IU", "ZF", "CB", "1", " ", "IU", "ZF", "CB", "2", " ", "NU", "ZG", "AGE", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{", "0", ":", "10", "d", "}{", "1", ":", "10", "d", "}{", "2", ":", "10", "d", "}{", "3", ":", "10", "d", "}{", "4", ":", "10", "d", "}{", "5", ":", "10", "d", "}{", "6", ":", "10", "d", "}{", "7", ":", "15.", "6", "E", "}{", "8", ":", "100", "s", "}\\\\", "n", "'_", "._", "format_", "(_", "self_", "._", "nu", "zt", "op_", ",_", "self_", "._", "iu", "zf", "opt_", ",_", "self_", "._", "ir", "unf", "lg_", ",_", "self_", "._", "iet", "fl", "g_", ",_", "self_", "._", "iu", "zf", "cb", "1_", ",_", "self_", "._", "iu", "zf", "cb", "2_", ",_", "self_", "._", "nu", "zg", "ag_", ",_", "self_", "._", "surf", "dep_", ",_", "comment_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "iu", "zf", "bnd", "_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "ir", "unf", "lg_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "ir", "unb", "nd_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "IF", " ", "the", " ", "abs", "olute", " ", "value", " ", "of", " ", "IU", "ZF", "OPT", " ", "=", " ", "1", ":", " ", "Read", " ", "item", " ", "4._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Data", " ", "Set", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "VK", "S", " ", "(", "NC", "OL", ",", " ", "NR", "OW", ")]", " ", "--", " ", "U2", "DR", "EL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "abs_", "(_", "self_", "._", "iu", "zf", "opt_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "vk", "s_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "iu", "zf", "opt_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Data", " ", "Set", " ", "5_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EPS", " ", "(", "NC", "OL", ",", " ", "NR", "OW", ")", " ", "--", " ", "U2", "DR", "EL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "eps_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Data", " ", "Set", " ", "6a", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TH", "TS", " ", "(", "NC", "OL", ",", " ", "NR", "OW", ")", " ", "--", " ", "U2", "DR", "EL_", "\\u\\u\\uNL\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "th", "ts_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Data", " ", "Set", " ", "6b", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TH", "TR", " ", "(", "NC", "OL", ",", " ", "NR", "OW", ")", " ", "--", " ", "U2", "DR", "EL_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "speci", "fy", "th", "tr_", ">_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "th", "tr_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Data", " ", "Set", " ", "7_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "TH", "TI", " ", "(", "NC", "OL", ",", " ", "NR", "OW", ")]", " ", "--", " ", "U2", "DR", "EL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "parent_", "._", "get", "\\u", "package_", "(_", "'", "DIS", "'_", ")_", "._", "stead", "y_", "[_", "0_", "]_", "or_", "self_", "._", "speci", "fy", "th", "ti_", ">_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "th", "ti_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "NU", "ZG", "AG", ">", "0", ":", " ", "Item", " ", "8", " ", "is", " ", "repeated", " ", "NU", "ZG", "AG", " ", "times_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Data", " ", "Set", " ", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "IU", "ZR", "OW", "]", " ", "[", "IU", "ZC", "OL", "]", " ", "IF", "TUN", "IT", " ", "[", "IU", "ZO", "PT", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "nu", "zg", "ag_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "range_", "(_", "self_", "._", "nu", "zg", "ag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "row", "\\u", "col", "\\u", "ift", "unit", "\\u", "iu", "zop", "t_", "[_", "n_", "]_", "[_", "0_", "]_", "[_", "2_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "comment_", "=_", "'", " ", "IU", "ZR", "OW", " ", "IU", "ZC", "OL", " ", "IF", "TUN", "IT", " ", "IU", "ZO", "PT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'%", "10", "i", "%", "10", "i", "%", "10", "i", "%", "10", "i", "%", "s", "\\\\", "n", "'_", "%_", "(_", "tuple_", "(_", "self_", "._", "row", "\\u", "col", "\\u", "ift", "unit", "\\u", "iu", "zop", "t_", "[_", "n_", "]_", "[_", "0_", "]_", "+_", "[_", "comment_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", "\\u", "uz", "f", ".", "write", "('{", "0", ":", "10", "d", "}{", "1", ":", "10", "d", "}{", "2", ":", "10", "d", "}{", "3", ":", "10", "d", "}{", "4", ":", "50", "s", "}\\\\", "n", "'.", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "format", "(", "tuple", "(", "self", ".", "row", "\\u", "col", "\\u", "ift", "unit", "\\u", "iu", "zop", "t", "[", "n", "][", "0", "]", " ", "+", " ", "[", "comment", "]))", ")_", "\\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 ", " ", "_", "comment_", "=_", "'", " ", "IF", "TUN", "IT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'%", "10", "i", "%", "s", "\\\\", "n", "'_", "%_", "(_", "tuple_", "(_", "[_", "self_", "._", "row", "\\u", "col", "\\u", "ift", "unit", "\\u", "iu", "zop", "t_", "[_", "n_", "]_", "[_", "0_", "]_", "[_", "2_", "]_", "]_", "+_", "[_", "comment_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "npe", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "'", " ", "NU", "ZF", "1", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "fin", "f_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nu", "zf", "1_", "=_", "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 ", " _", "nu", "zf", "1_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", "\\u", "uz", "f", ".", "write", "('", "%", "10", "i", "%", "s", "\\\\", "n", "'", " ", "%", " ", "(", "nu", "zf", "1", ",", " ", "comment", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{", "0", ":", "10", "d", "}{", "1", ":", "20", "s", "}\\\\", "n", "'_", "._", "format_", "(_", "nu", "zf", "1_", ",_", "comment_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "'", "FIN", "F", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "fin", "f_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "fin", "f_", "[_", "n_", "]_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comment_", "=_", "'", " ", "NU", "ZF", "2", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "iet", "fl", "g_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "pet", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nu", "zf", "2_", "=_", "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 ", " ", "_", "nu", "zf", "2_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "f", "\\u", "uz", "f", ".", "write", "('", "%", "10", "i", "%", "s", "\\\\", "n", "'", " ", "%", " ", "(", "nu", "zf", "2", ",", " ", "comment", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{", "0", ":", "10", "d", "}{", "1", ":", "20", "s", "}\\\\", "n", "'_", "._", "format_", "(_", "nu", "zf", "2_", ",_", "comment_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "'", "PE", "T", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "pet", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "pet", "_", "[_", "n_", "]_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comment_", "=_", "'", " ", "NU", "ZF", "3", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "ext", "dp_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nu", "zf", "3_", "=_", "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 ", " ", "_", "nu", "zf", "3_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{", "0", ":", "10", "d", "}{", "1", ":", "20", "s", "}\\\\", "n", "'_", "._", "format_", "(_", "nu", "zf", "3_", ",_", "comment_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "'", "EXT", "DP", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "ext", "dp_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "ext", "dp_", "[_", "n_", "]_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comment_", "=_", "'", " ", "NU", "ZF", "4", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "iu", "zf", "opt_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "ext", "wc_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nu", "zf", "4_", "=_", "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 ", " ", " _", "nu", "zf", "4_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "uz", "f_", "._", "write_", "(_", "'{", "0", ":", "10", "d", "}{", "1", ":", "20", "s", "}\\\\", "n", "'_", "._", "format_", "(_", "nu", "zf", "4_", ",_", "comment_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "'", "EXT", "WC", " ", "for", " ", "stress", " ", "period", " ", "'_", "+_", "str_", "(_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "n_", "<_", "len_", "(_", "self_", "._", "ext", "wc_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f", "\\u", "uz", "f_", "._", "write_", "(_", "self_", "._", "ext", "wc_", "[_", "n_", "]_", "._", "get", "\\u", "file", "\\u", "entry_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\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_", "f", "\\u", "uz", "f_", "._", "close_", "(_", ")_", "\\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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/networking-cisco/networking_cisco/tests/unit/saf/server/test_dfa_server.py
[ { "content": " def test_subnet_create_event(self):\n \"\"\"Test case for subnet create event.\"\"\"\n\n network_info = {'network':\n {'name': FAKE_NETWORK_NAME,\n 'tenant_id': FAKE_PROJECT_ID,\n 'id': FAKE_NETWORK_ID}}\n subnet_info = {'subnet': {\n 'network_id': FAKE_NETWORK_ID,\n 'tenant_id': FAKE_PROJECT_ID,\n 'allocation_pools': [\n {'start': FAKE_DHCP_IP_START, 'end': FAKE_DHCP_IP_END}],\n 'gateway_ip': FAKE_GW_ADDR,\n 'ip_version': 4,\n 'cidr': FAKE_IP_ADDR + '/24',\n 'id': FAKE_SUBNET_ID}}\n\n dcnmclnt = self.dfa_server.dcnm_client\n dcnmclnt.get_config_profile_for_network.return_value = (\n FAKE_CFG_PROFILE_NAME, FAKE_FWD_MODE)\n self.dfa_server.network_create_event(network_info)\n\n fake_network = mock.Mock()\n fake_network.source = 'dcnm'\n fake_network.name = FAKE_NETWORK_NAME\n self.dfa_server.get_network.return_value = fake_network\n self.dfa_server.subnet_create_event(subnet_info)\n self.assertFalse(self.dfa_server.dcnm_client.create_network.called)\n\n fake_network.source = 'openstack'\n self.dfa_server.subnet_create_event(subnet_info)\n self.assertTrue(self.dfa_server.dcnm_client.create_network.called)\n create_call = self.dfa_server.dcnm_client.create_network.call_args\n arg1, arg2 = create_call\n self.assertTrue(arg1[0] == FAKE_PROJECT_NAME)\n self.assertTrue(\n arg1[1].__dict__ == self.dfa_server.network[FAKE_NETWORK_ID])\n self.assertTrue(\n arg1[2].__dict__ == self.dfa_server.subnet[FAKE_SUBNET_ID])", "metadata": "root.TestDFAServer.test_subnet_create_event", "header": "['class', 'TestDFAServer', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 276 }, { "content": " def test_network_delete_event(self):\n \"\"\"Test case for network delete event.\"\"\"\n\n self._load_network_info()\n self.assertFalse(self.segid in self.dfa_server.segmentation_pool)\n network_info = {'network_id': FAKE_NETWORK_ID}\n self.dfa_server.get_vms.return_value = []\n self.dfa_server.network_delete_event(network_info)\n self.assertTrue(self.dfa_server.dcnm_client.delete_network.called)\n dcall = self.dfa_server.dcnm_client.delete_network.call_args\n arg1, arg2 = dcall\n self.assertTrue(arg1[0] == FAKE_PROJECT_NAME)\n self.assertTrue(arg1[1].name == FAKE_NETWORK_NAME)\n self.assertTrue(arg1[1].segmentation_id == self.segid)\n self.assertTrue(self.segid in self.dfa_server.segmentation_pool)\n self.assertTrue(self.dfa_server.delete_network_db.called)", "metadata": "root.TestDFAServer.test_network_delete_event", "header": "['class', 'TestDFAServer', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 316 }, { "content": " def test_dcnm_network_create_event(self):\n \"\"\"Test case for DCNM network create event.\"\"\"\n\n network_info = {'segmentation_id': FAKE_SEG_ID,\n 'project_name': FAKE_PROJECT_NAME,\n 'partition_name': self.part_name}\n self.dfa_server.get_network_by_segid.return_value = None\n self.dfa_server.get_project_id.return_value = FAKE_PROJECT_ID\n\n dcnm_network = {'segmentId': FAKE_SEG_ID,\n 'profileName': FAKE_CFG_PROFILE_NAME,\n 'networkName': FAKE_NETWORK_NAME,\n 'organizationName': FAKE_PROJECT_NAME,\n 'dhcpScope': None,\n 'netmaskLength': 24,\n 'gateway': FAKE_GW_ADDR}\n self.dfa_server.dcnm_client.get_network.return_value = dcnm_network\n dcnmclnt = self.dfa_server.dcnm_client\n dcnmclnt.config_profile_fwding_mode_get.return_value = FAKE_FWD_MODE\n\n self.dfa_server.dcnm_network_create_event(network_info)\n\n # Check the results.\n self.dfa_server.dcnm_client.get_network.assert_called_with(\n FAKE_PROJECT_NAME, FAKE_SEG_ID)\n for netid, dcnmnet in six.iteritems(self.dfa_server.network):\n self.dfa_server.add_network_db.assert_called_with(\n netid, dcnmnet, 'DCNM', constants.RESULT_SUCCESS)\n self.assertTrue(self.dfa_server.neutronclient.create_network.called)\n net_ext_name = self.cfg.dcnm.dcnm_net_ext\n call_args = self.dfa_server.neutronclient.create_network.call_args\n cargs, ckwargs = call_args\n net_name = ckwargs.get('body').get('network').get('name')\n self.assertTrue(net_name == (\n FAKE_NETWORK_NAME + net_ext_name + str(FAKE_SEG_ID)))\n self.assertTrue(self.dfa_server.neutronclient.create_subnet.called)", "metadata": "root.TestDFAServer.test_dcnm_network_create_event", "header": "['class', 'TestDFAServer', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 333 }, { "content": " def test_dcnm_network_delete_event(self):\n \"\"\"Test case for DCNM network delete event.\"\"\"\n\n self._load_network_info()\n network_info = {'segmentation_id': (\n self.dfa_server.network[FAKE_NETWORK_ID]['segmentation_id'])}\n\n dcnmnet = mock.Mock()\n dcnmnet.network_id = FAKE_NETWORK_ID\n self.dfa_server.get_network_by_segid.return_value = dcnmnet\n self.dfa_server.dcnm_network_delete_event(network_info)\n\n # Check the results.\n self.assertTrue(self.dfa_server.network == {})\n self.dfa_server.neutronclient.delete_network.assert_called_with(\n FAKE_NETWORK_ID)\n self.dfa_server.delete_network_db.assert_called_with(FAKE_NETWORK_ID)", "metadata": "root.TestDFAServer.test_dcnm_network_delete_event", "header": "['class', 'TestDFAServer', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 370 }, { "content": " def test_port_create_event(self):\n \"\"\"Test case for port create event.\"\"\"\n\n port_info = self._get_port_info()\n self._load_network_info()\n self.dfa_server._inst_api.get_instance_for_uuid.return_value = (\n FAKE_INSTANCE_NAME)\n self.dfa_server.dcnm_dhcp = True\n self.dfa_server.port_create_event(port_info)\n\n # Check the output/calls\n self.assertTrue(self.dfa_server.neutron_event.send_vm_info.called)\n call_args = self.dfa_server.neutron_event.send_vm_info.call_args\n cargs, ckwargs = call_args\n self.assertTrue(cargs[0] == FAKE_HOST_ID)\n self.assertTrue(str(self.dfa_server.port[FAKE_PORT_ID]) == cargs[1])\n self.assertTrue(self.dfa_server.add_vms_db.called)\n call_args = self.dfa_server.add_vms_db.call_args\n cargs, ckwargs = call_args\n self.assertTrue(self.dfa_server.port[FAKE_PORT_ID] == cargs[0])\n self.assertTrue(constants.RESULT_SUCCESS == cargs[1])", "metadata": "root.TestDFAServer.test_port_create_event", "header": "['class', 'TestDFAServer', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 388 }, { "content": " def test_port_delete_event(self):\n \"\"\"Test case for port delete event.\"\"\"\n\n vm = mock.Mock()\n vm.mac = FAKE_MAC_ADDR\n vm.port_id = FAKE_PORT_ID\n vm.segmentation_id = self.segid\n vm.network_id = FAKE_NETWORK_ID,\n vm.port_id = FAKE_PORT_ID\n vm.ip = FAKE_IP_ADDR\n vm.gw_mac = FAKE_GW_ADDR\n vm.instance_id = FAKE_DEVICE_ID\n vm.fwd_mod = FAKE_FWD_MODE\n vm.host = FAKE_HOST_ID\n vm.name = FAKE_INSTANCE_NAME\n self.dfa_server.get_vm.return_value = vm\n vm_info = dict(status='down', vm_mac=vm.mac,\n segmentation_id=vm.segmentation_id,\n host=vm.host, port_uuid=vm.port_id,\n net_uuid=vm.network_id,\n oui=dict(ip_addr=vm.ip, vm_name=vm.name,\n vm_uuid=vm.instance_id, gw_mac=vm.gw_mac,\n fwd_mod=vm.fwd_mod, oui_id='cisco'))\n port_info = {'port_id': FAKE_PORT_ID}\n\n # Check the output/calls\n self.dfa_server.port_delete_event(port_info)\n self.assertTrue(self.dfa_server.neutron_event.send_vm_info.called)\n call_args = self.dfa_server.neutron_event.send_vm_info.call_args\n cargs, ckwargs = call_args\n self.assertTrue(cargs[0] == FAKE_HOST_ID)\n self.assertTrue(str(vm_info) == cargs[1])\n self.dfa_server.delete_vm_db.assert_called_with(vm.instance_id)", "metadata": "root.TestDFAServer.test_port_delete_event", "header": "['class', 'TestDFAServer', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 434 } ]
[ { "span": "self.assertTrue(arg1[0] == FAKE_PROJECT_NAME)", "start_line": 310, "start_column": 8, "end_line": 310, "end_column": 53 }, { "span": "self.assertTrue(\n arg1[1].__dict__ == self.dfa_server.network[FAKE_NETWORK_ID])", "start_line": 311, "start_column": 8, "end_line": 312, "end_column": 73 }, { "span": "self.assertTrue(\n arg1[2].__dict__ == self.dfa_server.subnet[FAKE_SUBNET_ID])", "start_line": 313, "start_column": 8, "end_line": 314, "end_column": 71 }, { "span": "self.assertFalse(self.segid in self.dfa_server.segmentation_pool)", "start_line": 320, "start_column": 8, "end_line": 320, "end_column": 73 }, { "span": "self.assertTrue(arg1[0] == FAKE_PROJECT_NAME)", "start_line": 327, "start_column": 8, "end_line": 327, "end_column": 53 }, { "span": "self.assertTrue(arg1[1].name == FAKE_NETWORK_NAME)", "start_line": 328, "start_column": 8, "end_line": 328, "end_column": 58 }, { "span": "self.assertTrue(arg1[1].segmentation_id == self.segid)", "start_line": 329, "start_column": 8, "end_line": 329, "end_column": 62 }, { "span": "self.assertTrue(self.segid in self.dfa_server.segmentation_pool)", "start_line": 330, "start_column": 8, "end_line": 330, "end_column": 72 }, { "span": "self.assertTrue(net_name == (\n FAKE_NETWORK_NAME + net_ext_name + str(FAKE_SEG_ID)))", "start_line": 366, "start_column": 8, "end_line": 367, "end_column": 65 }, { "span": "self.assertTrue(self.dfa_server.network == {})", "start_line": 383, "start_column": 8, "end_line": 383, "end_column": 54 }, { "span": "self.assertTrue(cargs[0] == FAKE_HOST_ID)", "start_line": 402, "start_column": 8, "end_line": 402, "end_column": 49 }, { "span": "self.assertTrue(str(self.dfa_server.port[FAKE_PORT_ID]) == cargs[1])", "start_line": 403, "start_column": 8, "end_line": 403, "end_column": 76 }, { "span": "self.assertTrue(self.dfa_server.port[FAKE_PORT_ID] == cargs[0])", "start_line": 407, "start_column": 8, "end_line": 407, "end_column": 71 }, { "span": "self.assertTrue(constants.RESULT_SUCCESS == cargs[1])", "start_line": 408, "start_column": 8, "end_line": 408, "end_column": 61 }, { "span": "self.assertTrue(cargs[0] == FAKE_HOST_ID)", "start_line": 464, "start_column": 8, "end_line": 464, "end_column": 49 }, { "span": "self.assertTrue(str(vm_info) == cargs[1])", "start_line": 465, "start_column": 8, "end_line": 465, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "DF", "AS", "erver_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subnet", "\\u", "create", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", " ", "for", " ", "subnet", " ", "create", " ", "event", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "{_", "'", "network", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "name", "'_", ":_", "FAKE", "\\u", "NET", "WORK", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tenan", "t", "\\u", "id", "'_", ":_", "FAKE", "\\u", "PROJECT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subnet", "\\u", "info_", "=_", "{_", "'", "subnet", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "\\u", "id", "'_", ":_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tenan", "t", "\\u", "id", "'_", ":_", "FAKE", "\\u", "PROJECT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allocat", "ion", "\\u", "pools", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "start", "'_", ":_", "FAKE", "\\u", "DHC", "P", "\\u", "IP", "\\u", "START_", ",_", "'", "end", "'_", ":_", "FAKE", "\\u", "DHC", "P", "\\u", "IP", "\\u", "END_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gateway", "\\u", "ip", "'_", ":_", "FAKE", "\\u", "GW", "\\u", "ADDR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ip", "\\u", "version", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cid", "r", "'_", ":_", "FAKE", "\\u", "IP", "\\u", "ADDR_", "+_", "'/", "24", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "FAKE", "\\u", "SUB", "NET", "\\u", "ID_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dc", "nm", "cln", "t_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc", "nm", "cln", "t_", "._", "get", "\\u", "config", "\\u", "profile", "\\u", "for", "\\u", "network_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "CF", "G", "\\u", "PROFILE", "\\u", "NAME_", ",_", "FAKE", "\\u", "FW", "D", "\\u", "MODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "network", "\\u", "create", "\\u", "event_", "(_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "network_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "network_", "._", "source_", "=_", "'", "dc", "nm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "network_", "._", "name_", "=_", "FAKE", "\\u", "NET", "WORK", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "get", "\\u", "network_", "._", "return", "\\u", "value_", "=_", "fake", "\\u", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "subnet", "\\u", "create", "\\u", "event_", "(_", "subnet", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "create", "\\u", "network_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "network_", "._", "source_", "=_", "'", "openst", "ack", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "subnet", "\\u", "create", "\\u", "event_", "(_", "subnet", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "create", "\\u", "network_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "call_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "create", "\\u", "network_", "._", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg1_", ",_", "arg2_", "=_", "create", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "arg1_", "[_", "0_", "]_", "==_", "FAKE", "\\u", "PROJECT", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "arg1_", "[_", "1_", "]_", "._", "\\u\\u", "dict\\u\\u_", "==_", "self_", "._", "dfa", "\\u", "server_", "._", "network_", "[_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "arg1_", "[_", "2_", "]_", "._", "\\u\\u", "dict\\u\\u_", "==_", "self_", "._", "dfa", "\\u", "server_", "._", "subnet_", "[_", "FAKE", "\\u", "SUB", "NET", "\\u", "ID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DF", "AS", "erver_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "network", "\\u", "delete", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", " ", "for", " ", "network", " ", "delete", " ", "event", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "network", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "seg", "id_", "in_", "self_", "._", "dfa", "\\u", "server_", "._", "segmentation", "\\u", "pool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "{_", "'", "network", "\\u", "id", "'_", ":_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "get", "\\u", "vms_", "._", "return", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "network", "\\u", "delete", "\\u", "event_", "(_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "delete", "\\u", "network_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dca", "ll_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "delete", "\\u", "network_", "._", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg1_", ",_", "arg2_", "=_", "dca", "ll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "arg1_", "[_", "0_", "]_", "==_", "FAKE", "\\u", "PROJECT", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "arg1_", "[_", "1_", "]_", "._", "name_", "==_", "FAKE", "\\u", "NET", "WORK", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "arg1_", "[_", "1_", "]_", "._", "segmentation", "\\u", "id_", "==_", "self_", "._", "seg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "seg", "id_", "in_", "self_", "._", "dfa", "\\u", "server_", "._", "segmentation", "\\u", "pool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "delete", "\\u", "network", "\\u", "db_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DF", "AS", "erver_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dc", "nm", "\\u", "network", "\\u", "create", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", " ", "for", " ", "DC", "NM", " ", "network", " ", "create", " ", "event", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "{_", "'", "segmentation", "\\u", "id", "'_", ":_", "FAKE", "\\u", "SEG", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "name", "'_", ":_", "FAKE", "\\u", "PROJECT", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partit", "ion", "\\u", "name", "'_", ":_", "self_", "._", "part", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "get", "\\u", "network", "\\u", "by", "\\u", "seg", "id_", "._", "return", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "get", "\\u", "project", "\\u", "id_", "._", "return", "\\u", "value_", "=_", "FAKE", "\\u", "PROJECT", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dc", "nm", "\\u", "network_", "=_", "{_", "'", "segment", "Id", "'_", ":_", "FAKE", "\\u", "SEG", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "profile", "Name", "'_", ":_", "FAKE", "\\u", "CF", "G", "\\u", "PROFILE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "network", "Name", "'_", ":_", "FAKE", "\\u", "NET", "WORK", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "organization", "Name", "'_", ":_", "FAKE", "\\u", "PROJECT", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dhcp", "Sco", "pe", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "net", "mask", "Length", "'_", ":_", "24_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gateway", "'_", ":_", "FAKE", "\\u", "GW", "\\u", "ADDR_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "get", "\\u", "network_", "._", "return", "\\u", "value_", "=_", "dc", "nm", "\\u", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc", "nm", "cln", "t_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc", "nm", "cln", "t_", "._", "config", "\\u", "profile", "\\u", "fw", "ding", "\\u", "mode", "\\u", "get_", "._", "return", "\\u", "value_", "=_", "FAKE", "\\u", "FW", "D", "\\u", "MODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "network", "\\u", "create", "\\u", "event_", "(_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "client_", "._", "get", "\\u", "network_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "PROJECT", "\\u", "NAME_", ",_", "FAKE", "\\u", "SEG", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "netid", "_", ",_", "dc", "nm", "net_", "in_", "six_", "._", "iteritems_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dfa", "\\u", "server_", "._", "add", "\\u", "network", "\\u", "db_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "netid", "_", ",_", "dc", "nm", "net_", ",_", "'", "DC", "NM", "'_", ",_", "constants_", "._", "RESU", "LT", "\\u", "SUCCESS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "neutronclient_", "._", "create", "\\u", "network_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "\\u", "ext", "\\u", "name_", "=_", "self_", "._", "cfg_", "._", "dc", "nm_", "._", "dc", "nm", "\\u", "net", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "neutronclient_", "._", "create", "\\u", "network_", "._", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "car", "gs_", ",_", "ck", "war", "gs_", "=_", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "net", "\\u", "name_", "=_", "ck", "war", "gs_", "._", "get_", "(_", "'", "body", "'_", ")_", "._", "get_", "(_", "'", "network", "'_", ")_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "net", "\\u", "name_", "==_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "NET", "WORK", "\\u", "NAME_", "+_", "net", "\\u", "ext", "\\u", "name_", "+_", "str_", "(_", "FAKE", "\\u", "SEG", "\\u", "ID_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "neutronclient_", "._", "create", "\\u", "subnet_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DF", "AS", "erver_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dc", "nm", "\\u", "network", "\\u", "delete", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", " ", "for", " ", "DC", "NM", " ", "network", " ", "delete", " ", "event", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "network", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "{_", "'", "segmentation", "\\u", "id", "'_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "network_", "[_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", "]_", "[_", "'", "segmentation", "\\u", "id", "'_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dc", "nm", "net_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc", "nm", "net_", "._", "network", "\\u", "id_", "=_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "get", "\\u", "network", "\\u", "by", "\\u", "seg", "id_", "._", "return", "\\u", "value_", "=_", "dc", "nm", "net_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "network", "\\u", "delete", "\\u", "event_", "(_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "results", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "network_", "==_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "neutronclient_", "._", "delete", "\\u", "network_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "delete", "\\u", "network", "\\u", "db_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DF", "AS", "erver_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "port", "\\u", "create", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", " ", "for", " ", "port", " ", "create", " ", "event", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "port", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "network", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "\\u", "inst", "\\u", "api_", "._", "get", "\\u", "instance", "\\u", "for", "\\u", "uuid_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "INSTANCE", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "dc", "nm", "\\u", "dhcp_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "port", "\\u", "create", "\\u", "event_", "(_", "port", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "output", "/", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "neut", "ron", "\\u", "event_", "._", "send", "\\u", "vm", "\\u", "info_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "neut", "ron", "\\u", "event_", "._", "send", "\\u", "vm", "\\u", "info_", "._", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "car", "gs_", ",_", "ck", "war", "gs_", "=_", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "car", "gs_", "[_", "0_", "]_", "==_", "FAKE", "\\u", "HOST", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "str_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "port_", "[_", "FAKE", "\\u", "PORT", "\\u", "ID_", "]_", ")_", "==_", "car", "gs_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "add", "\\u", "vms", "\\u", "db_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "add", "\\u", "vms", "\\u", "db_", "._", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "car", "gs_", ",_", "ck", "war", "gs_", "=_", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "port_", "[_", "FAKE", "\\u", "PORT", "\\u", "ID_", "]_", "==_", "car", "gs_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "constants_", "._", "RESU", "LT", "\\u", "SUCCESS_", "==_", "car", "gs_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "DF", "AS", "erver_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "port", "\\u", "delete", "\\u", "event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "case", " ", "for", " ", "port", " ", "delete", " ", "event", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vm_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "mac_", "=_", "FAKE", "\\u", "MAC", "\\u", "ADDR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "port", "\\u", "id_", "=_", "FAKE", "\\u", "PORT", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "segmentation", "\\u", "id_", "=_", "self_", "._", "seg", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "network", "\\u", "id_", "=_", "FAKE", "\\u", "NET", "WORK", "\\u", "ID_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "port", "\\u", "id_", "=_", "FAKE", "\\u", "PORT", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "ip_", "=_", "FAKE", "\\u", "IP", "\\u", "ADDR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "gw", "\\u", "mac_", "=_", "FAKE", "\\u", "GW", "\\u", "ADDR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "instance", "\\u", "id_", "=_", "FAKE", "\\u", "DEV", "ICE", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "fw", "d\\u", "mod_", "=_", "FAKE", "\\u", "FW", "D", "\\u", "MODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "host_", "=_", "FAKE", "\\u", "HOST", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm_", "._", "name_", "=_", "FAKE", "\\u", "INSTANCE", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "get", "\\u", "vm_", "._", "return", "\\u", "value_", "=_", "vm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm", "\\u", "info_", "=_", "dict_", "(_", "status_", "=_", "'", "down", "'_", ",_", "vm", "\\u", "mac_", "=_", "vm_", "._", "mac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "segmentation", "\\u", "id_", "=_", "vm_", "._", "segmentation", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "vm_", "._", "host_", ",_", "port", "\\u", "uuid_", "=_", "vm_", "._", "port", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "net", "\\u", "uuid_", "=_", "vm_", "._", "network", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ou", "i_", "=_", "dict_", "(_", "ip", "\\u", "addr_", "=_", "vm_", "._", "ip_", ",_", "vm", "\\u", "name_", "=_", "vm_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "uuid_", "=_", "vm_", "._", "instance", "\\u", "id_", ",_", "gw", "\\u", "mac_", "=_", "vm_", "._", "gw", "\\u", "mac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fw", "d\\u", "mod_", "=_", "vm_", "._", "fw", "d\\u", "mod_", ",_", "ou", "i", "\\u", "id_", "=_", "'", "cis", "co", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "info_", "=_", "{_", "'", "port", "\\u", "id", "'_", ":_", "FAKE", "\\u", "PORT", "\\u", "ID_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "output", "/", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "port", "\\u", "delete", "\\u", "event_", "(_", "port", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "dfa", "\\u", "server_", "._", "neut", "ron", "\\u", "event_", "._", "send", "\\u", "vm", "\\u", "info_", "._", "called_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "self_", "._", "dfa", "\\u", "server_", "._", "neut", "ron", "\\u", "event_", "._", "send", "\\u", "vm", "\\u", "info_", "._", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "car", "gs_", ",_", "ck", "war", "gs_", "=_", "call", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "car", "gs_", "[_", "0_", "]_", "==_", "FAKE", "\\u", "HOST", "\\u", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "str_", "(_", "vm", "\\u", "info_", ")_", "==_", "car", "gs_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dfa", "\\u", "server_", "._", "delete", "\\u", "vm", "\\u", "db_", "._", "assert", "\\u", "call", "ed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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 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
ipython/ipython-py3k/IPython/quarantine/ipy_completers.py
[ { "content": "\"\"\" Implementations for various useful completers\n\nSee extensions/ipy_stock_completers.py on examples of how to enable a completer,\nbut the basic idea is to do:\n\nip.set_hook('complete_command', svn_completer, str_key = 'svn')\n\nNOTE: some of the completers that used to be here, the ones used always by\ndefault (loaded before by ipy_stock_completers) have been moved into\ncore.completerlib, where they will be further cleaned up and maintained. The\nrest of this file would need to be well commented, cleaned up and tested for\ninclusion into the core.\n\"\"\"\n\nimport glob,os,shlex,sys\nimport inspect\nfrom time import time\nfrom zipimport import zipimporter\n\nfrom IPython.core import ipapi\nfrom IPython.core.error import TryNext\nip = ipapi.get()\n\n\n\nsvn_commands = \"\"\"\\\nadd blame praise annotate ann cat checkout co cleanup commit ci copy\ncp delete del remove rm diff di export help ? h import info list ls\nlock log merge mkdir move mv rename ren propdel pdel pd propedit pedit\npe propget pget pg proplist plist pl propset pset ps resolved revert\nstatus stat st switch sw unlock update\n\"\"\"\n\n\n\nhg_commands = \"\"\"\nadd addremove annotate archive backout branch branches bundle cat\nclone commit copy diff export grep heads help identify import incoming\ninit locate log manifest merge outgoing parents paths pull push\nqapplied qclone qcommit qdelete qdiff qfold qguard qheader qimport\nqinit qnew qnext qpop qprev qpush qrefresh qrename qrestore qsave\nqselect qseries qtop qunapplied recover remove rename revert rollback\nroot serve showconfig status strip tag tags tip unbundle update verify\nversion\n\"\"\"\n\n\n\n\n__bzr_commands = None\n\n\n\n\n \n \napt_commands = \"\"\"\\\nupdate upgrade install remove purge source build-dep dist-upgrade\ndselect-upgrade clean autoclean check\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def vcs_completer(commands, event):\n \"\"\" utility to make writing typical version control app completers easier\n\n VCS command line apps typically have the format:\n\n [sudo ]PROGNAME [help] [command] file file...\n\n \"\"\"\n\n\n cmd_param = event.line.split()\n if event.line.endswith(' '):\n cmd_param.append('')\n\n if cmd_param[0] == 'sudo':\n cmd_param = cmd_param[1:]\n\n if len(cmd_param) == 2 or 'help' in cmd_param:\n return commands.split()\n\n return ip.Completer.file_matches(event.symbol)", "metadata": "root.vcs_completer", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def svn_completer(self,event):\n return vcs_completer(svn_commands, event)", "metadata": "root.svn_completer", "header": "['module', '___EOS___']", "index": 54 }, { "content": "def hg_completer(self,event):\n \"\"\" Completer for mercurial commands \"\"\"\n\n return vcs_completer(hg_commands, event)", "metadata": "root.hg_completer", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def bzr_commands():\n global __bzr_commands\n if __bzr_commands is not None:\n return __bzr_commands\n out = os.popen('bzr help commands')\n __bzr_commands = [l.split()[0] for l in out]\n return __bzr_commands ", "metadata": "root.bzr_commands", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def bzr_completer(self,event):\n \"\"\" Completer for bazaar commands \"\"\"\n cmd_param = event.line.split()\n if event.line.endswith(' '):\n cmd_param.append('')\n\n if len(cmd_param) > 2:\n cmd = cmd_param[1]\n param = cmd_param[-1]\n output_file = (param == '--output=')\n if cmd == 'help':\n return bzr_commands()\n elif cmd in ['bundle-revisions','conflicts',\n 'deleted','nick','register-branch',\n 'serve','unbind','upgrade','version',\n 'whoami'] and not output_file:\n return []\n else:\n # the rest are probably file names\n return ip.Completer.file_matches(event.symbol)\n\n return bzr_commands()", "metadata": "root.bzr_completer", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def apt_get_packages(prefix):\n out = os.popen('apt-cache pkgnames')\n for p in out:\n if p.startswith(prefix):\n yield p.rstrip()", "metadata": "root.apt_get_packages", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def apt_completer(self, event):\n \"\"\" Completer for apt-get (uses apt-cache internally)\n\n \"\"\"\n\n\n cmd_param = event.line.split()\n if event.line.endswith(' '):\n cmd_param.append('')\n\n if cmd_param[0] == 'sudo':\n cmd_param = cmd_param[1:]\n\n if len(cmd_param) == 2 or 'help' in cmd_param:\n return apt_commands.split()\n\n return list(apt_get_packages(event.symbol))", "metadata": "root.apt_completer", "header": "['module', '___EOS___']", "index": 121 } ]
[ { "span": "import glob,os,shlex,sys", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 24 }, { "span": "import inspect", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 14 }, { "span": "from time import time", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 21 }, { "span": "from zipimport import zipimporter", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 33 }, { "span": "from IPython.core.error import TryNext", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "Implementation", "s", " ", "for", " ", "vari", "ous", " ", "usef", "ul", " ", "completer", "s", "\\", "10", ";", "\\", "10", ";", "See", " ", "extensi", "ons", "/", "ipy", "\\u", "stock", "\\u", "completer", "s", ".", "py", " ", "on", " ", "example", "s", " ", "of", " ", "how", " ", "to", " ", "enable", " ", "a", " ", "completer", ",", "\\", "10", ";", "but", " ", "the", " ", "basic", " ", "idea", " ", "is", " ", "to", " ", "do", ":", "\\", "10", ";", "\\", "10", ";", "ip", ".", "set\\u", "hook", "('", "complete", "\\u", "command", "',", " ", "svn", "\\u", "completer", ",", " ", "str", "\\u", "key", " ", "=", " ", "'", "svn", "')", "\\", "10", ";", "\\", "10", ";", "NOTE", ":", " ", "some", " ", "of", " ", "the", " ", "completer", "s", " ", "tha", "t", " ", "used", " ", "to", " ", "be", " ", "here", ",", " ", "the", " ", "ones", " ", "used", " ", "alw", "ay", "s", " ", "by", "\\", "10", ";", "default", " ", "(", "load", "ed", " ", "bef", "ore", " ", "by", " ", "ipy", "\\u", "stock", "\\u", "completer", "s", ")", " ", "have", " ", "bee", "n", " ", "moved", " ", "int", "o", "\\", "10", ";", "core", ".", "completer", "lib", ",", " ", "where", " ", "the", "y", " ", "will", " ", "be", " ", "fur", "ther", " ", "clean", "ed", " ", "up", " ", "and", " ", "maintain", "ed", ".", " ", " ", "The", "\\", "10", ";", "rest", " ", "of", " ", "this", " ", "file", " ", "wou", "ld", " ", "need", " ", "to", " ", "be", " ", "well", " ", "commente", "d", ",", " ", "clean", "ed", " ", "up", " ", "and", " ", "tested", " ", "for", "\\", "10", ";", "inclusion", " ", "int", "o", " ", "the", " ", "core", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "glob_", ",_", "os_", ",_", "shlex_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zip", "import_", "import_", "zip", "importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IP", "ython_", "._", "core_", "import_", "ipa", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "core_", "._", "error_", "import_", "Tr", "y", "Next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "ipa", "pi_", "._", "get_", "(_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "svn", "\\u", "commands_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "add", " ", "bla", "me", " ", "pra", "ise", " ", "annot", "ate", " ", "ann", " ", "cat", " ", "check", "out", " ", "co", " ", "clean", "up", " ", "commit", " ", "ci", " ", "copy", "\\", "10", ";", "cp", " ", "delete", " ", "del", " ", "remove", " ", "rm", " ", "diff", " ", "di", " ", "export", " ", "help", " ", "?", " ", "h", " ", "import", " ", "info", " ", "list", " ", "ls", "\\", "10", ";", "lock", " ", "log", " ", "merge", " ", "mkd", "ir", " ", "move", " ", "mv", " ", "rename", " ", "ren", " ", "prop", "del", " ", "pde", "l", " ", "pd", " ", "prop", "edit", " ", "pedi", "t", "\\", "10", ";", "pe", " ", "prop", "get", " ", "pge", "t", " ", "pg", " ", "prop", "list", " ", "plist", " ", "pl", " ", "props", "et", " ", "pset", " ", "ps", " ", "resolve", "d", " ", "revert", "\\", "10", ";", "status", " ", "stat", " ", "st", " ", "switch", " ", "sw", " ", "unlock", " ", "update", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hg", "\\u", "commands_", "=_", "\"\"\"", "\\", "10", ";", "add", " ", "addre", "move", " ", "annot", "ate", " ", "archive", " ", "back", "out", " ", "branch", " ", "branch", "es", " ", "bundle", " ", "cat", "\\", "10", ";", "clone", " ", "commit", " ", "copy", " ", "diff", " ", "export", " ", "grep", " ", "head", "s", " ", "help", " ", "identify", " ", "import", " ", "inco", "ming", "\\", "10", ";", "init", " ", "locat", "e", " ", "log", " ", "manifest", " ", "merge", " ", "outgoing", " ", "parents", " ", "path", "s", " ", "pull", " ", "push", "\\", "10", ";", "qa", "ppl", "ied", " ", "qc", "lone", " ", "qc", "ommit", " ", "qd", "ele", "te", " ", "qd", "iff", " ", "qf", "old", " ", "qg", "uar", "d", " ", "qh", "eader", " ", "qi", "mpor", "t", "\\", "10", ";", "qin", "it", " ", "qn", "ew", " ", "qn", "ext", " ", "qp", "op", " ", "qp", "rev", " ", "qp", "ush", " ", "qre", "fresh", " ", "qre", "name", " ", "qre", "store", " ", "qs", "ave", "\\", "10", ";", "qse", "lect", " ", "qse", "rie", "s", " ", "qt", "op", " ", "qu", "nap", "pli", "ed", " ", "recover", " ", "remove", " ", "rename", " ", "revert", " ", "rollback", "\\", "10", ";", "root", " ", "serve", " ", "show", "config", " ", "status", " ", "strip", " ", "tag", " ", "tags", " ", "tip", " ", "unb", "und", "le", " ", "update", " ", "verify", "\\", "10", ";", "version", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "bzr", "\\u", "commands_", "=_", "None_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "apt", "\\u", "commands_", "=_", "\"\"\"", "\\\\", "\\", "10", ";", "update", " ", "upgrade", " ", "install", " ", "remove", " ", "pur", "ge", " ", "source", " ", "build", "-", "dep", " ", "dist", "-", "upgrade", "\\", "10", ";", "dse", "lect", "-", "upgrade", " ", "clean", " ", "autocl", "ean", " ", "check", "\"\"\"_", "\\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_", "vcs", "\\u", "completer_", "(_", "commands_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "utility", " ", "to", " ", "make", " ", "writ", "ing", " ", "typical", " ", "version", " ", "control", " ", "app", " ", "completer", "s", " ", "easi", "er", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "VCS", " ", "command", " ", "line", " ", "apps", " ", "typical", "ly", " ", "have", " ", "the", " ", "format", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "[", "sudo", " ", "]", "PROG", "NAME", " ", "[", "help", "]", " ", "[", "command", "]", " ", "file", " ", "file", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "\\u", "param_", "=_", "event_", "._", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "line_", "._", "endswith_", "(_", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "param_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd", "\\u", "param_", "[_", "0_", "]_", "==_", "'", "sudo", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "param_", "=_", "cmd", "\\u", "param_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "cmd", "\\u", "param_", ")_", "==_", "2_", "or_", "'", "help", "'_", "in_", "cmd", "\\u", "param_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "commands_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ip_", "._", "Completer_", "._", "file", "\\u", "matches_", "(_", "event_", "._", "symbol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "svn", "\\u", "completer_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "vcs", "\\u", "completer_", "(_", "svn", "\\u", "commands_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "hg", "\\u", "completer_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Complete", "r", " ", "for", " ", "mercur", "ial", " ", "command", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "vcs", "\\u", "completer_", "(_", "hg", "\\u", "commands_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bzr", "\\u", "commands_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u\\u", "bzr", "\\u", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "bzr", "\\u", "commands_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u", "bzr", "\\u", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "os_", "._", "popen_", "(_", "'", "bzr", " ", "help", " ", "command", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "bzr", "\\u", "commands_", "=_", "[_", "l_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "for_", "l_", "in_", "out_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u", "bzr", "\\u", "commands_", "\\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_", "bzr", "\\u", "completer_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Complete", "r", " ", "for", " ", "ba", "za", "ar", " ", "command", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "param_", "=_", "event_", "._", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "line_", "._", "endswith_", "(_", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "param_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "cmd", "\\u", "param_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "cmd", "\\u", "param_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param_", "=_", "cmd", "\\u", "param_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "(_", "param_", "==_", "'--", "output", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmd_", "==_", "'", "help", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bzr", "\\u", "commands_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd_", "in_", "[_", "'", "bundle", "-", "revis", "ion", "s", "'_", ",_", "'", "confl", "icts", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ",_", "'", "nick", "'_", ",_", "'", "register", "-", "branch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "serve", "'_", ",_", "'", "unbind", "'_", ",_", "'", "upgrade", "'_", ",_", "'", "version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "who", "ami", "'_", "]_", "and_", "not_", "output", "\\u", "file_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "rest", " ", "are", " ", "probab", "ly", " ", "file", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ip_", "._", "Completer_", "._", "file", "\\u", "matches_", "(_", "event_", "._", "symbol_", ")_", "\\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_", "bzr", "\\u", "commands_", "(_", ")_", "\\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_", "apt", "\\u", "get", "\\u", "packages_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "os_", "._", "popen_", "(_", "'", "apt", "-", "cache", " ", "pkg", "names", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "out_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "._", "startswith_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "p_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "apt", "\\u", "completer_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Complete", "r", " ", "for", " ", "apt", "-", "get", " ", "(", "use", "s", " ", "apt", "-", "cache", " ", "internal", "ly", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "\\u", "param_", "=_", "event_", "._", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "line_", "._", "endswith_", "(_", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "param_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd", "\\u", "param_", "[_", "0_", "]_", "==_", "'", "sudo", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "param_", "=_", "cmd", "\\u", "param_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "cmd", "\\u", "param_", ")_", "==_", "2_", "or_", "'", "help", "'_", "in_", "cmd", "\\u", "param_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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, 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, 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 ]
Unused local variable
CybOXProject/python-cybox/cybox/bindings/volume_object.py
[ { "content": " def exportChildren(self, lwrite, level, namespace_='VolumeObj:', name_='FileSystemFlagListType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for File_System_Flag_ in self.File_System_Flag:\n File_System_Flag_.export(lwrite, level, 'VolumeObj:', name_='File_System_Flag', pretty_print=pretty_print)", "metadata": "root.FileSystemFlagListType.exportChildren", "header": "['class', 'FileSystemFlagListType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 112 }, { "content": " def exportChildren(self, lwrite, level, namespace_='VolumeObj:', name_='VolumeObjectType', fromsubclass_=False, pretty_print=True):\n super(VolumeObjectType, self).exportChildren(lwrite, level, 'VolumeObj:', name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Name is not None:\n self.Name.export(lwrite, level, 'VolumeObj:', name_='Name', pretty_print=pretty_print)\n if self.Device_Path is not None:\n self.Device_Path.export(lwrite, level, 'VolumeObj:', name_='Device_Path', pretty_print=pretty_print)\n if self.File_System_Type is not None:\n self.File_System_Type.export(lwrite, level, 'VolumeObj:', name_='File_System_Type', pretty_print=pretty_print)\n if self.Total_Allocation_Units is not None:\n self.Total_Allocation_Units.export(lwrite, level, 'VolumeObj:', name_='Total_Allocation_Units', pretty_print=pretty_print)\n if self.Sectors_Per_Allocation_Unit is not None:\n self.Sectors_Per_Allocation_Unit.export(lwrite, level, 'VolumeObj:', name_='Sectors_Per_Allocation_Unit', pretty_print=pretty_print)\n if self.Bytes_Per_Sector is not None:\n self.Bytes_Per_Sector.export(lwrite, level, 'VolumeObj:', name_='Bytes_Per_Sector', pretty_print=pretty_print)\n if self.Actual_Available_Allocation_Units is not None:\n self.Actual_Available_Allocation_Units.export(lwrite, level, 'VolumeObj:', name_='Actual_Available_Allocation_Units', pretty_print=pretty_print)\n if self.Creation_Time is not None:\n self.Creation_Time.export(lwrite, level, 'VolumeObj:', name_='Creation_Time', pretty_print=pretty_print)\n if self.File_System_Flag_List is not None:\n self.File_System_Flag_List.export(lwrite, level, 'VolumeObj:', name_='File_System_Flag_List', pretty_print=pretty_print)\n if self.Serial_Number is not None:\n self.Serial_Number.export(lwrite, level, 'VolumeObj:', name_='Serial_Number', pretty_print=pretty_print)", "metadata": "root.VolumeObjectType.exportChildren", "header": "['class', 'VolumeObjectType', '(', 'cybox_common', '.', 'ObjectPropertiesType', ')', ':', '___EOS___']", "index": 308 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Volume'\n rootClass = VolumeObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=rootTag,\n# namespacedef_='',\n# pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 511 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Volume'\n rootClass = VolumeObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 528 }, { "content": "def parseString(inString):\n from mixbox.vendor.six import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Volume'\n rootClass = VolumeObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=\"Volume\",\n# namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 546 } ]
[ { "span": "eol_ ", "start_line": 114, "start_column": 12, "end_line": 114, "end_column": 16 }, { "span": "eol_ ", "start_line": 116, "start_column": 12, "end_line": 116, "end_column": 16 }, { "span": "eol_ ", "start_line": 311, "start_column": 12, "end_line": 311, "end_column": 16 }, { "span": "eol_ ", "start_line": 313, "start_column": 12, "end_line": 313, "end_column": 16 }, { "span": "rootTag ", "start_line": 516, "start_column": 8, "end_line": 516, "end_column": 15 }, { "span": "doc ", "start_line": 521, "start_column": 4, "end_line": 521, "end_column": 7 }, { "span": "doc ", "start_line": 538, "start_column": 4, "end_line": 538, "end_column": 7 }, { "span": "rootTag ", "start_line": 552, "start_column": 8, "end_line": 552, "end_column": 15 }, { "span": "doc ", "start_line": 557, "start_column": 4, "end_line": 557, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "File", "System", "Fla", "g", "List", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "File", "System", "Fla", "g", "List", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "File", "\\u", "System", "\\u", "Fla", "g", "\\u_", "in_", "self_", "._", "File", "\\u", "System", "\\u", "Flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "File", "\\u", "System", "\\u", "Fla", "g", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "File", "\\u", "System", "\\u", "Fla", "g", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Volume", "Object", "Type_", "(_", "cy", "box", "\\u", "common_", "._", "Object", "Proper", "ties", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Volume", "Object", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Volume", "Object", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\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 ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Name_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Name", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Dev", "ice", "\\u", "Path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Dev", "ice", "\\u", "Path_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Dev", "ice", "\\u", "Path", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "File", "\\u", "System", "\\u", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "File", "\\u", "System", "\\u", "Type_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "File", "\\u", "System", "\\u", "Type", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Total", "\\u", "Allocati", "on", "\\u", "Units_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Total", "\\u", "Allocati", "on", "\\u", "Units_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Total", "\\u", "Allocati", "on", "\\u", "Unit", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Sect", "ors", "\\u", "Per", "\\u", "Allocati", "on", "\\u", "Unit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Sect", "ors", "\\u", "Per", "\\u", "Allocati", "on", "\\u", "Unit_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Sect", "ors", "\\u", "Per", "\\u", "Allocati", "on", "\\u", "Unit", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Byte", "s", "\\u", "Per", "\\u", "Sect", "or_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Byte", "s", "\\u", "Per", "\\u", "Sect", "or_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Byte", "s", "\\u", "Per", "\\u", "Sect", "or", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Actual", "\\u", "Avail", "able", "\\u", "Allocati", "on", "\\u", "Units_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Actual", "\\u", "Avail", "able", "\\u", "Allocati", "on", "\\u", "Units_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Actual", "\\u", "Avail", "able", "\\u", "Allocati", "on", "\\u", "Unit", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Creat", "ion", "\\u", "Time_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Creat", "ion", "\\u", "Time_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Creat", "ion", "\\u", "Time", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "File", "\\u", "System", "\\u", "Fla", "g", "\\u", "List_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "File", "\\u", "System", "\\u", "Fla", "g", "\\u", "List_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "File", "\\u", "System", "\\u", "Fla", "g", "\\u", "List", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Ser", "ial", "\\u", "Number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Ser", "ial", "\\u", "Number_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Volume", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Ser", "ial", "\\u", "Number", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\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_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Volume", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Volume", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=", "root", "Ta", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\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", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Volume", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Volume", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "Element_", "\\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", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mix", "box_", "._", "vendor_", "._", "six_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Volume", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Volume", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=\"", "Volume", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
projectatomic/atomic-reactor/tests/test_tasker.py
[ { "content": "def test_tag_image_same_name(temp_image_name):\n if MOCK:\n mock_docker()\n\n t = DockerTasker()\n temp_image_name.registry = \"somewhere.example.com\"\n temp_image_name.tag = \"1\"\n flexmock(t.d).should_receive('tag').never()\n img = t.tag_image(temp_image_name, temp_image_name.copy())", "metadata": "root.test_tag_image_same_name", "header": "['module', '___EOS___']", "index": 175 }, { "content": "@pytest.mark.parametrize(('should_fail',), [\n (True, ),\n (False, ),\n])\ndef test_push_image(temp_image_name, should_fail):\n if MOCK:\n mock_docker(push_should_fail=should_fail)\n\n t = DockerTasker()\n temp_image_name.registry = LOCALHOST_REGISTRY\n temp_image_name.tag = \"1\"\n t.tag_image(INPUT_IMAGE, temp_image_name)\n if should_fail:\n with pytest.raises(RuntimeError) as exc:\n output = t.push_image(temp_image_name, insecure=True)\n assert \"Failed to push image\" in str(exc)\n else:\n output = t.push_image(temp_image_name, insecure=True)\n assert output is not None\n t.remove_image(temp_image_name)", "metadata": "root.test_push_image", "header": "['module', '___EOS___']", "index": 186 }, { "content": "@pytest.mark.parametrize(('timeout', 'expected_timeout'), [\n (None, 120),\n (60, 60),\n])\ndef test_timeout(timeout, expected_timeout):\n (flexmock(docker.Client)\n .should_receive('__init__')\n .with_args(version=str, timeout=expected_timeout))\n\n kwargs = {}\n if timeout is not None:\n kwargs['timeout'] = timeout\n\n t = DockerTasker(**kwargs)", "metadata": "root.test_timeout", "header": "['module', '___EOS___']", "index": 321 } ]
[ { "span": "img ", "start_line": 183, "start_column": 4, "end_line": 183, "end_column": 7 }, { "span": "output ", "start_line": 200, "start_column": 12, "end_line": 200, "end_column": 18 }, { "span": "t ", "start_line": 334, "start_column": 4, "end_line": 334, "end_column": 5 } ]
[]
1
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_", "test\\u", "tag", "\\u", "image", "\\u", "same", "\\u", "name_", "(_", "temp", "\\u", "image", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "MOC", "K_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "docker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "Docke", "r", "Task", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "image", "\\u", "name_", "._", "registry_", "=_", "\"", "some", "where", ".", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "image", "\\u", "name_", "._", "tag_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flex", "mock_", "(_", "t_", "._", "d_", ")_", "._", "shou", "ld", "\\u", "receive_", "(_", "'", "tag", "'_", ")_", "._", "neve", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "t_", "._", "tag", "\\u", "image_", "(_", "temp", "\\u", "image", "\\u", "name_", ",_", "temp", "\\u", "image", "\\u", "name_", "._", "copy_", "(_", ")_", ")_", "\\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_", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "(_", "'", "shou", "ld", "\\u", "fail", "'_", ",_", ")_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "True_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "False_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "push", "\\u", "image_", "(_", "temp", "\\u", "image", "\\u", "name_", ",_", "shou", "ld", "\\u", "fail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "MOC", "K_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "docker_", "(_", "push", "\\u", "shou", "ld", "\\u", "fail_", "=_", "shou", "ld", "\\u", "fail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "Docke", "r", "Task", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "image", "\\u", "name_", "._", "registry_", "=_", "LOCAL", "HOST", "\\u", "REGISTRY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "image", "\\u", "name_", "._", "tag_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "tag", "\\u", "image_", "(_", "INPUT", "\\u", "IMAGE_", ",_", "temp", "\\u", "image", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shou", "ld", "\\u", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Run", "time", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "t_", "._", "push", "\\u", "image_", "(_", "temp", "\\u", "image", "\\u", "name_", ",_", "insecure", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "\"", "Fail", "ed", " ", "to", " ", "push", " ", "image", "\"_", "in_", "str_", "(_", "exc_", ")_", "\\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 ", " _", "output_", "=_", "t_", "._", "push", "\\u", "image_", "(_", "temp", "\\u", "image", "\\u", "name_", ",_", "insecure", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "output_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "remove", "\\u", "image_", "(_", "temp", "\\u", "image", "\\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_", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "(_", "'", "timeo", "ut", "'_", ",_", "'", "expected", "\\u", "timeo", "ut", "'_", ")_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "120_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "60_", ",_", "60_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "timeout_", "(_", "timeout_", ",_", "expected", "\\u", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "flex", "mock_", "(_", "docker_", "._", "Client_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "shou", "ld", "\\u", "receive_", "(_", "'\\u", "\\u", "init", "\\u\\u'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "with", "\\u", "args_", "(_", "version_", "=_", "str_", ",_", "timeout_", "=_", "expected", "\\u", "timeout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "timeo", "ut", "'_", "]_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "Docke", "r", "Task", "er_", "(_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 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, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
jawerty/AlienFeed/alienfeed/alien.py
[ { "content": "def subreddit_viewer(submission_list):\n links = submission_getter(submission_list, verbose = True)", "metadata": "root.subreddit_viewer", "header": "['module', '___EOS___']", "index": 121 }, { "content": "def parse_range(string):\n try:\n splitted = string.split('..');\n if (len(splitted) != 2):\n raise ArgumentTypeError(\"'\" + string + \"' is not a valid range. Expected forms like '1..5'\")\n\n start = int(splitted[0])\n end = int(splitted[1])\n\n return splitted\n except ValueError:\n raise ArgumentTypeError(\"Range values are not valid integers. Expected forms like '1..5'\")", "metadata": "root.parse_range", "header": "['module', '___EOS___']", "index": 148 }, { "content": "def main():\n parser = _parser(description='''AlienFeed, by Jared Wright, is a\n commandline application made for displaying and\n interacting with recent Reddit links. I DO NOT HAVE\n ANY AFILIATION WITH REDDIT, I AM JUST A HACKER''')\n\n parser.add_argument(\"-l\", \"--limit\", type=int, default=10,\n help='Limits output (default output is 10 links)')\n parser.add_argument(\"subreddit\", default='front',\n help=\"Returns top links from subreddit 'front' \"\n \"returns the front page\")\n parser.add_argument(\"-o\", \"--open\", type=int,\n help='Opens one link that matches the number '\n 'inputted. Chosen by number')\n parser.add_argument(\"-or\", \"--openrange\", type=parse_range,\n help=\"Opens a range of links of the form 'x..y', \"\n \"where 'x' and 'y' are chosen numbers\")\n parser.add_argument(\"-s\", \"--self\", action=\"store_true\",\n help=\"Displays the self text of a post\")\n parser.add_argument(\"-r\", \"--random\", action='store_true',\n help='Opens a random link (must be the only '\n 'optional argument)')\n parser.add_argument(\"-U\", \"--update\", action='store_true',\n help='Automatically updates AlienFeed via pip')\n\n\n # if only 1 argument, print the help\n if len(sys.argv) == 1:\n parser.print_help()\n sys.exit(1)\n\n # else, get the arguments\n args = parser.parse_args()\n\n subm_gen = None\n\n # This holds the opened submissions, to further do operations on them (e.g. --self)\n chosen_submissions = []\n\n # Do acion depending on the passed arguments\n # Open range of submissions case\n if args.openrange:\n if args.open or args.random:\n print_warning(\"You cannot use [-or OPENRANGE] with [-o OPEN] or with [-r RANDOM]\")\n sys.exit(1)\n else:\n start = int(args.openrange[0])\n end = int(args.openrange[1])\n\n # ensure end is not above the limit\n if end > args.limit:\n print_warning(\"The upper range limit you typed was out of the feed's range\"\n \" (try to pick a number between 1 and 10 or add --limit {0})\")\n sys.exit(1)\n else:\n end += 1 # add 1 to include upper end of range\n\n # Get the submissions for the subreddit\n submissions = get_submissions_from_subreddit(args.subreddit, args.limit)\n\n print_colorized(\"Viewing a range of submissions\\n\")\n\n for x in range(start, end):\n # Chosen submission\n chosen = submissions[x - 1]\n\n # Save the chosen submission\n chosen_submissions.append(chosen)\n\n # Open the link\n webbrowser.open(chosen.url)\n\n # Invalid case\n elif args.open and args.random:\n print_warning(\"You cannot use [-o OPEN] with [-r RANDOM]\")\n sys.exit(1)\n\n # Open a certain submisison case\n elif args.open:\n try:\n # Get the submissions for the subreddit\n submissions = get_submissions_from_subreddit(args.subreddit, args.limit)\n\n print_colorized(\"Viewing a submission\\n\")\n\n # Save chosen submission\n chosen_submissions.append(submissions[args.open - 1]);\n\n # Open desired link\n webbrowser.open(submissions[args.open - 1].url)\n except IndexError, e:\n print_warning(\"The number you typed in was out of the feed's range\"\n \" (try to pick a number between 1 and 10 or add\"\n \" --limit {0})\".format(e), \"IndexError:\", e)\n\n # Random submission case\n elif args.random:\n if args.limit == 10:\n if args.subreddit == 'front':\n front = r.get_front_page(limit = 200)\n submissions = submission_getter(front)\n else:\n top = r.get_subreddit(args.subreddit).get_top(limit = 200)\n new = r.get_subreddit(args.subreddit).get_new(limit = 200)\n hot = r.get_subreddit(args.subreddit).get_hot(limit = 200)\n submissions = submission_getter(top)\n submissions.extend(submission_getter(new))\n submissions.extend(submission_getter(hot))\n\n try:\n # Get a random submission\n chosen = random.choice(submissions)\n\n # Save the chosen submission\n chosen_submissions.append(chosen)\n\n # Open the link\n webbrowser.open( chosen.url )\n print_colorized(\"Viewing a random submission\\n\")\n\n except IndexError, e:\n print_warning(\"There was an error with your input. \"\n \"Hint: Perhaps the subreddit you chose was \"\n \"too small to run through the program\",\n \"IndexError:\", e)\n else:\n print_warning(\"You cannot use [-l LIMIT] with [-r RANDOM] \"\n \"(unless the limit is 10)\")\n sys.exit(1)\n\n # Default case is listing Top 'limit' elements\n else:\n if args.subreddit == 'front':\n submission_list = list(r.get_front_page(limit=args.limit))\n print_colorized('Top {0} front page links:'.format(args.limit))\n else:\n submission_list = list(r.get_subreddit(args.subreddit).get_hot(limit=args.limit))\n print_colorized('Top {0} /r/{1} links:'.format(args.limit, args.subreddit))\n\n try:\n # Save them to the chosen submissions\n chosen_submissions.extend(submission_list)\n\n # Display the Submissions\n subreddit_viewer(submission_list)\n except praw.errors.InvalidSubreddit, e:\n print_warning(\"I'm sorry but the subreddit '{0}' does not exist; \"\n \"try again.\".format(args.subreddit), \"InvalidSubreddit:\", e)\n\n # Self post case\n if args.self:\n print_colorized(\"Selft text of submission(s):\")\n for i, submission in enumerate(chosen_submissions):\n print color.OKGREEN, \"[\" + str(i) + \"] -> \", color.OKBLUE, submission.selftext, color.ENDC\n\n # Update AlienFeed case\n if args.update == True:\n try:\n print \"Upgrading AlienFeed...\"\n call(['pip', 'install', 'alienfeed', '--upgrade', '--quiet'])\n except OSError, e:\n print_warning(\"You cannot use -U without having pip installed.\")", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 162 } ]
[ { "span": "links ", "start_line": 122, "start_column": 4, "end_line": 122, "end_column": 9 }, { "span": "start ", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 13 }, { "span": "end ", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 11 }, { "span": "subm_gen ", "start_line": 196, "start_column": 4, "end_line": 196, "end_column": 12 } ]
[]
1
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_", "def_", "subred", "dit", "\\u", "viewer_", "(_", "subm", "ission", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "links_", "=_", "subm", "ission", "\\u", "getter_", "(_", "subm", "ission", "\\u", "list_", ",_", "verbose_", "=_", "True_", ")_", "\\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", "range_", "(_", "string_", ")_", ":_", "\\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 ", " _", "splitted_", "=_", "string_", "._", "split_", "(_", "'..'_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "splitted_", ")_", "!=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Arg", "ument", "Type", "Error_", "(_", "\"'\"_", "+_", "string_", "+_", "\"'", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "range", ".", " ", "Expect", "ed", " ", "forms", " ", "like", " ", "'", "1", "..", "5", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", "=_", "int_", "(_", "splitted_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "int_", "(_", "splitted_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "splitted_", "\\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_", "Arg", "ument", "Type", "Error_", "(_", "\"", "Range", " ", "values", " ", "are", " ", "not", " ", "valid", " ", "integ", "ers", ".", " ", "Expect", "ed", " ", "forms", " ", "like", " ", "'", "1", "..", "5", "'\"_", ")_", "\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "\\u", "parser_", "(_", "description_", "=_", "'''", "Ali", "en", "Feed", ",", " ", "by", " ", "Jar", "ed", " ", "Wr", "ight", ",", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", "commandline", " ", "applica", "tion", " ", "made", " ", "for", " ", "display", "ing", " ", "and", "\\", "10", ";", " ", " ", " ", "interacti", "ng", " ", "with", " ", "recent", " ", "Reddit", " ", "link", "s", ".", " ", "I", " ", "DO", " ", "NOT", " ", "HA", "VE", "\\", "10", ";", " ", " ", " ", "ANY", " ", "AF", "ILI", "ATION", " ", "WITH", " ", "RED", "DI", "T", ",", " ", "I", " ", "AM", " ", "JU", "ST", " ", "A", " ", "HA", "CK", "ER", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "l", "\"_", ",_", "\"--", "limit", "\"_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Limit", "s", " ", "output", " ", "(", "default", " ", "output", " ", "is", " ", "10", " ", "link", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"", "subred", "dit", "\"_", ",_", "default_", "=_", "'", "front", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Return", "s", " ", "top", " ", "link", "s", " ", "from", " ", "subred", "dit", " ", "'", "front", "'", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "return", "s", " ", "the", " ", "front", " ", "page", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "o", "\"_", ",_", "\"--", "open", "\"_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Opens", " ", "one", " ", "link", " ", "tha", "t", " ", "matche", "s", " ", "the", " ", "number", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "input", "ted", ".", " ", "Cho", "sen", " ", "by", " ", "number", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "or", "\"_", ",_", "\"--", "open", "range", "\"_", ",_", "type_", "=_", "parse", "\\u", "range_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Opens", " ", "a", " ", "range", " ", "of", " ", "link", "s", " ", "of", " ", "the", " ", "form", " ", "'", "x", "..", "y", "',", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "where", " ", "'", "x", "'", " ", "and", " ", "'", "y", "'", " ", "are", " ", "chosen", " ", "numbers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "s", "\"_", ",_", "\"--", "self", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Display", "s", " ", "the", " ", "self", " ", "text", " ", "of", " ", "a", " ", "post", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "r", "\"_", ",_", "\"--", "random", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Opens", " ", "a", " ", "random", " ", "link", " ", "(", "must", " ", "be", " ", "the", " ", "only", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "option", "al", " ", "argu", "ment", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"-", "U", "\"_", ",_", "\"--", "update", "\"_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Automat", "ical", "ly", " ", "update", "s", " ", "Ali", "en", "Feed", " ", "via", " ", "pip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "only", " ", "1", " ", "argu", "ment", ",", " ", "print", " ", "the", " ", "help_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", ",", " ", "get", " ", "the", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subm", "\\u", "gen_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "hold", "s", " ", "the", " ", "opene", "d", " ", "subm", "ission", "s", ",", " ", "to", " ", "fur", "ther", " ", "do", " ", "operati", "ons", " ", "on", " ", "them", " ", "(", "e", ".", "g", ".", " ", "--", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "chosen", "\\u", "submissions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "acion", " ", "depend", "ing", " ", "on", " ", "the", " ", "pass", "ed", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "range", " ", "of", " ", "subm", "ission", "s", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "open", "range_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "open_", "or_", "args_", "._", "random_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "You", " ", "cann", "ot", " ", "use", " ", "[-", "or", " ", "OPEN", "RANGE", "]", " ", "with", " ", "[-", "o", " ", "OPEN", "]", " ", "or", " ", "with", " ", "[-", "r", " ", "RANDOM", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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_", "=_", "int_", "(_", "args_", "._", "open", "range_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "int_", "(_", "args_", "._", "open", "range_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "end", " ", "is", " ", "not", " ", "above", " ", "the", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "end_", ">_", "args_", "._", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "The", " ", "upper", " ", "range", " ", "limit", " ", "you", " ", "typed", " ", "was", " ", "out", " ", "of", " ", "the", " ", "feed", "'", "s", " ", "range", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "try", " ", "to", " ", "pick", " ", "a", " ", "number", " ", "bet", "ween", " ", "1", " ", "and", " ", "10", " ", "or", " ", "add", " ", "--", "limit", " ", "{", "0", "})\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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 ", " _", "end_", "+=_", "1_", "#", " ", "add", " ", "1", " ", "to", " ", "include", " ", "upper", " ", "end", " ", "of", " ", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "subm", "ission", "s", " ", "for", " ", "the", " ", "subreddit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "submissions_", "=_", "get", "\\u", "subm", "ission", "s", "\\u", "from", "\\u", "subreddit_", "(_", "args_", "._", "subreddit_", ",_", "args_", "._", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "coloriz", "ed_", "(_", "\"", "View", "ing", " ", "a", " ", "range", " ", "of", " ", "subm", "ission", "s", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cho", "sen", " ", "submission_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "_", "=_", "submissions_", "[_", "x_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "chosen", " ", "submission_", "\\u\\u\\uNL\\u\\u\\u_", "chosen", "\\u", "submissions_", "._", "append_", "(_", "chosen", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "the", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "webbrowser_", "._", "open_", "(_", "chosen", "_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "open_", "and_", "args_", "._", "random_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "You", " ", "cann", "ot", " ", "use", " ", "[-", "o", " ", "OPEN", "]", " ", "with", " ", "[-", "r", " ", "RANDOM", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "a", " ", "cert", "ain", " ", "subm", "isi", "son", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "open_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "subm", "ission", "s", " ", "for", " ", "the", " ", "subreddit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submissions_", "=_", "get", "\\u", "subm", "ission", "s", "\\u", "from", "\\u", "subreddit_", "(_", "args_", "._", "subreddit_", ",_", "args_", "._", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "coloriz", "ed_", "(_", "\"", "View", "ing", " ", "a", " ", "subm", "ission", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "chosen", " ", "submission_", "\\u\\u\\uNL\\u\\u\\u_", "chosen", "\\u", "submissions_", "._", "append_", "(_", "submissions_", "[_", "args_", "._", "open_", "-_", "1_", "]_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "desi", "red", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "webbrowser_", "._", "open_", "(_", "submissions_", "[_", "args_", "._", "open_", "-_", "1_", "]_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "The", " ", "number", " ", "you", " ", "typed", " ", "in", " ", "was", " ", "out", " ", "of", " ", "the", " ", "feed", "'", "s", " ", "range", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "try", " ", "to", " ", "pick", " ", "a", " ", "number", " ", "bet", "ween", " ", "1", " ", "and", " ", "10", " ", "or", " ", "add", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "--", "limit", " ", "{", "0", "})\"_", "._", "format_", "(_", "e_", ")_", ",_", "\"", "Index", "Error", ":\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Random", " ", "subm", "ission", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "random_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "limit_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "subreddit_", "==_", "'", "front", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "front_", "=_", "r_", "._", "get", "\\u", "front", "\\u", "page_", "(_", "limit_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submissions_", "=_", "subm", "ission", "\\u", "getter_", "(_", "front_", ")_", "\\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 ", " _", "top_", "=_", "r_", "._", "get", "\\u", "subreddit_", "(_", "args_", "._", "subreddit_", ")_", "._", "get", "\\u", "top_", "(_", "limit_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "r_", "._", "get", "\\u", "subreddit_", "(_", "args_", "._", "subreddit_", ")_", "._", "get", "\\u", "new_", "(_", "limit_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hot_", "=_", "r_", "._", "get", "\\u", "subreddit_", "(_", "args_", "._", "subreddit_", ")_", "._", "get", "\\u", "hot_", "(_", "limit_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submissions_", "=_", "subm", "ission", "\\u", "getter_", "(_", "top_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submissions_", "._", "extend_", "(_", "subm", "ission", "\\u", "getter_", "(_", "new_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submissions_", "._", "extend_", "(_", "subm", "ission", "\\u", "getter_", "(_", "hot_", ")_", ")_", "\\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_", "#", " ", "Get", " ", "a", " ", "random", " ", "submission_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "_", "=_", "random_", "._", "choice_", "(_", "submissions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "chosen", " ", "submission_", "\\u\\u\\uNL\\u\\u\\u_", "chosen", "\\u", "submissions_", "._", "append_", "(_", "chosen", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "the", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "webbrowser_", "._", "open_", "(_", "chosen", "_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "coloriz", "ed_", "(_", "\"", "View", "ing", " ", "a", " ", "random", " ", "subm", "ission", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "There", " ", "was", " ", "an", " ", "error", " ", "with", " ", "your", " ", "input", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Hint", ":", " ", "Per", "hap", "s", " ", "the", " ", "subred", "dit", " ", "you", " ", "chos", "e", " ", "was", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "too", " ", "small", " ", "to", " ", "run", " ", "through", " ", "the", " ", "program", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Index", "Error", ":\"_", ",_", "e_", ")_", "\\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 ", " _", "print", "\\u", "warning_", "(_", "\"", "You", " ", "cann", "ot", " ", "use", " ", "[-", "l", " ", "LIMIT", "]", " ", "with", " ", "[-", "r", " ", "RANDOM", "]", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "unl", "ess", " ", "the", " ", "limit", " ", "is", " ", "10", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "case", " ", "is", " ", "listi", "ng", " ", "Top", " ", "'", "limit", "'", " ", "elements_", "\\u\\u\\uNL\\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_", "args_", "._", "subreddit_", "==_", "'", "front", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subm", "ission", "\\u", "list_", "=_", "list_", "(_", "r_", "._", "get", "\\u", "front", "\\u", "page_", "(_", "limit_", "=_", "args_", "._", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "coloriz", "ed_", "(_", "'", "Top", " ", "{", "0", "}", " ", "front", " ", "page", " ", "link", "s", ":'_", "._", "format_", "(_", "args_", "._", "limit_", ")_", ")_", "\\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 ", " _", "subm", "ission", "\\u", "list_", "=_", "list_", "(_", "r_", "._", "get", "\\u", "subreddit_", "(_", "args_", "._", "subreddit_", ")_", "._", "get", "\\u", "hot_", "(_", "limit_", "=_", "args_", "._", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "coloriz", "ed_", "(_", "'", "Top", " ", "{", "0", "}", " ", "/", "r", "/{", "1", "}", " ", "link", "s", ":'_", "._", "format_", "(_", "args_", "._", "limit_", ",_", "args_", "._", "subreddit_", ")_", ")_", "\\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_", "#", " ", "Save", " ", "them", " ", "to", " ", "the", " ", "chosen", " ", "submissions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "\\u", "submissions_", "._", "extend_", "(_", "subm", "ission", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Display", " ", "the", " ", "Subm", "ission", "s_", "\\u\\u\\uNL\\u\\u\\u_", "subred", "dit", "\\u", "viewer_", "(_", "subm", "ission", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "praw", "_", "._", "errors_", "._", "Inva", "lid", "Subr", "eddi", "t_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "I", "'", "m", " ", "sorr", "y", " ", "but", " ", "the", " ", "subred", "dit", " ", "'{", "0", "}'", " ", "doe", "s", " ", "not", " ", "exist", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "try", " ", "again", ".\"_", "._", "format_", "(_", "args_", "._", "subreddit_", ")_", ",_", "\"", "Inva", "lid", "Subr", "eddi", "t", ":\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Self", " ", "post", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "coloriz", "ed_", "(_", "\"", "Self", "t", " ", "text", " ", "of", " ", "subm", "ission", "(", "s", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "submission_", "in_", "enumerate_", "(_", "chosen", "\\u", "submissions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "color_", "._", "OK", "GREEN_", ",_", "\"[\"_", "+_", "str_", "(_", "i_", ")_", "+_", "\"]", " ", "->", " ", "\"_", ",_", "color_", "._", "OK", "BLUE_", ",_", "submission_", "._", "self", "text_", ",_", "color_", "._", "ENDC_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "Ali", "en", "Feed", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "update_", "==_", "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 ", " _", "print_", "\"", "Up", "gradi", "ng", " ", "Ali", "en", "Feed", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call_", "(_", "[_", "'", "pip", "'_", ",_", "'", "install", "'_", ",_", "'", "alie", "nfe", "ed", "'_", ",_", "'--", "upgrade", "'_", ",_", "'--", "quie", "t", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "warning_", "(_", "\"", "You", " ", "cann", "ot", " ", "use", " ", "-", "U", " ", "with", "out", " ", "hav", "ing", " ", "pip", " ", "install", "ed", ".\"_", ")_", "\\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, 0, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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 ]
Unused local variable
enthought/traits/traits/trait_numeric.py
[ { "content": " def validate ( self, object, name, value ):\n \"\"\" Validates that the value is a valid array.\n \"\"\"\n try:\n # Make sure the value is an array:\n type_value = type( value )\n if not isinstance( value, ndarray ):\n if not isinstance( value, SequenceTypes ):\n self.error( object, name, value )\n if self.dtype is not None:\n value = asarray( value, self.dtype )\n else:\n value = asarray( value )\n\n # Make sure the array is of the right type:\n if ((self.dtype is not None) and\n (value.dtype != self.dtype)):\n if self.coerce:\n value = value.astype( self.dtype )\n else:\n # XXX: this also coerces.\n value = asarray( value, self.dtype )\n\n # If no shape requirements, then return the value:\n trait_shape = self.shape\n if trait_shape is None:\n return value\n\n # Else make sure that the value's shape is compatible:\n value_shape = value.shape\n if len( trait_shape ) == len( value_shape ):\n for i, dim in enumerate( value_shape ):\n item = trait_shape[i]\n if item is not None:\n if type( item ) is int:\n if dim != item:\n break\n elif ((dim < item[0]) or\n ((item[1] is not None) and (dim > item[1]))):\n break\n else:\n return value\n except:\n pass\n\n self.error( object, name, value )", "metadata": "root.AbstractArray.validate", "header": "['class', 'AbstractArray', '(', 'TraitType', ')', ':', '___EOS___']", "index": 132 } ]
[ { "span": "type_value ", "start_line": 137, "start_column": 12, "end_line": 137, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Abstract", "Array_", "(_", "Trait", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "object_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "value", " ", "is", " ", "a", " ", "valid", " ", "array", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "value", " ", "is", " ", "an", " ", "array", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type", "\\u", "value_", "=_", "type_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "ndarray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "Sequ", "ence", "Types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "error_", "(_", "object_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "dtype_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "asarray_", "(_", "value_", ",_", "self_", "._", "dtype_", ")_", "\\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 ", " ", "_", "value_", "=_", "asarray_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "array", " ", "is", " ", "of", " ", "the", " ", "right", " ", "type", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "self_", "._", "dtype_", "is_", "not_", "None_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "value_", "._", "dtype_", "!=_", "self_", "._", "dtype_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "coerce", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "value_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "this", " ", "als", "o", " ", "coerce", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "asarray_", "(_", "value_", ",_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "shape", " ", "require", "ment", "s", ",", " ", "then", " ", "return", " ", "the", " ", "value", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tra", "it", "\\u", "shape_", "=_", "self_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tra", "it", "\\u", "shape_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "value", "'", "s", " ", "shape", " ", "is", " ", "compatible", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value", "\\u", "shape_", "=_", "value_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tra", "it", "\\u", "shape_", ")_", "==_", "len_", "(_", "value", "\\u", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "dim_", "in_", "enumerate_", "(_", "value", "\\u", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "=_", "tra", "it", "\\u", "shape_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "type_", "(_", "item_", ")_", "is_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dim_", "!=_", "item_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "(_", "dim_", "<_", "item_", "[_", "0_", "]_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "item_", "[_", "1_", "]_", "is_", "not_", "None_", ")_", "and_", "(_", "dim_", ">_", "item_", "[_", "1_", "]_", ")_", ")_", ")_", ":_", "\\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_", "\\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 ", " ", "_", "return_", "value_", "\\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_", ":_", "\\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_", "self_", "._", "error_", "(_", "object_", ",_", "name_", ",_", "value_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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oin\n ~~~~~\n\n :copyright: (c) 2014 by Halfmoon Labs\n :license: MIT, see LICENSE for more details.\n\"\"\"\n\nimport os\nimport json\nimport hashlib\nimport ecdsa\nfrom binascii import hexlify, unhexlify\nfrom ecdsa.keys import SigningKey\nfrom utilitybelt import is_int, dev_random_entropy, dev_urandom_entropy\nfrom bitcoin import compress, encode_privkey, get_privkey_format\n\nfrom .errors import _errors\nfrom .formatcheck import *\nfrom .b58check import b58check_encode, b58check_decode\nfrom .publickey import BitcoinPublicKey, PUBKEY_MAGIC_BYTE\nfrom .passphrases import create_passphrase\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def random_secret_exponent(curve_order):\n \"\"\" Generates a random secret exponent. \"\"\"\n # run a rejection sampling algorithm to ensure the random int is less\n # than the curve order\n while True:\n # generate a random 256 bit hex string\n random_hex = hexlify(dev_random_entropy(32))\n random_int = int(random_hex, 16)\n if random_int >= 1 and random_int < curve_order:\n break\n return random_int", "metadata": "root.random_secret_exponent", "header": "['module', '___EOS___']", "index": 25 }, { "content": "class BitcoinPrivateKey():\n _curve = ecdsa.curves.SECP256k1\n _hash_function = hashlib.sha256\n _pubkeyhash_version_byte = 0\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BitcoinPrivateKey", "header": "['module', '___EOS___']", "index": 38 }, { "content": " @classmethod\n def wif_version_byte(cls):\n if hasattr(cls, '_wif_version_byte'):\n return cls._wif_version_byte\n return (cls._pubkeyhash_version_byte + 128) % 256", "metadata": "root.BitcoinPrivateKey.wif_version_byte", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 43 }, { "content": " def __init__(self, private_key=None, compressed=False):\n \"\"\" Takes in a private key/secret exponent.\n \"\"\"\n self._compressed = compressed\n if not private_key:\n secret_exponent = random_secret_exponent(self._curve.order)\n else:\n secret_exponent = encode_privkey(private_key, 'decimal')\n if get_privkey_format(private_key).endswith('compressed'):\n self._compressed = True\n\n # make sure that: 1 <= secret_exponent < curve_order\n if not is_secret_exponent(secret_exponent, self._curve.order):\n raise IndexError(_errors[\"EXPONENT_OUTSIDE_CURVE_ORDER\"])\n\n self._ecdsa_private_key = ecdsa.keys.SigningKey.from_secret_exponent(\n secret_exponent, self._curve, self._hash_function\n )", "metadata": "root.BitcoinPrivateKey.__init__", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 49 }, { "content": " @classmethod\n def from_passphrase(cls, passphrase=None):\n \"\"\" Create keypair from a passphrase input (a brain wallet keypair).\"\"\"\n if not passphrase:\n # run a rejection sampling algorithm to ensure the private key is\n # less than the curve order\n while True:\n passphrase = create_passphrase(bits_of_entropy=160)\n hex_private_key = hashlib.sha256(passphrase).hexdigest()\n if int(hex_private_key, 16) < cls._curve.order:\n break\n else:\n hex_private_key = hashlib.sha256(passphrase).hexdigest()\n if not (int(hex_private_key, 16) < cls._curve.order):\n raise ValueError(_errors[\"CURVE_ORDER_EXCEEDED\"])\n\n keypair = cls(hex_private_key)\n keypair._passphrase = passphrase\n return keypair", "metadata": "root.BitcoinPrivateKey.from_passphrase", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 68 }, { "content": " def to_bin(self):\n if self._compressed:\n return encode_privkey(\n self._ecdsa_private_key.to_string(), 'bin_compressed')\n else:\n return self._ecdsa_private_key.to_string()", "metadata": "root.BitcoinPrivateKey.to_bin", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 88 }, { "content": " def to_hex(self):\n if self._compressed:\n return encode_privkey(\n self._ecdsa_private_key.to_string(), 'hex_compressed')\n else:\n return hexlify(self.to_bin())", "metadata": "root.BitcoinPrivateKey.to_hex", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 95 }, { "content": " def to_wif(self):\n if self._compressed:\n return encode_privkey(\n self._ecdsa_private_key.to_string(), 'wif_compressed')\n else:\n return b58check_encode(\n self.to_bin(), version_byte=self.wif_version_byte())", "metadata": "root.BitcoinPrivateKey.to_wif", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 102 }, { "content": " def to_pem(self):\n return self._ecdsa_private_key.to_pem()", "metadata": "root.BitcoinPrivateKey.to_pem", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 110 }, { "content": " def to_der(self):\n return hexlify(self._ecdsa_private_key.to_der())", "metadata": "root.BitcoinPrivateKey.to_der", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 113 }, { "content": " def public_key(self):\n # lazily calculate and set the public key\n if not hasattr(self, '_public_key'):\n ecdsa_public_key = self._ecdsa_private_key.get_verifying_key()\n\n bin_public_key_string = PUBKEY_MAGIC_BYTE + \\\n ecdsa_public_key.to_string()\n\n if self._compressed:\n bin_public_key_string = compress(bin_public_key_string)\n\n # create the public key object from the public key string\n self._public_key = BitcoinPublicKey(\n bin_public_key_string,\n version_byte=self._pubkeyhash_version_byte)\n\n # return the public key object\n return self._public_key", "metadata": "root.BitcoinPrivateKey.public_key", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 116 }, { "content": " def passphrase(self):\n if hasattr(self, '_passphrase'):\n return self._passphrase\n else:\n raise Exception(_errors[\"NOT_A_BRAIN_WALLET\"])", "metadata": "root.BitcoinPrivateKey.passphrase", "header": "['class', 'BitcoinPrivateKey', '(', ')', ':', '___EOS___']", "index": 135 }, { "content": "class LitecoinPrivateKey(BitcoinPrivateKey):\n _pubkeyhash_version_byte = 48", "metadata": "root.LitecoinPrivateKey", "header": "['module', '___EOS___']", "index": 142 }, { "content": "class NamecoinPrivateKey(BitcoinPrivateKey):\n _pubkeyhash_version_byte = 52", "metadata": "root.NamecoinPrivateKey", "header": "['module', '___EOS___']", "index": 146 } ]
[ { "span": "import os", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 9 }, { "span": "import json", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 11 }, { "span": "from binascii import hexlify, unhexlify", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 39 }, { "span": "from ecdsa.keys import SigningKey", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 33 }, { "span": "from utilitybelt import is_int, dev_random_entropy, dev_urandom_entropy", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 71 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "pyb", "itc", "oin", "\\", "10", ";", " ", " ", " ", " ", "~~~~~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2014", " ", "by", " ", "Hal", "fmo", "on", " ", "Lab", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "MIT", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ecd", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "binascii_", "import_", "hexlify_", ",_", "unhexlify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ecd", "sa_", "._", "keys_", "import_", "Signin", "g", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utility", "bel", "t_", "import_", "is", "\\u", "int_", ",_", "dev", "\\u", "random", "\\u", "entropy_", ",_", "dev", "\\u", "uran", "dom", "\\u", "entropy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bitcoin", "_", "import_", "compress_", ",_", "encode", "\\u", "privkey_", ",_", "get", "\\u", "priv", "key", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "errors_", "import_", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "format", "check_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "b5", "8c", "heck_", "import_", "b5", "8c", "heck", "\\u", "encode_", ",_", "b5", "8c", "heck", "\\u", "decode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "public", "key_", "import_", "Bit", "coin", "Public", "Key_", ",_", "PUB", "KEY", "\\u", "MAGIC", "\\u", "BYTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "passp", "hra", "ses_", "import_", "create", "\\u", "passphrase_", "\\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_", "random", "\\u", "secret", "\\u", "exponent_", "(_", "curve", "\\u", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Generate", "s", " ", "a", " ", "random", " ", "secret", " ", "expon", "ent", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "a", " ", "reject", "ion", " ", "samp", "ling", " ", "algo", "rit", "hm", " ", "to", " ", "ensure", " ", "the", " ", "random", " ", "int", " ", "is", " ", "less_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "the", " ", "curve", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generat", "e", " ", "a", " ", "random", " ", "256", " ", "bit", " ", "hex", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "random", "\\u", "hex_", "=_", "hexlify_", "(_", "dev", "\\u", "random", "\\u", "entropy_", "(_", "32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "\\u", "int_", "=_", "int_", "(_", "random", "\\u", "hex_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "random", "\\u", "int_", ">=_", "1_", "and_", "random", "\\u", "int_", "<_", "curve", "\\u", "order_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "random", "\\u", "int_", "\\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_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "curve_", "=_", "ecd", "sa_", "._", "curves_", "._", "SEC", "P2", "56", "k1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "hash", "\\u", "function_", "=_", "hashlib_", "._", "sha256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "pubkey", "hash", "\\u", "version", "\\u", "byte_", "=_", "0_", "\\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_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wif", "\\u", "version", "\\u", "byte_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "cls_", ",_", "'\\u", "wif", "\\u", "version", "\\u", "byte", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "wif", "\\u", "version", "\\u", "byte_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "cls_", "._", "\\u", "pubkey", "hash", "\\u", "version", "\\u", "byte_", "+_", "128_", ")_", "%_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "private", "\\u", "key_", "=_", "None_", ",_", "compressed_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Tak", "es", " ", "in", " ", "a", " ", "private", " ", "key", "/", "secret", " ", "expon", "ent", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "compressed_", "=_", "compressed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "private", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "secret", "\\u", "exponent_", "=_", "random", "\\u", "secret", "\\u", "exponent_", "(_", "self_", "._", "\\u", "curve_", "._", "order_", ")_", "\\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 ", " _", "secret", "\\u", "exponent_", "=_", "encode", "\\u", "privkey_", "(_", "private", "\\u", "key_", ",_", "'", "decima", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "get", "\\u", "priv", "key", "\\u", "format_", "(_", "private", "\\u", "key_", ")_", "._", "endswith_", "(_", "'", "compress", "ed", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "compressed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "tha", "t", ":", " ", "1", " ", "<=", " ", "secret", "\\u", "expon", "ent", " ", "<", " ", "curve", "\\u", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "secret", "\\u", "exponent_", "(_", "secret", "\\u", "exponent_", ",_", "self_", "._", "\\u", "curve_", "._", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\\u", "errors_", "[_", "\"", "EXP", "ONE", "NT", "\\u", "OUT", "SIDE", "\\u", "CUR", "VE", "\\u", "ORDE", "R", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "=_", "ecd", "sa_", "._", "keys_", "._", "Signin", "g", "Key_", "._", "from", "\\u", "secret", "\\u", "exponent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "secret", "\\u", "exponent_", ",_", "self_", "._", "\\u", "curve_", ",_", "self_", "._", "\\u", "hash", "\\u", "function_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "passphrase_", "(_", "cls_", ",_", "passphrase_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "e", " ", "keypa", "ir", " ", "from", " ", "a", " ", "passp", "hra", "se", " ", "input", " ", "(", "a", " ", "brain", " ", "walle", "t", " ", "keypa", "ir", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "passphrase_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "a", " ", "reject", "ion", " ", "samp", "ling", " ", "algo", "rit", "hm", " ", "to", " ", "ensure", " ", "the", " ", "private", " ", "key", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "less", " ", "than", " ", "the", " ", "curve", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "passphrase_", "=_", "create", "\\u", "passphrase_", "(_", "bits", "\\u", "of", "\\u", "entropy_", "=_", "160_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hex", "\\u", "private", "\\u", "key_", "=_", "hashlib_", "._", "sha256_", "(_", "passphrase_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "hex", "\\u", "private", "\\u", "key_", ",_", "16_", ")_", "<_", "cls_", "._", "\\u", "curve_", "._", "order_", ":_", "\\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_", "\\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 ", " _", "hex", "\\u", "private", "\\u", "key_", "=_", "hashlib_", "._", "sha256_", "(_", "passphrase_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "int_", "(_", "hex", "\\u", "private", "\\u", "key_", ",_", "16_", ")_", "<_", "cls_", "._", "\\u", "curve_", "._", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u", "errors_", "[_", "\"", "CUR", "VE", "\\u", "ORDE", "R", "\\u", "EXCE", "EDE", "D", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keypair_", "=_", "cls_", "(_", "hex", "\\u", "private", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keypair_", "._", "\\u", "passphrase_", "=_", "passphrase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "keypair_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "bin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "compressed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "encode", "\\u", "privkey_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "to", "\\u", "string_", "(_", ")_", ",_", "'", "bin", "\\u", "compress", "ed", "'_", ")_", "\\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_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "to", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\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_", "to", "\\u", "hex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "compressed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "encode", "\\u", "privkey_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "to", "\\u", "string_", "(_", ")_", ",_", "'", "hex", "\\u", "compress", "ed", "'_", ")_", "\\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_", "hexlify_", "(_", "self_", "._", "to", "\\u", "bin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\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_", "to", "\\u", "wif", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "compressed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "encode", "\\u", "privkey_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "to", "\\u", "string_", "(_", ")_", ",_", "'", "wif", "\\u", "compress", "ed", "'_", ")_", "\\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_", "b5", "8c", "heck", "\\u", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "to", "\\u", "bin_", "(_", ")_", ",_", "version", "\\u", "byte_", "=_", "self_", "._", "wif", "\\u", "version", "\\u", "byte_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\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_", "to", "\\u", "pem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "to", "\\u", "pem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "der_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hexlify_", "(_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "to", "\\u", "der_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "public", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "laz", "il", "y", " ", "calcul", "ate", " ", "and", " ", "set", " ", "the", " ", "public", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "public", "\\u", "key", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ecd", "sa", "\\u", "public", "\\u", "key_", "=_", "self_", "._", "\\u", "ecd", "sa", "\\u", "private", "\\u", "key_", "._", "get", "\\u", "verify", "ing", "\\u", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bin", "\\u", "public", "\\u", "key", "\\u", "string_", "=_", "PUB", "KEY", "\\u", "MAGIC", "\\u", "BYTE_", "+_", "ecd", "sa", "\\u", "public", "\\u", "key_", "._", "to", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "compressed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "\\u", "public", "\\u", "key", "\\u", "string_", "=_", "compress_", "(_", "bin", "\\u", "public", "\\u", "key", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "public", " ", "key", " ", "object", " ", "from", " ", "the", " ", "public", " ", "key", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "public", "\\u", "key_", "=_", "Bit", "coin", "Public", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bin", "\\u", "public", "\\u", "key", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version", "\\u", "byte_", "=_", "self_", "._", "\\u", "pubkey", "hash", "\\u", "version", "\\u", "byte_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "public", " ", "key", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "public", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "Priva", "te", "Key_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "passphrase_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "passp", "hra", "se", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "passphrase_", "\\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_", "(_", "\\u", "errors_", "[_", "\"", "NOT", "\\u", "A", "\\u", "BRAI", "N", "\\u", "WALL", "ET", "\"_", "]_", ")_", "\\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_", "Lite", "coin", "Priva", "te", "Key_", "(_", "Bit", "coin", "Priva", "te", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "pubkey", "hash", "\\u", "version", "\\u", "byte_", "=_", "48_", "\\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_", "Name", "coin", "Priva", "te", "Key_", "(_", "Bit", "coin", "Priva", "te", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "pubkey", "hash", "\\u", "version", "\\u", "byte_", "=_", "52_" ]
[ 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, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2,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/{BALL}/{TURNS}\n mode = 'U' if on else 'D'\n ball_number = COLORS[ball]\n force = FORCE[ball]\n try:\n self._process(\"%s/MOVE/%s/%s/%s\" % (self.url, mode, ball_number, force), get = False)\n except:\n traceback.print_exc()", "metadata": "root.Proxy.move_ball", "header": "['class', 'Proxy', '(', 'object', ')', ':', '___EOS___']", "index": 46 }, { "content": " def process_image(self):\n try:\n content_str = self._process(\"http://192.168.0.155:7777/image\", get = True)\n content = json.loads(content_str)\n\n base_path = 'https://www.weblab.deusto.es/aquarium'\n\n return (base_path + content['url_processed']), (base_path + content['url_original'])\n except:\n traceback.print_exc()\n return \"error-processing-image\", \"error-processing-image\"", "metadata": "root.Proxy.process_image", "header": "['class', 'Proxy', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def get_status(self):\n try:\n content_str = self._process(\"%s/ballStatus/ALL\" % self.url, get = True)\n content = json.loads(content_str)\n white, yellow, blue, red = content['Balls']\n return {\n 'white' : white == 0,\n 'yellow' : yellow == 0,\n 'blue' : blue == 0,\n 'red' : red == 0,\n }\n except:\n traceback.print_exc()\n return {\n 'white' : True,\n 'yellow': True,\n 'blue' : True,\n 'red' : True,\n }", "metadata": "root.Proxy.get_status", "header": "['class', 'Proxy', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " @Override(ConcurrentExperiment)\n @logged(\"info\")\n def do_send_command_to_device(self, lab_session_id, command):\n \"\"\"\n Callback run when the client sends a command to the experiment\n @param command Command sent by the client, as a string.\n \"\"\"\n if self.debug:\n print \"[Aquarium*] do_send_command_to_device called: %s\" % command\n\n if command == 'get-status':\n return json.dumps(self._status.get_status())\n elif command.startswith('ball:'):\n try:\n _, ball, on = command.split(':')\n except:\n traceback.print_exc()\n return \"ERROR:Invalid ball command\"\n\n if not ball.lower() in COLORS:\n return \"ERROR:Invalid ball color\"\n\n if not on.lower() in ('true','false'):\n return \"ERROR:Invalid state\"\n\n on = on.lower() == 'true'\n ball = ball.lower()\n \n self._status.move(ball, on)\n\n return json.dumps(self._status.get_status())\n elif command == 'process':\n return json.dumps(self.proxy.process_image())\n\n return 'ERROR:Invalid command'", "metadata": "root.Aquarium.do_send_command_to_device", "header": "['class', 'Aquarium', '(', 'ConcurrentExperiment', ')', ':', '___EOS___']", "index": 166 } ]
[ { "span": "except:", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 15 }, { "span": "except:", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 15 }, { "span": "except:", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 15 }, { "span": "except:", "start_line": 181, "start_column": 12, "end_line": 181, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Proxy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "\\u", "ball_", "(_", "self_", ",_", "ball_", ",_", "on_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "192", ".1", "68.", "0.13", "0", ":", "800", "0", "/", "MOVE", "/{", "MODE", "}/", "{", "BAL", "L", "}/", "{", "TURN", "S", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "'", "U", "'_", "if_", "on_", "else_", "'", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bal", "l\\u", "number_", "=_", "COLORS_", "[_", "ball_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "force_", "=_", "FORCE", "_", "[_", "ball_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "process_", "(_", "\"%", "s", "/", "MOVE", "/", "%", "s", "/", "%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "url_", ",_", "mode_", ",_", "bal", "l\\u", "number_", ",_", "force_", ")_", ",_", "get_", "=_", "False_", ")_", "\\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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Proxy_", "(_", "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_", "def_", "process", "\\u", "image_", "(_", "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 ", " _", "content", "\\u", "str_", "=_", "self_", "._", "\\u", "process_", "(_", "\"", "http", "://", "192", ".1", "68.", "0.15", "5", ":", "7777", "/", "image", "\"_", ",_", "get_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "json_", "._", "loads_", "(_", "content", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", "=_", "'", "https", "://", "www", ".", "webla", "b", ".", "deu", "sto", ".", "es", "/", "aqu", "ari", "um", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "base", "\\u", "path_", "+_", "content_", "[_", "'", "url", "\\u", "process", "ed", "'_", "]_", ")_", ",_", "(_", "base", "\\u", "path_", "+_", "content_", "[_", "'", "url", "\\u", "original", "'_", "]_", ")_", "\\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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "error", "-", "process", "ing", "-", "image", "\"_", ",_", "\"", "error", "-", "process", "ing", "-", "image", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Proxy_", "(_", "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_", "def_", "get", "\\u", "status_", "(_", "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 ", " _", "content", "\\u", "str_", "=_", "self_", "._", "\\u", "process_", "(_", "\"%", "s", "/", "bal", "l", "Status", "/", "ALL", "\"_", "%_", "self_", "._", "url_", ",_", "get_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "json_", "._", "loads_", "(_", "content", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "white_", ",_", "yellow_", ",_", "blue_", ",_", "red_", "=_", "content_", "[_", "'", "Ball", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "white", "'_", ":_", "white_", "==_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yell", "ow", "'_", ":_", "yellow_", "==_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blue", "'_", ":_", "blue_", "==_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "red", "'_", ":_", "red_", "==_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "white", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "yell", "ow", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "blue", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "red", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aq", "uar", "ium_", "(_", "Conc", "urrent", "Experiment_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Override", "_", "(_", "Conc", "urrent", "Experiment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "logged", "_", "(_", "\"", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "send", "\\u", "command", "\\u", "to", "\\u", "device_", "(_", "self_", ",_", "lab", "\\u", "session", "\\u", "id_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "back", " ", "run", " ", "whe", "n", " ", "the", " ", "client", " ", "send", "s", " ", "a", " ", "command", " ", "to", " ", "the", " ", "experiment", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "command", " ", "Command", " ", "sent", " ", "by", " ", "the", " ", "client", ",", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "Aq", "uar", "ium", "*]", " ", "do", "\\u", "send", "\\u", "command", "\\u", "to", "\\u", "device", " ", "call", "ed", ":", " ", "%", "s", "\"_", "%_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "command_", "==_", "'", "get", "-", "status", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "self_", "._", "\\u", "status_", "._", "get", "\\u", "status_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "command_", "._", "startswith_", "(_", "'", "bal", "l", ":'_", ")_", ":_", "\\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 ", " _", "\\u_", ",_", "ball_", ",_", "on_", "=_", "command_", "._", "split_", "(_", "':'_", ")_", "\\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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "ERROR", ":", "Inva", "lid", " ", "bal", "l", " ", "command", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ball_", "._", "lower_", "(_", ")_", "in_", "COLORS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "ERROR", ":", "Inva", "lid", " ", "bal", "l", " ", "color", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "on_", "._", "lower_", "(_", ")_", "in_", "(_", "'", "true", "'_", ",_", "'", "fal", "se", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "ERROR", ":", "Inva", "lid", " ", "state", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "on_", "=_", "on_", "._", "lower_", "(_", ")_", "==_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ball_", "=_", "ball_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "status_", "._", "move_", "(_", "ball_", ",_", "on_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "self_", "._", "\\u", "status_", "._", "get", "\\u", "status_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "command_", "==_", "'", "process", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "self_", "._", "proxy_", "._", "process", "\\u", "image_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rizar/attention-lvcsr/libs/Theano/theano/compile/tests/test_pfunc.py
[ { "content": " def test_doc(self):\n \"\"\"Ensure the code given in pfunc.txt works as expected\"\"\"\n\n # Example #1.\n a = lscalar()\n b = shared(1)\n f1 = pfunc([a], (a + b))\n f2 = pfunc([In(a, value=44)], a + b, updates={b: b + 1})\n self.assertTrue(b.get_value() == 1)\n self.assertTrue(f1(3) == 4)\n self.assertTrue(f2(3) == 4)\n self.assertTrue(b.get_value() == 2)\n self.assertTrue(f1(3) == 5)\n b.set_value(0)\n self.assertTrue(f1(3) == 3)\n\n # Example #2.\n a = tensor.lscalar()\n b = shared(7)\n f1 = pfunc([a], a + b)\n f2 = pfunc([a], a * b)\n self.assertTrue(f1(5) == 12)\n b.set_value(8)\n self.assertTrue(f1(5) == 13)\n self.assertTrue(f2(4) == 32)", "metadata": "root.Test_pfunc.test_doc", "header": "['class', 'Test_pfunc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_update(self):\n \"\"\"Test update mechanism in different settings.\"\"\"\n\n # Simple value assignment.\n x = shared(0)\n assign = pfunc([], [], updates={x: 3})\n assign()\n self.assertTrue(x.get_value() == 3)\n\n # Basic increment function.\n x.set_value(0)\n inc = pfunc([], [], updates={x: x + 1})\n inc()\n self.assertTrue(x.get_value() == 1)\n\n # Increment by a constant value.\n x.set_value(-1)\n y = shared(2)\n inc_by_y = pfunc([], [], updates={x: x + y})\n inc_by_y()\n self.assertTrue(x.get_value() == 1)", "metadata": "root.Test_pfunc.test_update", "header": "['class', 'Test_pfunc', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 316 } ]
[ { "span": "self.assertTrue(b.get_value() == 1)", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 43 }, { "span": "self.assertTrue(f1(3) == 4)", "start_line": 30, "start_column": 8, "end_line": 30, "end_column": 35 }, { "span": "self.assertTrue(f2(3) == 4)", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 35 }, { "span": "self.assertTrue(b.get_value() == 2)", "start_line": 32, "start_column": 8, "end_line": 32, "end_column": 43 }, { "span": "self.assertTrue(f1(3) == 5)", "start_line": 33, "start_column": 8, "end_line": 33, "end_column": 35 }, { "span": "self.assertTrue(f1(3) == 3)", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 35 }, { "span": "self.assertTrue(f1(5) == 12)", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 36 }, { "span": "self.assertTrue(f1(5) == 13)", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 36 }, { "span": "self.assertTrue(f2(4) == 32)", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 36 }, { "span": "self.assertTrue(x.get_value() == 3)", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 43 }, { "span": "self.assertTrue(x.get_value() == 1)", "start_line": 329, "start_column": 8, "end_line": 329, "end_column": 43 }, { "span": "self.assertTrue(x.get_value() == 1)", "start_line": 336, "start_column": 8, "end_line": 336, "end_column": 43 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "\\u", "pf", "unc_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "doc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "the", " ", "code", " ", "give", "n", " ", "in", " ", "pf", "unc", ".", "txt", " ", "works", " ", "as", " ", "expected", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", " ", "#", "1._", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "lsc", "ala", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "shared_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "=_", "pf", "unc_", "(_", "[_", "a_", "]_", ",_", "(_", "a_", "+_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "pf", "unc_", "(_", "[_", "In_", "(_", "a_", ",_", "value_", "=_", "44_", ")_", "]_", ",_", "a_", "+_", "b_", ",_", "updates_", "=_", "{_", "b_", ":_", "b_", "+_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "b_", "._", "get", "\\u", "value_", "(_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f1_", "(_", "3_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f2_", "(_", "3_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "b_", "._", "get", "\\u", "value_", "(_", ")_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f1_", "(_", "3_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "set\\u", "value_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f1_", "(_", "3_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", " ", "#", "2._", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "tensor_", "._", "lsc", "ala", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "shared_", "(_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f1_", "=_", "pf", "unc_", "(_", "[_", "a_", "]_", ",_", "a_", "+_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "pf", "unc_", "(_", "[_", "a_", "]_", ",_", "a_", "*_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f1_", "(_", "5_", ")_", "==_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "set\\u", "value_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f1_", "(_", "5_", ")_", "==_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f2_", "(_", "4_", ")_", "==_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "pf", "unc_", "(_", "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_", "def_", "test\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "update", " ", "mechanism", " ", "in", " ", "different", " ", "settings", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "value", " ", "assign", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "shared_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assign_", "=_", "pf", "unc_", "(_", "[_", "]_", ",_", "[_", "]_", ",_", "updates_", "=_", "{_", "x_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assign_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "x_", "._", "get", "\\u", "value_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic", " ", "increment", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "set\\u", "value_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc_", "=_", "pf", "unc_", "(_", "[_", "]_", ",_", "[_", "]_", ",_", "updates_", "=_", "{_", "x_", ":_", "x_", "+_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "x_", "._", "get", "\\u", "value_", "(_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increment", " ", "by", " ", "a", " ", "constant", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "set\\u", "value_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "shared_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc", "\\u", "by", "\\u", "y_", "=_", "pf", "unc_", "(_", "[_", "]_", ",_", "[_", "]_", ",_", "updates_", "=_", "{_", "x_", ":_", "x_", "+_", "y_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc", "\\u", "by", "\\u", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "x_", "._", "get", "\\u", "value_", "(_", ")_", "==_", "1_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/many_to_many/tests.py
[ { "content": " def test_add(self):\n # Create an Article.\n a5 = Article(id=None, headline='Django lets you reate Web apps easily')\n # You can't associate it with a Publication until it's been saved.\n self.assertRaises(ValueError, getattr, a5, 'publications')\n # Save it!\n a5.save()\n # Associate the Article with a Publication.\n a5.publications.add(self.p1)\n self.assertQuerysetEqual(a5.publications.all(),\n ['<Publication: The Python Journal>'])\n # Create another Article, and set it to appear in both Publications.\n a6 = Article(id=None, headline='ESA uses Python')\n a6.save()\n a6.publications.add(self.p1, self.p2)\n a6.publications.add(self.p3)\n # Adding a second time is OK\n a6.publications.add(self.p3)\n self.assertQuerysetEqual(a6.publications.all(),\n [\n '<Publication: Science News>',\n '<Publication: Science Weekly>',\n '<Publication: The Python Journal>',\n ])\n\n # Adding an object of the wrong type raises TypeError\n with self.assertRaisesRegexp(TypeError, \"'Publication' instance expected, got <Article.*\"):\n a6.publications.add(a5)\n # Add a Publication directly via publications.add by using keyword arguments.\n p4 = a6.publications.create(title='Highlights for Adults')\n self.assertQuerysetEqual(a6.publications.all(),\n [\n '<Publication: Highlights for Adults>',\n '<Publication: Science News>',\n '<Publication: Science Weekly>',\n '<Publication: The Python Journal>',\n ])", "metadata": "root.ManyToManyTests.test_add", "header": "['class', 'ManyToManyTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 28 }, { "content": " def test_reverse_add(self):\n # Adding via the 'other' end of an m2m\n a5 = Article(headline='NASA finds intelligent life on Mars')\n a5.save()\n self.p2.article_set.add(a5)\n self.assertQuerysetEqual(self.p2.article_set.all(),\n [\n '<Article: NASA finds intelligent life on Earth>',\n '<Article: NASA finds intelligent life on Mars>',\n '<Article: NASA uses Python>',\n '<Article: Oxygen-free diet works wonders>',\n ])\n self.assertQuerysetEqual(a5.publications.all(),\n ['<Publication: Science News>'])\n\n # Adding via the other end using keywords\n new_article = self.p2.article_set.create(headline='Carbon-free diet works wonders')\n self.assertQuerysetEqual(\n self.p2.article_set.all(),\n [\n '<Article: Carbon-free diet works wonders>',\n '<Article: NASA finds intelligent life on Earth>',\n '<Article: NASA finds intelligent life on Mars>',\n '<Article: NASA uses Python>',\n '<Article: Oxygen-free diet works wonders>',\n ])\n a6 = self.p2.article_set.all()[3]\n self.assertQuerysetEqual(a6.publications.all(),\n [\n '<Publication: Highlights for Children>',\n '<Publication: Science News>',\n '<Publication: Science Weekly>',\n '<Publication: The Python Journal>',\n ])", "metadata": "root.ManyToManyTests.test_reverse_add", "header": "['class', 'ManyToManyTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 66 } ]
[ { "span": "p4 ", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 10 }, { "span": "new_article ", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Many", "To", "Many", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "Artic", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a5", "_", "=_", "Article_", "(_", "id_", "=_", "None_", ",_", "headline", "_", "=_", "'", "Dj", "ang", "o", " ", "lets", " ", "you", " ", "reate", " ", "Web", " ", "apps", " ", "easi", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "You", " ", "can", "'", "t", " ", "associate", " ", "it", " ", "with", " ", "a", " ", "Public", "ation", " ", "unti", "l", " ", "it", "'", "s", " ", "bee", "n", " ", "saved", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "getattr_", ",_", "a5", "_", ",_", "'", "publications", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "it", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "a5", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Associate", " ", "the", " ", "Artic", "le", " ", "with", " ", "a", " ", "Public", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "a5", "_", "._", "publications", "_", "._", "add_", "(_", "self_", "._", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "a5", "_", "._", "publications", "_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'<", "Public", "ation", ":", " ", "The", " ", "Pyth", "on", " ", "Journ", "al", ">'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "anot", "her", " ", "Artic", "le", ",", " ", "and", " ", "set", " ", "it", " ", "to", " ", "appear", " ", "in", " ", "bot", "h", " ", "Public", "ation", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "a6", "_", "=_", "Article_", "(_", "id_", "=_", "None_", ",_", "headline", "_", "=_", "'", "ES", "A", " ", "use", "s", " ", "Pyth", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a6", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a6", "_", "._", "publications", "_", "._", "add_", "(_", "self_", "._", "p1_", ",_", "self_", "._", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a6", "_", "._", "publications", "_", "._", "add_", "(_", "self_", "._", "p3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "a", " ", "second", " ", "time", " ", "is", " ", "OK_", "\\u\\u\\uNL\\u\\u\\u_", "a6", "_", "._", "publications", "_", "._", "add_", "(_", "self_", "._", "p3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "a6", "_", "._", "publications", "_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "News", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "Week", "ly", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "The", " ", "Pyth", "on", " ", "Journ", "al", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "an", " ", "object", " ", "of", " ", "the", " ", "wrong", " ", "type", " ", "raise", "s", " ", "Type", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "Type", "Error_", ",_", "\"'", "Public", "ation", "'", " ", "instance", " ", "expected", ",", " ", "got", " ", "<", "Artic", "le", ".*\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a6", "_", "._", "publications", "_", "._", "add_", "(_", "a5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "Public", "ation", " ", "direct", "ly", " ", "via", " ", "publications", ".", "add", " ", "by", " ", "usi", "ng", " ", "keyw", "ord", " ", "argu", "ment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p4_", "=_", "a6", "_", "._", "publications", "_", "._", "create_", "(_", "title_", "=_", "'", "Highlight", "s", " ", "for", " ", "Ad", "ult", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "a6", "_", "._", "publications", "_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Highlight", "s", " ", "for", " ", "Ad", "ult", "s", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "News", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "Week", "ly", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "The", " ", "Pyth", "on", " ", "Journ", "al", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Many", "To", "Many", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "reverse", "\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "via", " ", "the", " ", "'", "other", "'", " ", "end", " ", "of", " ", "an", " ", "m2", "m_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a5", "_", "=_", "Article_", "(_", "headline", "_", "=_", "'", "NAS", "A", " ", "find", "s", " ", "intelligen", "t", " ", "life", " ", "on", " ", "Mars", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a5", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p2_", "._", "article", "\\u", "set_", "._", "add_", "(_", "a5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "self_", "._", "p2_", "._", "article", "\\u", "set_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "NAS", "A", " ", "find", "s", " ", "intelligen", "t", " ", "life", " ", "on", " ", "Ear", "th", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "NAS", "A", " ", "find", "s", " ", "intelligen", "t", " ", "life", " ", "on", " ", "Mars", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "NAS", "A", " ", "use", "s", " ", "Pyth", "on", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "Ox", "yg", "en", "-", "free", " ", "die", "t", " ", "works", " ", "won", "ders", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "a5", "_", "._", "publications", "_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "News", ">'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "via", " ", "the", " ", "other", " ", "end", " ", "usi", "ng", " ", "keywords_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "article_", "=_", "self_", "._", "p2_", "._", "article", "\\u", "set_", "._", "create_", "(_", "headline", "_", "=_", "'", "Car", "bon", "-", "free", " ", "die", "t", " ", "works", " ", "won", "ders", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "p2_", "._", "article", "\\u", "set_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "Car", "bon", "-", "free", " ", "die", "t", " ", "works", " ", "won", "ders", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "NAS", "A", " ", "find", "s", " ", "intelligen", "t", " ", "life", " ", "on", " ", "Ear", "th", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "NAS", "A", " ", "find", "s", " ", "intelligen", "t", " ", "life", " ", "on", " ", "Mars", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "NAS", "A", " ", "use", "s", " ", "Pyth", "on", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Artic", "le", ":", " ", "Ox", "yg", "en", "-", "free", " ", "die", "t", " ", "works", " ", "won", "ders", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a6", "_", "=_", "self_", "._", "p2_", "._", "article", "\\u", "set_", "._", "all_", "(_", ")_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "a6", "_", "._", "publications", "_", "._", "all_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Highlight", "s", " ", "for", " ", "Chil", "dre", "n", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "News", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "Sci", "ence", " ", "Week", "ly", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "Public", "ation", ":", " ", "The", " ", "Pyth", "on", " ", "Journ", "al", ">'_", ",_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Conftest.py
[ { "content": "def CheckTypeSize(context, type_name, header = None, language = None, expect = None):\n \"\"\"This check can be used to get the size of a given type, or to check whether\n the type is of expected size.\n\n Arguments:\n - type : str\n the type to check\n - includes : sequence\n list of headers to include in the test code before testing the type\n - language : str\n 'C' or 'C++'\n - expect : int\n if given, will test wether the type has the given number of bytes.\n If not given, will automatically find the size.\n\n Returns:\n status : int\n 0 if the check failed, or the found size of the type if the check succeeded.\"\"\"\n\n # Include \"confdefs.h\" first, so that the header can use HAVE_HEADER_H.\n if context.headerfilename:\n includetext = '#include \"%s\"' % context.headerfilename\n else:\n includetext = ''\n\n if not header:\n header = \"\"\n\n lang, suffix, msg = _lang2suffix(language)\n if msg:\n context.Display(\"Cannot check for %s type: %s\\n\" % (type_name, msg))\n return msg\n\n src = includetext + header\n if not expect is None:\n # Only check if the given size is the right one\n context.Display('Checking %s is %d bytes... ' % (type_name, expect))\n\n # test code taken from autoconf: this is a pretty clever hack to find that\n # a type is of a given size using only compilation. This speeds things up\n # quite a bit compared to straightforward code using TryRun\n src = src + r\"\"\"\ntypedef %s scons_check_type;\n\nint main()\n{\n static int test_array[1 - 2 * !(((long int) (sizeof(scons_check_type))) == %d)];\n test_array[0] = 0;\n\n return 0;\n}\n\"\"\"\n\n st = context.CompileProg(src % (type_name, expect), suffix)\n if not st:\n context.Display(\"yes\\n\")\n _Have(context, \"SIZEOF_%s\" % type_name, expect,\n \"The size of `%s', as computed by sizeof.\" % type_name)\n return expect\n else:\n context.Display(\"no\\n\")\n _LogFailed(context, src, st)\n return 0\n else:\n # Only check if the given size is the right one\n context.Message('Checking size of %s ... ' % type_name)\n\n # We have to be careful with the program we wish to test here since\n # compilation will be attempted using the current environment's flags.\n # So make sure that the program will compile without any warning. For\n # example using: 'int main(int argc, char** argv)' will fail with the\n # '-Wall -Werror' flags since the variables argc and argv would not be\n # used in the program...\n #\n src = src + \"\"\"\n#include <stdlib.h>\n#include <stdio.h>\nint main() {\n printf(\"%d\", (int)sizeof(\"\"\" + type_name + \"\"\"));\n return 0;\n}\n \"\"\"\n st, out = context.RunProg(src, suffix)\n try:\n size = int(out)\n except ValueError:\n # If cannot convert output of test prog to an integer (the size),\n # something went wront, so just fail\n st = 1\n size = 0\n\n if not st:\n context.Display(\"yes\\n\")\n _Have(context, \"SIZEOF_%s\" % type_name, size,\n \"The size of `%s', as computed by sizeof.\" % type_name)\n return size\n else:\n context.Display(\"no\\n\")\n _LogFailed(context, src, st)\n return 0\n\n return 0", "metadata": "root.CheckTypeSize", "header": "['module', '___EOS___']", "index": 424 } ]
[ { "span": "size ", "start_line": 513, "start_column": 12, "end_line": 513, "end_column": 16 } ]
[]
1
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_", "def_", "Check", "Type", "Size_", "(_", "context_", ",_", "type", "\\u", "name_", ",_", "header_", "=_", "None_", ",_", "language_", "=_", "None_", ",_", "expect_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "check", " ", "can", " ", "be", " ", "used", " ", "to", " ", "get", " ", "the", " ", "size", " ", "of", " ", "a", " ", "give", "n", " ", "type", ",", " ", "or", " ", "to", " ", "check", " ", "whe", "ther", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "type", " ", "is", " ", "of", " ", "expected", " ", "size", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "type", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "type", " ", "to", " ", "check", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "include", "s", " ", ":", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "header", "s", " ", "to", " ", "include", " ", "in", " ", "the", " ", "test", " ", "code", " ", "bef", "ore", " ", "testi", "ng", " ", "the", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "language", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "'", "C", "'", " ", "or", " ", "'", "C", "++", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "expect", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "give", "n", ",", " ", "will", " ", "test", " ", "wet", "her", " ", "the", " ", "type", " ", "has", " ", "the", " ", "give", "n", " ", "number", " ", "of", " ", "bytes", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "not", " ", "give", "n", ",", " ", "will", " ", "automati", "call", "y", " ", "find", " ", "the", " ", "size", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "status", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "0", " ", "if", " ", "the", " ", "check", " ", "fail", "ed", ",", " ", "or", " ", "the", " ", "found", " ", "size", " ", "of", " ", "the", " ", "type", " ", "if", " ", "the", " ", "check", " ", "succe", "eded", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Include", " ", "\"", "confd", "ef", "s", ".", "h", "\"", " ", "first", ",", " ", "so", " ", "tha", "t", " ", "the", " ", "header", " ", "can", " ", "use", " ", "HA", "VE", "\\u", "HEAD", "ER", "\\u", "H", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "context_", "._", "header", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "text_", "=_", "'#", "include", " ", "\"%", "s", "\"'_", "%_", "context_", "._", "header", "filename_", "\\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 ", " _", "include", "text_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "header_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lang_", ",_", "suffix_", ",_", "msg_", "=_", "\\u", "lang", "2s", "uff", "ix_", "(_", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "Display_", "(_", "\"", "Cann", "ot", " ", "check", " ", "for", " ", "%", "s", " ", "type", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "type", "\\u", "name_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "include", "text_", "+_", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "expect_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "check", " ", "if", " ", "the", " ", "give", "n", " ", "size", " ", "is", " ", "the", " ", "right", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "Display_", "(_", "'", "Check", "ing", " ", "%", "s", " ", "is", " ", "%", "d", " ", "bytes", "...", " ", "'_", "%_", "(_", "type", "\\u", "name_", ",_", "expect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "code", " ", "take", "n", " ", "from", " ", "autocon", "f", ":", " ", "this", " ", "is", " ", "a", " ", "pretty", " ", "clev", "er", " ", "hack", " ", "to", " ", "find", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "type", " ", "is", " ", "of", " ", "a", " ", "give", "n", " ", "size", " ", "usi", "ng", " ", "only", " ", "compilation", ".", " ", "Thi", "s", " ", "speeds", " ", "thing", "s", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "quite", " ", "a", " ", "bit", " ", "compare", "d", " ", "to", " ", "straight", "forward", " ", "code", " ", "usi", "ng", " ", "Tr", "y", "Run_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "=_", "src_", "+_", "r", "\"\"\"", "\\", "10", ";", "typedef", " ", "%", "s", " ", "scons", "\\u", "check", "\\u", "type", ";", "\\", "10", ";", "\\", "10", ";", "int", " ", "main", "()", "\\", "10", ";", "{", "\\", "10", ";", " ", " ", " ", " ", "static", " ", "int", " ", "test\\u", "array", "[", "1", " ", "-", " ", "2", " ", "*", " ", "!(", "((", "long", " ", "int", ")", " ", "(", "size", "of", "(", "scons", "\\u", "check", "\\u", "type", ")))", " ", "==", " ", "%", "d", ")]", ";", "\\", "10", ";", " ", " ", " ", " ", "test\\u", "array", "[", "0", "]", " ", "=", " ", "0", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "0", ";", "\\", "10", ";}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "st_", "=_", "context_", "._", "Compil", "e", "Prog", "_", "(_", "src_", "%_", "(_", "type", "\\u", "name_", ",_", "expect_", ")_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "Display_", "(_", "\"", "ye", "s", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Ha", "ve_", "(_", "context_", ",_", "\"", "SIZE", "OF", "\\u", "%", "s", "\"_", "%_", "type", "\\u", "name_", ",_", "expect_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "size", " ", "of", " ", "`", "%", "s", "',", " ", "as", " ", "compute", "d", " ", "by", " ", "size", "of", ".\"_", "%_", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "expect_", "\\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 ", " _", "context_", "._", "Display_", "(_", "\"", "no", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Log", "Failed_", "(_", "context_", ",_", "src_", ",_", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\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_", "#", " ", "On", "ly", " ", "check", " ", "if", " ", "the", " ", "give", "n", " ", "size", " ", "is", " ", "the", " ", "right", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "Message_", "(_", "'", "Check", "ing", " ", "size", " ", "of", " ", "%", "s", " ", "...", " ", "'_", "%_", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "to", " ", "be", " ", "care", "ful", " ", "with", " ", "the", " ", "program", " ", "we", " ", "wish", " ", "to", " ", "test", " ", "here", " ", "since_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compilation", " ", "will", " ", "be", " ", "atte", "mpte", "d", " ", "usi", "ng", " ", "the", " ", "current", " ", "environ", "ment", "'", "s", " ", "flags", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "program", " ", "will", " ", "compile", " ", "with", "out", " ", "any", " ", "warn", "ing", ".", " ", "For_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "example", " ", "usi", "ng", ":", " ", "'", "int", " ", "main", "(", "int", " ", "argc", ",", " ", "char", "**", " ", "argv", ")'", " ", "will", " ", "fail", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'-", "Wall", " ", "-", "Wer", "ror", "'", " ", "flags", " ", "sinc", "e", " ", "the", " ", "variab", "les", " ", "argc", " ", "and", " ", "argv", " ", "wou", "ld", " ", "not", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "in", " ", "the", " ", "program", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "=_", "src_", "+_", "\"\"\"", "\\", "10", ";", "#", "include", " ", "<", "stdlib", ".", "h", ">", "\\", "10", ";", "#", "include", " ", "<", "std", "io", ".", "h", ">", "\\", "10", ";", "int", " ", "main", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "printf", "(\"", "%", "d", "\",", " ", "(", "int", ")", "size", "of", "(\"", "\"\"_", "+_", "type", "\\u", "name_", "+_", "\"\"\"", "))", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "0", ";", "\\", "10", ";}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", ",_", "out_", "=_", "context_", "._", "Run", "Prog", "_", "(_", "src_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "int_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "cann", "ot", " ", "convert", " ", "output", " ", "of", " ", "test", " ", "prog", " ", "to", " ", "an", " ", "integ", "er", " ", "(", "the", " ", "size", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "wen", "t", " ", "wr", "ont", ",", " ", "so", " ", "just", " ", "fail_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "Display_", "(_", "\"", "ye", "s", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Ha", "ve_", "(_", "context_", ",_", "\"", "SIZE", "OF", "\\u", "%", "s", "\"_", "%_", "type", "\\u", "name_", ",_", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "size", " ", "of", " ", "`", "%", "s", "',", " ", "as", " ", "compute", "d", " ", "by", " ", "size", "of", ".\"_", "%_", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "size_", "\\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 ", " _", "context_", "._", "Display_", "(_", "\"", "no", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Log", "Failed_", "(_", "context_", ",_", "src_", ",_", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\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_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2 ]
Unused import
open-cloud/xos/xos/tests/instancetest.py
[ { "content": "\"\"\"\n Basic Instance Test\n\n 1) Create a slice1\n 2) Create instance1 on slice1\n\"\"\"\n\nimport os\nimport json\nimport sys\nimport time\n\nsys.path.append(\"/opt/xos\")\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"xos.settings\")\nfrom openstack.manager import OpenStackManager\nfrom core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice\n\nfrom planetstacktest import PlanetStackTest, fail_unless\n\n\n\nif __name__==\"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class InstanceTest(PlanetStackTest):\n\n", "metadata": "root.InstanceTest", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self):\n PlanetStackTest.__init__(self)", "metadata": "root.InstanceTest.__init__", "header": "['class', 'InstanceTest', '(', 'PlanetStackTest', ')', ':', '___EOS___']", "index": 21 }, { "content": " def run_instance1(self):\n slice1Name = self.make_slice_name()\n slice1 = Slice(name = slice1Name,\n omf_friendly=True,\n site=self.testSite,\n creator=self.testUser)\n slice1=self.save_and_wait_for_enacted(slice1, nonempty_fields=[\"tenant_id\"])\n\n instance1 = Instance(image = self.testImage,\n creator=self.testUser,\n slice=slice1,\n node=self.testNode,\n deploymentNetwork=self.testDeployment)\n instance1=self.save_and_wait_for_enacted(instance1, nonempty_fields=[\"instance_id\", \"ip\"])", "metadata": "root.InstanceTest.run_instance1", "header": "['class', 'InstanceTest', '(', 'PlanetStackTest', ')', ':', '___EOS___']", "index": 24 }, { "content": " def run(self):\n self.setup()\n try:\n self.run_instance1()\n finally:\n self.cleanup()", "metadata": "root.InstanceTest.run", "header": "['class', 'InstanceTest', '(', 'PlanetStackTest', ')', ':', '___EOS___']", "index": 39 }, { "content": "def main():\n InstanceTest().run()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 46 } ]
[ { "span": "import json", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 11 }, { "span": "import time", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 11 }, { "span": "from openstack.manager import OpenStackManager", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 46 }, { "span": "from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 148 }, { "span": "from planetstacktest import PlanetStackTest, fail_unless", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Basic", " ", "Insta", "nce", " ", "Test", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Creat", "e", " ", "a", " ", "slice", "1", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "Creat", "e", " ", "instance", "1", " ", "on", " ", "slice", "1", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "\"/", "opt", "/", "xo", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "setdefault_", "(_", "\"", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "\"_", ",_", "\"", "xo", "s", ".", "settings", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openstack_", "._", "manager_", "import_", "Open", "Stack", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "Slice_", ",_", "Instance_", ",_", "Service", "Class_", ",_", "Reserva", "tion_", ",_", "Tag_", ",_", "Network_", ",_", "User_", ",_", "Node_", ",_", "Image_", ",_", "Deployment", "_", ",_", "Site_", ",_", "Network", "Template_", ",_", "Network", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "planets", "tack", "test_", "import_", "Planet", "Stack", "Test_", ",_", "fail", "\\u", "unl", "ess_", "\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Insta", "nce", "Test_", "(_", "Planet", "Stack", "Test_", ")_", ":_", "\\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_", "Insta", "nce", "Test_", "(_", "Planet", "Stack", "Test_", ")_", ":_", "\\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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Planet", "Stack", "Test_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Test_", "(_", "Planet", "Stack", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "instance", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "1", "Name_", "=_", "self_", "._", "make", "\\u", "slice", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "1_", "=_", "Slice_", "(_", "name_", "=_", "slice", "1", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "om", "f", "\\u", "frie", "ndl", "y_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "self_", "._", "test", "Site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "self_", "._", "test", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "1_", "=_", "self_", "._", "save", "\\u", "and", "\\u", "wait", "\\u", "for", "\\u", "ena", "cte", "d_", "(_", "slice", "1_", ",_", "none", "mpty", "\\u", "fields_", "=_", "[_", "\"", "tenan", "t", "\\u", "id", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "1_", "=_", "Instance_", "(_", "image_", "=_", "self_", "._", "test", "Image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "self_", "._", "test", "User_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice_", "=_", "slice", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "self_", "._", "test", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "ment", "Network_", "=_", "self_", "._", "test", "Deployment", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "1_", "=_", "self_", "._", "save", "\\u", "and", "\\u", "wait", "\\u", "for", "\\u", "ena", "cte", "d_", "(_", "instance", "1_", ",_", "none", "mpty", "\\u", "fields_", "=_", "[_", "\"", "instance", "\\u", "id", "\"_", ",_", "\"", "ip", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Insta", "nce", "Test_", "(_", "Planet", "Stack", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "instance", "1_", "(_", ")_", "\\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 ", " _", "self_", "._", "cleanup_", "(_", ")_", "\\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_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Insta",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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, 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, 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 ]
Variable defined multiple times
ipython/ipython-py3k/IPython/utils/tests/test_process.py
[ { "content": " def test_getoutput(self):\n out = getoutput('python \"%s\"' % self.fname)\n self.assertEquals(out, 'on stdout')", "metadata": "root.SubProcessTestCase.test_getoutput", "header": "['class', 'SubProcessTestCase', '(', 'TestCase', ',', 'tt', '.', 'TempFileMixin', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_getoutput(self):\n out, err = getoutputerror('python \"%s\"' % self.fname)\n self.assertEquals(out, 'on stdout')\n self.assertEquals(err, 'on stderr')", "metadata": "root.SubProcessTestCase.test_getoutput", "header": "['class', 'SubProcessTestCase', '(', 'TestCase', ',', 'tt', '.', 'TempFileMixin', ')', ':', '___EOS___']", "index": 94 } ]
[ { "span": "test_getoutput(", "start_line": 90, "start_column": 8, "end_line": 90, "end_column": 22 } ]
[ { "span": "test_getoutput(", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 22 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Sub", "Process", "Test", "Case_", "(_", "Test", "Case_", ",_", "tt_", "._", "Temp", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "getoutput_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "getoutput_", "(_", "'", "python", " ", "\"%", "s", "\"'_", "%_", "self_", "._", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "out_", ",_", "'", "on", " ", "stdout", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Process", "Test", "Case_", "(_", "Test", "Case_", ",_", "tt_", "._", "Temp", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "getoutput_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", ",_", "err_", "=_", "geto", "ut", "put", "error_", "(_", "'", "python", " ", "\"%", "s", "\"'_", "%_", "self_", "._", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "out_", ",_", "'", "on", " ", "stdout", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "err_", ",_", "'", "on", " ", "std", "err", "'_", ")_" ]
[ 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
danjac/Flask-Mail/tests.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import with_statement\n\nimport unittest\nimport mailbox\n\nfrom email import encoders\n\nfrom flask import Flask, g\nfrom flaskext.mail import Mail, Message, BadHeaderError, Attachment\n\nfrom nose.tools import assert_equal\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCase(unittest.TestCase):\n\n TESTING = True\n DEFAULT_MAIL_SENDER = \"support@mysite.com\"\n\n", "metadata": "root.TestCase", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setUp(self):\n\n self.app = Flask(__name__)\n self.app.config.from_object(self)\n \n assert self.app.testing\n\n self.mail = Mail(self.app)\n\n self.ctx = self.app.test_request_context()\n self.ctx.push()", "metadata": "root.TestCase.setUp", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def tearDown(self):\n\n self.ctx.pop()", "metadata": "root.TestCase.tearDown", "header": "['class', 'TestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": "class TestMessage(TestCase):\n\n\n\n\n \n\n \n\n\n\n\n \n\n\n", "metadata": "root.TestMessage", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def test_initialize(self):\n\n msg = Message(subject=\"subject\",\n recipients=[\"to@example.com\"])\n\n\n assert msg.sender == \"support@mysite.com\"\n assert msg.recipients == [\"to@example.com\"]", "metadata": "root.TestMessage.test_initialize", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_recipients_properly_initialized(self):\n\n msg = Message(subject=\"subject\")\n\n assert msg.recipients == []\n\n msg2 = Message(subject=\"subject\")\n msg2.add_recipient(\"somebody@here.com\")\n\n assert len(msg.recipients) == 0\n\n msg3 = Message(subject=\"subject\")\n msg3.add_recipient(\"somebody@here.com\")\n\n assert len(msg.recipients) == 0", "metadata": "root.TestMessage.test_recipients_properly_initialized", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_add_recipient(self):\n\n msg = Message(\"testing\")\n msg.add_recipient(\"to@example.com\")\n\n assert msg.recipients == [\"to@example.com\"]", "metadata": "root.TestMessage.test_add_recipient", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_sender_as_tuple(self):\n\n msg = Message(subject=\"testing\",\n sender=(\"tester\", \"tester@example.com\"))", "metadata": "root.TestMessage.test_sender_as_tuple", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_send_without_sender(self):\n\n del self.app.config['DEFAULT_MAIL_SENDER']\n\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n\n self.assertRaises(AssertionError, self.mail.send, msg)", "metadata": "root.TestMessage.test_send_without_sender", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_send_without_recipients(self):\n\n msg = Message(subject=\"testing\",\n recipients=[],\n body=\"testing\")\n\n self.assertRaises(AssertionError, self.mail.send, msg)", "metadata": "root.TestMessage.test_send_without_recipients", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_send_without_body(self):\n\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"])\n\n self.assertRaises(AssertionError, self.mail.send, msg)\n\n msg.html = \"<b>test</b>\"\n\n self.mail.send(msg)", "metadata": "root.TestMessage.test_send_without_body", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_normal_send(self):\n \"\"\"\n This will not actually send a message unless the mail server\n is set up. The error will be logged but test should still \n pass.\n \"\"\"\n\n self.app.config['TESTING'] = False\n self.mail.init_app(self.app)\n\n with self.mail.record_messages() as outbox:\n\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n\n self.mail.send(msg)\n \n assert len(outbox) == 1\n \n self.app.config['TESTING'] = True", "metadata": "root.TestMessage.test_normal_send", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 105 }, { "content": " def test_attach(self):\n\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n \n msg.attach(data=\"this is a test\", \n content_type=\"text/plain\")\n \n\n a = msg.attachments[0]\n \n assert a.filename is None\n assert a.disposition == 'attachment'\n assert a.content_type == \"text/plain\"\n assert a.data == \"this is a test\"", "metadata": "root.TestMessage.test_attach", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 127 }, { "content": " def test_bad_header_subject(self):\n\n msg = Message(subject=\"testing\\n\\r\",\n sender=\"from@example.com\",\n body=\"testing\",\n recipients=[\"to@example.com\"])\n\n self.assertRaises(BadHeaderError, self.mail.send, msg)", "metadata": "root.TestMessage.test_bad_header_subject", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 145 }, { "content": " def test_bad_header_sender(self):\n\n msg = Message(subject=\"testing\",\n sender=\"from@example.com\\n\\r\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n\n self.assertRaises(BadHeaderError, self.mail.send, msg)", "metadata": "root.TestMessage.test_bad_header_sender", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 154 }, { "content": " def test_bad_header_recipient(self):\n\n msg = Message(subject=\"testing\",\n sender=\"from@example.com\",\n recipients=[\n \"to@example.com\",\n \"to\\r\\n@example.com\"],\n body=\"testing\")\n\n self.assertRaises(BadHeaderError, self.mail.send, msg)", "metadata": "root.TestMessage.test_bad_header_recipient", "header": "['class', 'TestMessage', '(', 'TestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": "class TestMail(TestCase):\n\n", "metadata": "root.TestMail", "header": "['module', '___EOS___']", "index": 175 }, { "content": " def test_send(self):\n\n with self.mail.record_messages() as outbox:\n msg = Message(subject=\"testing\",\n recipients=[\"tester@example.com\"],\n body=\"test\")\n\n self.mail.send(msg)\n\n assert len(outbox) == 1 ", "metadata": "root.TestMail.test_send", "header": "['class', 'TestMail', '(', 'TestCase', ')', ':', '___EOS___']", "index": 177 }, { "content": " def test_send_message(self):\n\n with self.mail.record_messages() as outbox:\n self.mail.send_message(subject=\"testing\",\n recipients=[\"tester@example.com\"],\n body=\"test\")\n\n assert len(outbox) == 1\n\n msg = outbox[0]\n\n assert msg.subject == \"testing\"\n assert msg.recipients == [\"tester@example.com\"]\n assert msg.body == \"test\"", "metadata": "root.TestMail.test_send_message", "header": "['class', 'TestMail', '(', 'TestCase', ')', ':', '___EOS___']", "index": 188 }, { "content": "class TestConnection(TestCase):\n\n\n\n", "metadata": "root.TestConnection", "header": "['module', '___EOS___']", "index": 204 }, { "content": " def test_send_message(self):\n\n with self.mail.record_messages() as outbox:\n with self.mail.connect() as conn:\n conn.send_message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n\n assert len(outbox) == 1", "metadata": "root.TestConnection.test_send_message", "header": "['class', 'TestConnection', '(', 'TestCase', ')', ':', '___EOS___']", "index": 206 }, { "content": " def test_send_single(self):\n\n with self.mail.record_messages() as outbox:\n with self.mail.connect() as conn:\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n\n conn.send(msg)\n\n assert len(outbox) == 1", "metadata": "root.TestConnection.test_send_single", "header": "['class', 'TestConnection', '(', 'TestCase', ')', ':', '___EOS___']", "index": 216 }, { "content": " def test_send_many(self):\n \n messages = []\n\n with self.mail.record_messages() as outbox:\n with self.mail.connect() as conn:\n for i in xrange(100):\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n \n conn.send(msg)\n\n assert len(outbox) == 100", "metadata": "root.TestConnection.test_send_many", "header": "['class', 'TestConnection', '(', 'TestCase', ')', ':', '___EOS___']", "index": 228 }, { "content": " def test_max_emails(self):\n \n messages = []\n\n with self.mail.record_messages() as outbox:\n with self.mail.connect(max_emails=10) as conn:\n for i in xrange(100):\n msg = Message(subject=\"testing\",\n recipients=[\"to@example.com\"],\n body=\"testing\")\n \n conn.send(msg)\n\n print conn.num_emails\n if i % 10 == 0:\n assert conn.num_emails == 1\n\n assert len(outbox) == 100", "metadata": "root.TestConnection.test_max_emails", "header": "['class', 'TestConnection', '(', 'TestCase', ')', ':', '___EOS___']", "index": 243 } ]
[ { "span": "import mailbox", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 14 }, { "span": "from email import encoders", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 26 }, { "span": "from flask import Flask, g", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 26 }, { "span": "from flaskext.mail import Mail, Message, BadHeaderError, Attachment", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 67 }, { "span": "from nose.tools import assert_equal", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 35 } ]
[]
1
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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mailbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "email_", "import_", "encoders", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "ske", "xt_", "._", "mail_", "import_", "Mail_", ",_", "Message_", ",_", "Ba", "d", "Head", "er", "Error_", ",_", "Attachment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "equal_", "\\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\\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_", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TESTING", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "MAIL", "\\u", "SEND", "ER_", "=_", "\"", "support", "@", "mys", "ite", ".", "com", "\"_", "\\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", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "config_", "._", "from", "\\u", "object_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "app_", "._", "testing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mail_", "=_", "Mail_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ctx_", "=_", "self_", "._", "app_", "._", "test\\u", "request", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ctx_", "._", "push_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctx_", "._", "pop_", "(_", ")_", "\\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", "Message_", "(_", "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\\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\\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_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "subject", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "msg_", "._", "sender_", "==_", "\"", "support", "@", "mys", "ite", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "msg_", "._", "recipients_", "==_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recip", "ients", "\\u", "proper", "ly", "\\u", "initialized_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "subject", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "msg_", "._", "recipients_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "2_", "=_", "Message_", "(_", "subject_", "=_", "\"", "subject", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "2_", "._", "add", "\\u", "recipient_", "(_", "\"", "some", "body", "@", "here", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "msg_", "._", "recipients_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "3_", "=_", "Message_", "(_", "subject_", "=_", "\"", "subject", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "3_", "._", "add", "\\u", "recipient_", "(_", "\"", "some", "body", "@", "here", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "msg_", "._", "recipients_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "recipient_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "add", "\\u", "recipient_", "(_", "\"", "to", "@", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "msg_", "._", "recipients_", "==_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sender", "\\u", "as", "\\u", "tuple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sender_", "=_", "(_", "\"", "teste", "r", "\"_", ",_", "\"", "teste", "r", "@", "example", ".", "com", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "send", "\\u", "with", "out", "\\u", "sender_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "app_", "._", "config_", "[_", "'", "DEF", "AUL", "T", "\\u", "MAIL", "\\u", "SEND", "ER", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "self_", "._", "mail_", "._", "send_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "send", "\\u", "with", "out", "\\u", "recipients_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "self_", "._", "mail_", "._", "send_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "send", "\\u", "with", "out", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Assert", "ion", "Error_", ",_", "self_", "._", "mail_", "._", "send_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "html_", "=_", "\"<", "b", ">", "test", "</", "b", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mail_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "normal", "\\u", "send_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "not", " ", "actual", "ly", " ", "send", " ", "a", " ", "message", " ", "unl", "ess", " ", "the", " ", "mail", " ", "server", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "set", " ", "up", ".", " ", "The", " ", "error", " ", "will", " ", "be", " ", "logged", " ", "but", " ", "test", " ", "shou", "ld", " ", "still", " ", "\\", "10", ";", " ", " ", " ", " ", "pass", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "config_", "[_", "'", "TESTING", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mail_", "._", "init", "\\u", "app_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mail_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "app_", "._", "config_", "[_", "'", "TESTING", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "attach_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "._", "attach_", "(_", "data_", "=_", "\"", "this", " ", "is", " ", "a", " ", "test", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "msg_", "._", "attachments_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "a_", "._", "filename_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "a_", "._", "disposition", "_", "==_", "'", "attach", "ment", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "a_", "._", "content", "\\u", "type_", "==_", "\"", "text", "/", "plain", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "a_", "._", "data_", "==_", "\"", "this", " ", "is", " ", "a", " ", "test", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "header", "\\u", "subject_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\\\\", "n", "\\\\", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sender_", "=_", "\"", "from", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ba", "d", "Head", "er", "Error_", ",_", "self_", "._", "mail_", "._", "send_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "header", "\\u", "sender_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sender_", "=_", "\"", "from", "@", "example", ".", "com", "\\\\", "n", "\\\\", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ba", "d", "Head", "er", "Error_", ",_", "self_", "._", "mail_", "._", "send_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Message_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "header", "\\u", "recipient_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sender_", "=_", "\"", "from", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", "\\\\", "r", "\\\\", "n", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Ba", "d", "Head", "er", "Error_", ",_", "self_", "._", "mail_", "._", "send_", ",_", "msg_", ")_", "\\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", "Mail_", "(_", "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", "Mail_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "send_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "teste", "r", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mail_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Mail_", "(_", "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", "send", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mail_", "._", "send", "\\u", "message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "teste", "r", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "outbox_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "msg_", "._", "subject_", "==_", "\"", "testi", "ng", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "msg_", "._", "recipients_", "==_", "[_", "\"", "teste", "r", "@", "example", ".", "com", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "msg_", "._", "body_", "==_", "\"", "test", "\"_", "\\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_", "Test", "Connection_", "(_", "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_", "[SEP]_", "class_", "Test", "Connection_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "send", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "connect_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "send", "\\u", "message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "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", "send", "\\u", "single_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "connect_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "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", "send", "\\u", "many_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "connect_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "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", "max", "\\u", "emails_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "mail_", "._", "record", "\\u", "messages_", "(_", ")_", "as_", "outbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "mail_", "._", "connect_", "(_", "max", "\\u", "emails_", "=_", "10_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "Message_", "(_", "subject_", "=_", "\"", "testi", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recipients_", "=_", "[_", "\"", "to", "@", "example", ".", "com", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "\"", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "send_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "conn_", "._", "num", "\\u", "emails_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "assert_", "conn_", "._", "num", "\\u", "emails_", "==_", "1_", "\\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_", "assert_", "len_", "(_", "outbox_", ")_", "==_", "100_" ]
[ 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, 0, 1, 2, 2, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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, 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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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 ]
Imprecise assert
letsencrypt/letsencrypt/certbot/tests/reporter_test.py
[ { "content": " def test_multiline_message(self):\n self.reporter.add_message(\"Line 1\\nLine 2\", self.reporter.LOW_PRIORITY)\n self.reporter.atexit_print_messages()\n output = sys.stdout.getvalue()\n self.assertTrue(\"Line 1\\n\" in output)\n self.assertTrue(\"Line 2\" in output)", "metadata": "root.ReporterTest.test_multiline_message", "header": "['class', 'ReporterTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_atexit_print_messages(self):\n self._add_messages()\n self.reporter.atexit_print_messages()\n output = sys.stdout.getvalue()\n self.assertTrue(\"IMPORTANT NOTES:\" in output)\n self.assertTrue(\"High\" in output)\n self.assertTrue(\"Med\" in output)\n self.assertTrue(\"Low\" in output)", "metadata": "root.ReporterTest.test_atexit_print_messages", "header": "['class', 'ReporterTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def _successful_exit_common(self):\n self._add_messages()\n self.reporter.print_messages()\n output = sys.stdout.getvalue()\n self.assertTrue(\"IMPORTANT NOTES:\" in output)\n self.assertTrue(\"High\" in output)\n self.assertTrue(\"Med\" in output)\n self.assertTrue(\"Low\" in output)", "metadata": "root.ReporterTest._successful_exit_common", "header": "['class', 'ReporterTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def _unsuccessful_exit_common(self):\n self._add_messages()\n try:\n raise ValueError\n except ValueError:\n self.reporter.print_messages()\n output = sys.stdout.getvalue()\n self.assertTrue(\"IMPORTANT NOTES:\" in output)\n self.assertTrue(\"High\" in output)\n self.assertTrue(\"Med\" not in output)\n self.assertTrue(\"Low\" not in output)", "metadata": "root.ReporterTest._unsuccessful_exit_common", "header": "['class', 'ReporterTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "self.assertTrue(\"Line 1\\n\" in output)", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 45 }, { "span": "self.assertTrue(\"Line 2\" in output)", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 43 }, { "span": "self.assertTrue(\"IMPORTANT NOTES:\" in output)", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 53 }, { "span": "self.assertTrue(\"High\" in output)", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 41 }, { "span": "self.assertTrue(\"Med\" in output)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 40 }, { "span": "self.assertTrue(\"Low\" in output)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 40 }, { "span": "self.assertTrue(\"IMPORTANT NOTES:\" in output)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 53 }, { "span": "self.assertTrue(\"High\" in output)", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 41 }, { "span": "self.assertTrue(\"Med\" in output)", "start_line": 70, "start_column": 8, "end_line": 70, "end_column": 40 }, { "span": "self.assertTrue(\"Low\" in output)", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 40 }, { "span": "self.assertTrue(\"IMPORTANT NOTES:\" in output)", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 53 }, { "span": "self.assertTrue(\"High\" in output)", "start_line": 81, "start_column": 8, "end_line": 81, "end_column": 41 }, { "span": "self.assertTrue(\"Med\" not in output)", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 44 }, { "span": "self.assertTrue(\"Low\" not in output)", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Reporte", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiline", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reporter_", "._", "add", "\\u", "message_", "(_", "\"", "Line", " ", "1", "\\\\", "n", "Line", " ", "2", "\"_", ",_", "self_", "._", "reporter_", "._", "LOW", "\\u", "PRIORITY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "._", "ate", "xit", "\\u", "print", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "sys_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Line", " ", "1", "\\\\", "n", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Line", " ", "2", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reporte", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ate", "xit", "\\u", "print", "\\u", "messages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "add", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "._", "ate", "xit", "\\u", "print", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "sys_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "IMPORT", "ANT", " ", "NOTE", "S", ":\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Hig", "h", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Med", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Lo", "w", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reporte", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "success", "ful", "\\u", "exit", "\\u", "common_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "add", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reporter_", "._", "print", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "sys_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "IMPORT", "ANT", " ", "NOTE", "S", ":\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Hig", "h", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Med", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Lo", "w", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reporte", "r", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unsuc", "cess", "ful", "\\u", "exit", "\\u", "common_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "add", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\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_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reporter_", "._", "print", "\\u", "messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "sys_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "IMPORT", "ANT", " ", "NOTE", "S", ":\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Hig", "h", "\"_", "in_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Med", "\"_", "not_", "in_", "output_", ")_", "\\u\\u\\uN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 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
kdart/pycopia/WWW/pycopia/WWW/HTML5lxml.py
[ { "content": "#!/usr/bin/python2.7\n# -*- coding: utf-8 -*-\n# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab\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\"\"\"\nDocument generation for HTML5.\n\n\"\"\"\n\nBASIC = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <title>JavaScript Playground.</title>\n <script src=\"program.js\" type=\"text/javascript;version=1.8\"></script>\n</head>\n<body>\n <pre id=\"work\">\n </pre>\n</body>\n</html>\n\"\"\"\n\n#import locale\n\n#import lxml\nfrom lxml.builder import E\nfrom lxml import etree\n\n#from lxml import etree\n#lxml.html.html5parser\n\n\n\n\nDEFAULT_LANG, DEFAULT_ENCODING = \"en\", \"UTF-8\"\nMIME_XHTML5=\"application/xhtml+xml\"\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n from pycopia import autodebug\n doc = new_document()\n print str(doc)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ContainerMixin(object):", "metadata": "root.ContainerMixin", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def __init__(self, encoding=DEFAULT_ENCODING, language=\"en\"):\n self.encoding = encoding\n self.language = language", "metadata": "root.ContainerMixin.__init__", "header": "['class', 'ContainerMixin', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": "class HTML5Document(ContainerMixin):\n \"\"\"HTML5Document represents the top-level document of an HTML5 document.\n \"\"\"\n XMLHEADER = '<?xml version=\"1.0\" encoding=\"%s\"?>\\n' % DEFAULT_ENCODING\n MIMETYPE=MIME_XHTML5\n DOCTYPE = '<!DOCTYPE html>\\n'\n\n\n\n\n\n", "metadata": "root.HTML5Document", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def initialize(self):\n head = E(\"head\")\n body = E(\"body\")\n self.root = E(\"html\", head, body, lang=self.language, xmlns=\"http://www.w3.org/1999/xhtml\")\n self.head = head\n self.body = body\n meta = E(\"meta\", content=self.MIMETYPE, charset=self.encoding)\n meta.attrib[\"http-equiv\"] = \"Content-Type\"\n self.head.append(meta)", "metadata": "root.HTML5Document.initialize", "header": "['class', 'HTML5Document', '(', 'ContainerMixin', ')', ':', '___EOS___']", "index": 65 }, { "content": " def set_encoding(self, encoding):\n self.XMLHEADER = '<?xml version=\"1.0\" encoding=\"%s\"?>\\n' % (encoding,)\n self.encoding = encoding", "metadata": "root.HTML5Document.set_encoding", "header": "['class', 'HTML5Document', '(', 'ContainerMixin', ')', ':', '___EOS___']", "index": 76 }, { "content": " def __str__(self):\n return self.encode(self.encoding, True)", "metadata": "root.HTML5Document.__str__", "header": "['class', 'HTML5Document', '(', 'ContainerMixin', ')', ':', '___EOS___']", "index": 80 }, { "content": " def encode(self, encoding=DEFAULT_ENCODING, pretty=False):\n if encoding != self.encoding:\n self.set_encoding(encoding)\n return self.XMLHEADER + self.DOCTYPE + etree.tostring(self.root, \n pretty_print=pretty, encoding=self.encoding)", "metadata": "root.HTML5Document.encode", "header": "['class', 'HTML5Document', '(', 'ContainerMixin', ')', ':', '___EOS___']", "index": 83 }, { "content": " def emit(self, fo, encoding=DEFAULT_ENCODING):\n if encoding != self.encoding:\n self.set_encoding(encoding)\n fo.write(self.XMLHEADER)\n fo.write(self.DOCTYPE)\n self.root.emit(fo, encoding)\n fo.write(\"\\n\")", "metadata": "root.HTML5Document.emit", "header": "['class', 'HTML5Document', '(', 'ContainerMixin', ')', ':', '___EOS___']", "index": 89 }, { "content": "def new_document(mimetype=None, encoding=DEFAULT_ENCODING, language=DEFAULT_LANG):\n doc = HTML5Document(encoding, language)\n doc.initialize()\n return doc", "metadata": "root.new_document", "header": "['module', '___EOS___']", "index": 98 } ]
[ { "span": "from pycopia import autodebug", "start_line": 106, "start_column": 4, "end_line": 106, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2.7", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "ts", "=", "4", ":", "sw", "=", "4", ":", "soft", "tabs", "top", "=", "4", ":", "smart", "tab", ":", "expand", "tab_", "\\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_", "\"\"\"", "\\", "10", ";", "Document", " ", "generat", "ion", " ", "for", " ", "HTM", "L", "5", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "BASIC", "_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">", "\\", "10", ";<", "!", "DOC", "TYPE", " ", "html", ">", "\\", "10", ";<", "html", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "xh", "tml", "\">", "\\", "10", ";<", "head", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "title", ">", "Ja", "va", "Script", " ", "Play", "ground", ".", "</", "title", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "script", " ", "src", "=\"", "program", ".", "js", "\"", " ", "type", "=\"", "text", "/", "javascript", ";", "version", "=", "1.8", "\">", "</", "script", ">", "\\", "10", ";<", "/", "head", ">", "\\", "10", ";<", "body", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "pre", " ", "id", "=\"", "work", "\">", "\\", "10", ";", " ", " ", " ", " ", "</", "pre", ">", "\\", "10", ";<", "/", "body", ">", "\\", "10", ";<", "/", "html", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "locale_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "lxml_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lxml_", "._", "builder_", "import_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "lx", "ml", " ", "import", " ", "etree_", "\\u\\u\\uNL\\u\\u\\u_", "#", "lx", "ml", ".", "html", ".", "html", "5", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "LANG_", ",_", "DEF", "AUL", "T", "\\u", "ENCODING_", "=_", "\"", "en", "\"_", ",_", "\"", "UT", "F", "-", "8", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MIME", "\\u", "XH", "TML", "5_", "=_", "\"", "applica", "tion", "/", "xh", "tml", "+", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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\\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 ", " _", "from_", "pycopia_", "import_", "autode", "bug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "new", "\\u", "document_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "str_", "(_", "doc_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Containe", "r", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Containe", "r", "Mixin_", "(_", "object_", ")_", ":_", "\\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_", ",_", "encoding_", "=_", "DEF", "AUL", "T", "\\u", "ENCODING_", ",_", "language_", "=_", "\"", "en", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "encoding_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "language_", "=_", "language_", "\\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_", "HTM", "L", "5", "Document_", "(_", "Containe", "r", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "HTM", "L", "5", "Document", " ", "represent", "s", " ", "the", " ", "top", "-", "level", " ", "document", " ", "of", " ", "an", " ", "HTM", "L", "5", " ", "document", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XML", "HEADER_", "=_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "%", "s", "\"?", ">\\\\", "n", "'_", "%_", "DEF", "AUL", "T", "\\u", "ENCODING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MIME", "TYPE_", "=_", "MIME", "\\u", "XH", "TML", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DOC", "TYPE_", "=_", "'<!", "DOC", "TYPE", " ", "html", ">\\\\", "n", "'_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "HTM", "L", "5", "Document_", "(_", "Containe", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "head_", "=_", "E_", "(_", "\"", "head", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "E_", "(_", "\"", "body", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "=_", "E_", "(_", "\"", "html", "\"_", ",_", "head_", ",_", "body_", ",_", "lang_", "=_", "self_", "._", "language_", ",_", "xmlns_", "=_", "\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "xh", "tml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "head_", "=_", "head_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "E_", "(_", "\"", "meta", "\"_", ",_", "content_", "=_", "self_", "._", "MIME", "TYPE_", ",_", "charset_", "=_", "self_", "._", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "._", "attrib_", "[_", "\"", "http", "-", "equiv", "\"_", "]_", "=_", "\"", "Conten", "t", "-", "Type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "head_", "._", "append_", "(_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HTM", "L", "5", "Document_", "(_", "Containe", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "encoding_", "(_", "self_", ",_", "encoding_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "XML", "HEADER_", "=_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "%", "s", "\"?", ">\\\\", "n", "'_", "%_", "(_", "encoding_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encoding_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HTM", "L", "5", "Document_", "(_", "Containe", "r", "Mixin_", ")_", ":_", "\\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 ", " _", "return_", "self_", "._", "encode_", "(_", "self_", "._", "encoding_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HTM", "L", "5", "Document_", "(_", "Containe", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ",_", "encoding_", "=_", "DEF", "AUL", "T", "\\u", "ENCODING_", ",_", "pretty_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "encoding_", "!=_", "self_", "._", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "encoding_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "XML", "HEADER_", "+_", "self_", "._", "DOC", "TYPE_", "+_", "etree_", "._", "tostring_", "(_", "self_", "._", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pretty", "\\u", "print_", "=_", "pretty_", ",_", "encoding_", "=_", "self_", "._", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HTM", "L", "5", "Document_", "(_", "Containe", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "emit_", "(_", "self_", ",_", "fo_", ",_", "encoding_", "=_", "DEF", "AUL", "T", "\\u", "ENCODING_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "encoding_", "!=_", "self_", "._", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "encoding_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fo_", "._", "write_", "(_", "self_", "._", "XML", "HEADER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "._", "write_", "(_", "self_", "._", "DOC", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "._", "emit_", "(_", "fo_", ",_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\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_", "new", "\\u", "document_", "(_", "mimetype_", "=_", "None_", ",_", "encoding_", "=_", "DEF", "AUL", "T", "\\u", "ENCODING_", ",_", "language_", "=_", "DEF", "AUL", "T", "\\u", "LANG_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "HTM", "L", "5", "Document_", "(_", "encoding_", ",_", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "doc_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
disqus/playa/playa/ext/audio/playlists.py
[ { "content": "\"\"\"\nplaya.ext.audio.playlists\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2011 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport os.path\n\nfrom playa.common.storage import load, save\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Playlists(object):\n", "metadata": "root.Playlists", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, app):\n self.app = app\n self.playlists = {}\n self.add_path(os.path.join(self.app.config['DATA_PATH'], 'playlists'))", "metadata": "root.Playlists.__init__", "header": "['class', 'Playlists', '(', 'object', ')', ':', '___EOS___']", "index": 15 }, { "content": " def add_path(self, path, base=None):\n if not base:\n base = path\n for fn in os.listdir(path): \n if fn.startswith('.'):\n continue\n\n full_path = os.path.join(path, fn)\n if os.path.isdir(full_path):\n self.add_path(path, base)\n continue\n \n self.playlists[full_path] = load(full_path)", "metadata": "root.Playlists.add_path", "header": "['class', 'Playlists', '(', 'object', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "from playa.common.storage import load, save", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "play", "a", ".", "ext", ".", "audio", ".", "playl", "ists", "\\", "10", ";", "~~~~~~~~~~~", "~~~~~~~~~~~", "~~~", "\\", "10", ";", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2011", " ", "DIS", "QU", "S", ".", "\\", "10", ";", ":", "license", ":", " ", "Ap", "ache", " ", "License", " ", "2.0", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "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_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "play", "a_", "._", "common_", "._", "storage_", "import_", "load_", ",_", "save_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Play", "lists_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Play", "lists_", "(_", "object_", ")_", ":_", "\\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_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "playlists_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "path_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "app_", "._", "config_", "[_", "'", "DATA", "\\u", "PATH", "'_", "]_", ",_", "'", "playl", "ists", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Play", "lists_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "path_", "(_", "self_", ",_", "path_", ",_", "base_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "base_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fn_", "in_", "os_", "._", "listdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fn_", "._", "startswith_", "(_", "'.'_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "full", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "path_", "(_", "path_", ",_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "playlists_", "[_", "full", "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core/daemon/core/emane/commeffect.py
[ { "content": "#\n# CORE\n# Copyright (c)2010-2014 the Boeing Company.\n# See the LICENSE file included in this distribution.\n#\n# authors: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>\n# Randy Charland <rcharland@ll.mit.edu>\n#\n'''\ncommeffect.py: EMANE CommEffect model for CORE\n'''\n\nimport sys\nimport string\ntry:\n from emanesh.events import EventService\nexcept:\n pass\nfrom core.api import coreapi\nfrom core.constants import *\nfrom emane import Emane, EmaneModel\n\ntry:\n import emaneeventservice\n import emaneeventcommeffect\nexcept Exception, e:\n pass\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EmaneCommEffectModel(EmaneModel):\n\n # model name\n _name = \"emane_commeffect\"\n # CommEffect parameters\n _confmatrix_shim_base = [\n (\"filterfile\", coreapi.CONF_DATA_TYPE_STRING, '',\n '', 'filter file'),\n (\"groupid\", coreapi.CONF_DATA_TYPE_UINT32, '0',\n '', 'NEM Group ID'),\n (\"enablepromiscuousmode\", coreapi.CONF_DATA_TYPE_BOOL, '0',\n 'On,Off', 'enable promiscuous mode'),\n (\"receivebufferperiod\", coreapi.CONF_DATA_TYPE_FLOAT, '1.0',\n '', 'receivebufferperiod'),\n ]\n _confmatrix_shim_081 = [\n (\"defaultconnectivity\", coreapi.CONF_DATA_TYPE_BOOL, '0',\n 'On,Off', 'defaultconnectivity'),\n (\"enabletighttimingmode\", coreapi.CONF_DATA_TYPE_BOOL, '0',\n 'On,Off', 'enable tight timing mode'),\n ]\n _confmatrix_shim_091 = [\n (\"defaultconnectivitymode\", coreapi.CONF_DATA_TYPE_BOOL, '0',\n 'On,Off', 'defaultconnectivity'),\n ]\n if Emane.version >= Emane.EMANE091:\n _confmatrix_shim = _confmatrix_shim_base + _confmatrix_shim_091\n else:\n _confmatrix_shim = _confmatrix_shim_base + _confmatrix_shim_081\n\n _confmatrix = _confmatrix_shim\n # value groupings\n _confgroups = \"CommEffect SHIM Parameters:1-%d\" \\\n % len(_confmatrix_shim)\n\n", "metadata": "root.EmaneCommEffectModel", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def __init__(self, session, objid = None, verbose = False):\n EmaneModel.__init__(self, session, objid, verbose)", "metadata": "root.EmaneCommEffectModel.__init__", "header": "['class', 'EmaneCommEffectModel', '(', 'EmaneModel', ')', ':', '___EOS___']", "index": 29 }, { "content": " def buildnemxmlfiles(self, e, ifc):\n ''' Build the necessary nem and commeffect XMLs in the given path.\n If an individual NEM has a nonstandard config, we need to build\n that file also. Otherwise the WLAN-wide\n nXXemane_commeffectnem.xml, nXXemane_commeffectshim.xml are used.\n '''\n values = e.getifcconfig(self.objid, self._name,\n self.getdefaultvalues(), ifc)\n if values is None:\n return\n shimdoc = e.xmldoc(\"shim\")\n shim = shimdoc.getElementsByTagName(\"shim\").pop()\n shim.setAttribute(\"name\", \"commeffect SHIM\")\n shim.setAttribute(\"library\", \"commeffectshim\")\n\n names = self.getnames()\n shimnames = list(names[:len(self._confmatrix_shim)])\n shimnames.remove(\"filterfile\")\n\n # append all shim options (except filterfile) to shimdoc\n map( lambda n: shim.appendChild(e.xmlparam(shimdoc, n, \\\n self.valueof(n, values))), shimnames)\n # empty filterfile is not allowed\n ff = self.valueof(\"filterfile\", values)\n if ff.strip() != '':\n shim.appendChild(e.xmlparam(shimdoc, \"filterfile\", ff))\n e.xmlwrite(shimdoc, self.shimxmlname(ifc))\n\n nemdoc = e.xmldoc(\"nem\")\n nem = nemdoc.getElementsByTagName(\"nem\").pop()\n nem.setAttribute(\"name\", \"commeffect NEM\")\n nem.setAttribute(\"type\", \"unstructured\")\n e.appendtransporttonem(nemdoc, nem, self.objid, ifc)\n nem.appendChild(e.xmlshimdefinition(nemdoc, self.shimxmlname(ifc)))\n e.xmlwrite(nemdoc, self.nemxmlname(ifc))", "metadata": "root.EmaneCommEffectModel.buildnemxmlfiles", "header": "['class', 'EmaneCommEffectModel', '(', 'EmaneModel', ')', ':', '___EOS___']", "index": 65 }, { "content": " def linkconfig(self, netif, bw = None, delay = None,\n loss = None, duplicate = None, jitter = None, netif2 = None):\n ''' Generate CommEffect events when a Link Message is received having\n link parameters.\n '''\n if self.session.emane.version >= self.session.emane.EMANE091:\n raise NotImplementedError, \\\n \"CommEffect linkconfig() not implemented for EMANE 0.9.1+\"\n def z(x):\n ''' Helper to use 0 for None values. '''\n if type(x) is str:\n x = float(x)\n if x is None:\n return 0\n else:\n return int(x)\n\n service = self.session.emane.service\n if service is None:\n self.session.warn(\"%s: EMANE event service unavailable\" % \\\n self._name)\n return\n if netif is None or netif2 is None:\n self.session.warn(\"%s: missing NEM information\" % self._name)\n return\n # TODO: batch these into multiple events per transmission\n # TODO: may want to split out seconds portion of delay and jitter\n event = emaneeventcommeffect.EventCommEffect(1)\n index = 0\n e = self.session.obj(self.objid)\n nemid = e.getnemid(netif)\n nemid2 = e.getnemid(netif2)\n mbw = bw\n\n event.set(index, nemid, 0, z(delay), 0, z(jitter), z(loss),\n z(duplicate), long(z(bw)), long(z(mbw)))\n service.publish(emaneeventcommeffect.EVENT_ID,\n emaneeventservice.PLATFORMID_ANY,\n nemid2, emaneeventservice.COMPONENTID_ANY,\n event.export())", "metadata": "root.EmaneCommEffectModel.linkconfig", "header": "['class', 'EmaneCommEffectModel', '(', 'EmaneModel', ')', ':', '___EOS___']", "index": 101 } ]
[ { "span": "import sys", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 10 }, { "span": "import string", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 13 }, { "span": "from emanesh.events import EventService", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CORE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", "2010", "-", "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", "s", ":", " ", "Je", "ff", " ", "Ah", "ren", "hol", "z", " ", "<", "je", "ff", "rey", ".", "m", ".", "ah", "ren", "hol", "z", "@", "bo", "ein", "g", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Ran", "dy", " ", "Charl", "and", " ", "<", "rch", "arl", "and", "@", "ll", ".", "mit", ".", "edu", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "comm", "effect", ".", "py", ":", " ", "EMA", "NE", " ", "Comm", "Effe", "ct", " ", "model", " ", "for", " ", "CORE", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\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_", "from_", "core_", "._", "api_", "import_", "core", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eman", "e_", "import_", "Ema", "ne_", ",_", "Ema", "ne", "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", "comm", "effect_", "\\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 ", " _", "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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ema", "ne", "Comm", "Effe", "ct", "Model_", "(_", "Ema", "ne", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "model", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "name_", "=_", "\"", "eman", "e\\u", "comm", "effect", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Comm", "Effe", "ct", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "base_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "filter", "file", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "filter", " ", "file", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "groupid", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "UINT", "32_", ",_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "NE", "M", " ", "Group", " ", "ID", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "enable", "promis", "cuo", "usm", "ode", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "BOOL_", ",_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", ",", "Off", "'_", ",_", "'", "enable", " ", "promis", "cuo", "us", " ", "mode", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "receive", "buffer", "period", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "FLOAT_", ",_", "'", "1.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "receive", "buffer", "period", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "081", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "default", "connecti", "vity", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "BOOL_", ",_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", ",", "Off", "'_", ",_", "'", "default", "connecti", "vity", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "enable", "tig", "ht", "tim", "ing", "mode", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "BOOL_", ",_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", ",", "Off", "'_", ",_", "'", "enable", " ", "tig", "ht", " ", "tim", "ing", " ", "mode", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "091", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "default", "connecti", "vity", "mode", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "BOOL_", ",_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", ",", "Off", "'_", ",_", "'", "default", "connecti", "vity", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Ema", "ne_", "._", "version_", ">=_", "Ema", "ne_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "conf", "matrix", "\\u", "shi", "m_", "=_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "base_", "+_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "091", "_", "\\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 ", " _", "\\u", "conf", "matrix", "\\u", "shi", "m_", "=_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "base_", "+_", "\\u", "conf", "matrix", "\\u", "shi", "m", "\\u", "081", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "conf", "matrix_", "=_", "\\u", "conf", "matrix", "\\u", "shi", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "value", " ", "grouping", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "conf", "groups_", "=_", "\"", "Comm", "Effe", "ct", " ", "SHI", "M", " ", "Parameter", "s", ":", "1", "-%", "d", "\"_", "%_", "len_", "(_", "\\u", "conf", "matrix", "\\u", "shi", "m_", ")_", "\\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_", "Ema", "ne", "Comm", "Effe", "ct", "Model_", "(_", "Ema", "ne", "Model_", ")_", ":_", "\\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_", ",_", "session_", ",_", "obji", "d_", "=_", "None_", ",_", "verbose_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Ema", "ne", "Model_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Comm", "Effe", "ct", "Model_", "(_", "Ema", "ne", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build", "nem", "xmlfile", "s_", "(_", "self_", ",_", "e_", ",_", "ifc", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Build", " ", "the", " ", "necessar", "y", " ", "nem", " ", "and", " ", "comm", "effect", " ", "XML", "s", " ", "in", " ", "the", " ", "give", "n", " ", "path", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "an", " ", "individual", " ", "NE", "M", " ", "has", " ", "a", " ", "nons", "tand", "ard", " ", "config", ",", " ", "we", " ", "need", " ", "to", " ", "build", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "file", " ", "als", "o", ".", " ", "Ot", "her", "wis", "e", " ", "the", " ", "WL", "AN", "-", "wide", "\\", "10", ";", " ", " ", " ", " ", "n", "XX", "eman", "e\\u", "comm", "effect", "nem", ".", "xml", ",", " ", "n", "XX", "eman", "e\\u", "comm", "effect", "shi", "m", ".", "xml", " ", "are", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "e_", "._", "geti", "fcc", "onfig_", "(_", "self_", "._", "obji", "d_", ",_", "self_", "._", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "getde", "fault", "values_", "(_", ")_", ",_", "ifc", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "values_", "is_", "None_", ":_", "\\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_", "shi", "mdo", "c_", "=_", "e_", "._", "xmld", "oc_", "(_", "\"", "shi", "m", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shi", "m_", "=_", "shi", "mdo", "c_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "shi", "m", "\"_", ")_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shi", "m_", "._", "set", "Attribute_", "(_", "\"", "name", "\"_", ",_", "\"", "comm", "effect", " ", "SHI", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shi", "m_", "._", "set", "Attribute_", "(_", "\"", "librar", "y", "\"_", ",_", "\"", "comm", "effect", "shi", "m", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "self_", "._", "getn", "ames_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shi", "mn", "ames_", "=_", "list_", "(_", "names_", "[_", ":_", "len_", "(_", "self_", "._", "\\u", "conf", "matrix", "\\u", "shi", "m_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shi", "mn", "ames_", "._", "remove_", "(_", "\"", "filter", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "all", " ", "shi", "m", " ", "options", " ", "(", "except", " ", "filter", "file", ")", " ", "to", " ", "shi", "mdo", "c_", "\\u\\u\\uNL\\u\\u\\u_", "map_", "(_", "lambda_", "n_", ":_", "shi", "m_", "._", "append", "Child_", "(_", "e_", "._", "xml", "param_", "(_", "shi", "mdo", "c_", ",_", "n_", ",_", "self_", "._", "value", "of_", "(_", "n_", ",_", "values_", ")_", ")_", ")_", ",_", "shi", "mn", "ames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "empty", " ", "filter", "file", " ", "is", " ", "not", " ", "allowed_", "\\u\\u\\uNL\\u\\u\\u_", "ff_", "=_", "self_", "._", "value", "of_", "(_", "\"", "filter", "file", "\"_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ff_", "._", "strip_", "(_", ")_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shi", "m_", "._", "append", "Child_", "(_", "e_", "._", "xml", "param_", "(_", "shi", "mdo", "c_", ",_", "\"", "filter", "file", "\"_", ",_", "ff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "._", "xml", "write_", "(_", "shi", "mdo", "c_", ",_", "self_", "._", "shi", "mx", "ml", "name_", "(_", "ifc", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nem", "doc_", "=_", "e_", "._", "xmld", "oc_", "(_", "\"", "nem", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "_", "=_", "nem", "doc_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "nem", "\"_", ")_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "_", "._", "set", "Attribute_", "(_", "\"", "name", "\"_", ",_", "\"", "comm", "effect", " ", "NE", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "_", "._", "set", "Attribute_", "(_", "\"", "type", "\"_", ",_", "\"", "unst", "ruct", "ure", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "append", "transport", "tone", "m_", "(_", "nem", "doc_", ",_", "nem", "_", ",_", "self_", "._", "obji", "d_", ",_", "ifc", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "_", "._", "append", "Child_", "(_", "e_", "._", "xmls", "him", "definition_", "(_", "nem", "doc_", ",_", "self_", "._", "shi", "mx", "ml", "name_", "(_", "ifc", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xml", "write_", "(_", "nem", "doc_", ",_", "self_", "._", "nem", "xml", "name_", "(_", "ifc", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "ne", "Comm", "Effe", "ct", "Model_", "(_", "Ema", "ne", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link", "config_", "(_", "self_", ",_", "neti", "f_", ",_", "bw_", "=_", "None_", ",_", "delay_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loss_", "=_", "None_", ",_", "duplicate_", "=_", "None_", ",_", "jitter_", "=_", "None_", ",_", "neti", "f2_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Generate", " ", "Comm", "Effe", "ct", " ", "events", " ", "whe", "n", " ", "a", " ", "Link", " ", "Messag", "e", " ", "is", " ", "receive", "d", " ", "hav", "ing", "\\", "10", ";", " ", " ", " ", " ", "link", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "eman", "e_", "._", "version_", ">=_", "self_", "._", "session_", "._", "eman", "e_", "._", "EMA", "NE", "091", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", ",_", "\"", "Comm", "Effe", "ct", " ", "link", "config", "()", " ", "not", " ", "implemented", " ", "for", " ", "EMA", "NE", " ", "0.", "9.1", "+\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "z_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Help", "er", " ", "to", " ", "use", " ", "0", " ", "for", " ", "Non", "e", " ", "values", ".", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "x_", ")_", "is_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "float_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "int_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "service_", "=_", "self_", "._", "session_", "._", "eman", "e_", "._", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "service_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"%", "s", ":", " ", "EMA", "NE", " ", "event", " ", "service", " ", "unava", "ilab", "le", "\"_", "%_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "neti", "f_", "is_", "None_", "or_", "neti", "f2_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"%", "s", ":", " ", "missi", "ng", " ", "NE", "M", " ", "informati", "on", "\"_", "%_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "batch", " ", "these", " ", "int", "o", " ", "multiple", " ", "events", " ", "per", " ", "transmission", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "may", " ", "want", " ", "to", " ", "split", " ", "out", " ", "second", "s", " ", "porti", "on", " ", "of", " ", "dela", "y", " ", "and", " ", "jitter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event_", "=_", "eman", "ee", "vent", "comm", "effect_", "._", "Event", "Comm", "Effect_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "session_", "._", "obj_", "(_", "self_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "id_", "=_", "e_", "._", "getne", "mid_", "(_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nem", "id2_", "=_", "e_", "._", "getne", "mid_", "(_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mb", "w_", "=_", "bw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "set_", "(_", "index_", ",_", "nem", "id_", ",_", "0_", ",_", "z_", "(_", "delay_", ")_", ",_", "0_", ",_", "z_", "(_", "jitter_", ")_", ",_", "z_", "(_", "loss_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "(_", "duplicate_", ")_", ",_", "long_", "(_", "z_", "(_", "bw_", ")_", ")_", ",_", "long_", "(_", "z_", "(_", "mb", "w_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "publish_", "(_", "eman", "ee", "vent", "comm", "effect_", "._", "EVENT", "\\u", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eman", "ee", "vent", "service_", "._", "PLATFORM", "ID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nem", "id2_", ",_", "eman", "ee", "vent", "service_", "._", "COMPONENT", "ID", "\\u", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "._", "export_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
cablehead/python-consul/consul/__init__.py
[ { "content": "__version__ = '0.6.1-dev'\n\nfrom consul.std import Consul\n\nfrom consul.base import Check\n\nfrom consul.base import ConsulException\nfrom consul.base import ACLPermissionDenied\nfrom consul.base import ACLDisabled\nfrom consul.base import NotFound\nfrom consul.base import Timeout\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from consul.std import Consul", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 29 }, { "span": "from consul.base import Check", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 29 }, { "span": "from consul.base import ConsulException", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 39 }, { "span": "from consul.base import ACLPermissionDenied", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 43 }, { "span": "from consul.base import ACLDisabled", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 35 }, { "span": "from consul.base import NotFound", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 32 }, { "span": "from consul.base import Timeout", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "6.1", "-", "dev", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "consul", "_", "._", "std_", "import_", "Consu", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "consul", "_", "._", "base_", "import_", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "consul", "_", "._", "base_", "import_", "Consu", "l", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "consul", "_", "._", "base_", "import_", "ACL", "Permi", "ssion", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "consul", "_", "._", "base_", "import_", "ACL", "Disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "consul", "_", "._", "base_", "import_", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "consul", "_", "._", "base_", "import_", "Timeout_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1 ]
Unused import
YelpArchive/python-gearman/gearman/job.py
[ { "content": "import collections\nfrom gearman.constants import PRIORITY_NONE, JOB_UNKNOWN, JOB_PENDING, JOB_CREATED, JOB_FAILED, JOB_COMPLETE\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GearmanJob(object):\n \"\"\"Represents the basics of a job... used in GearmanClient / GearmanWorker to represent job states\"\"\"\n\n", "metadata": "root.GearmanJob", "header": "['module', '___EOS___']", "index": 3 }, { "content": " def __init__(self, connection, handle, task, unique, data):\n self.connection = connection\n self.handle = handle\n\n self.task = task\n self.unique = unique\n self.data = data", "metadata": "root.GearmanJob.__init__", "header": "['class', 'GearmanJob', '(', 'object', ')', ':', '___EOS___']", "index": 5 }, { "content": " def to_dict(self):\n return dict(task=self.task, job_handle=self.handle, unique=self.unique, data=self.data)", "metadata": "root.GearmanJob.to_dict", "header": "['class', 'GearmanJob', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def __repr__(self):\n return '<GearmanJob connection/handle=(%r, %r), task=%s, unique=%s, data=%r>' % (self.connection, self.handle, self.task, self.unique, self.data)", "metadata": "root.GearmanJob.__repr__", "header": "['class', 'GearmanJob', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": "class GearmanJobRequest(object):\n \"\"\"Represents a job request... used in GearmanClient to represent job states\"\"\"\n\n\n\n\n\n\n", "metadata": "root.GearmanJobRequest", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self, gearman_job, initial_priority=PRIORITY_NONE, background=False, max_attempts=1):\n self.gearman_job = gearman_job\n\n self.priority = initial_priority\n self.background = background\n\n self.connection_attempts = 0\n self.max_connection_attempts = max_attempts\n\n self.initialize_request()", "metadata": "root.GearmanJobRequest.__init__", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def initialize_request(self):\n # Holds WORK_COMPLETE responses\n self.result = None\n\n # Holds WORK_EXCEPTION responses\n self.exception = None\n\n # Queues to hold WORK_WARNING, WORK_DATA responses\n self.warning_updates = collections.deque()\n self.data_updates = collections.deque()\n\n # Holds WORK_STATUS / STATUS_REQ responses\n self.status = {}\n\n self.state = JOB_UNKNOWN\n self.timed_out = False", "metadata": "root.GearmanJobRequest.initialize_request", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": " def reset(self):\n self.initialize_request()\n self.connection = None\n self.handle = None", "metadata": "root.GearmanJobRequest.reset", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " @property\n def status_updates(self):\n \"\"\"Deprecated since 2.0.1, removing in next major release\"\"\"\n output_queue = collections.deque()\n if self.status:\n output_queue.append((self.status.get('numerator', 0), self.status.get('denominator', 0)))\n\n return output_queue", "metadata": "root.GearmanJobRequest.status_updates", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 54 }, { "content": " @property\n def server_status(self):\n \"\"\"Deprecated since 2.0.1, removing in next major release\"\"\"\n return self.status", "metadata": "root.GearmanJobRequest.server_status", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " @property\n def job(self):\n return self.gearman_job", "metadata": "root.GearmanJobRequest.job", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " @property\n def complete(self):\n background_complete = bool(self.background and self.state in (JOB_CREATED))\n foreground_complete = bool(not self.background and self.state in (JOB_FAILED, JOB_COMPLETE))\n\n actually_complete = background_complete or foreground_complete\n return actually_complete", "metadata": "root.GearmanJobRequest.complete", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 72 }, { "content": " def __repr__(self):\n formatted_representation = '<GearmanJobRequest task=%r, unique=%r, priority=%r, background=%r, state=%r, timed_out=%r>'\n return formatted_representation % (self.job.task, self.job.unique, self.priority, self.background, self.state, self.timed_out)", "metadata": "root.GearmanJobRequest.__repr__", "header": "['class', 'GearmanJobRequest', '(', 'object', ')', ':', '___EOS___']", "index": 80 } ]
[ { "span": "from gearman.constants import PRIORITY_NONE, JOB_UNKNOWN, JOB_PENDING, JOB_CREATED, JOB_FAILED, JOB_COMPLETE", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 108 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gear", "man_", "._", "constants_", "import_", "PRIORITY", "\\u", "NONE_", ",_", "JOB", "\\u", "UNKNOWN_", ",_", "JOB", "\\u", "PENDING_", ",_", "JOB", "\\u", "CREATED_", ",_", "JOB", "\\u", "FAILED_", ",_", "JOB", "\\u", "COMPLETE_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Gea", "rman", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "the", " ", "basics", " ", "of", " ", "a", " ", "job", "...", " ", "used", " ", "in", " ", "Gea", "rman", "Client", " ", "/", " ", "Gea", "rman", "Worke", "r", " ", "to", " ", "represent", " ", "job", " ", "state", "s", "\"\"\"_", "\\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_", "Gea", "rman", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "connection_", ",_", "handle_", ",_", "task_", ",_", "unique_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "connection_", "=_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle_", "=_", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task_", "=_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unique_", "=_", "unique_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "(_", "task_", "=_", "self_", "._", "task_", ",_", "job", "\\u", "handle_", "=_", "self_", "._", "handle_", ",_", "unique_", "=_", "self_", "._", "unique_", ",_", "data_", "=_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Job_", "(_", "object_", ")_", ":_", "\\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 ", " _", "return_", "'<", "Gea", "rman", "Jo", "b", " ", "connecti", "on", "/", "handle", "=(", "%", "r", ",", " ", "%", "r", "),", " ", "task", "=", "%", "s", ",", " ", "unique", "=", "%", "s", ",", " ", "data", "=", "%", "r", ">'_", "%_", "(_", "self_", "._", "connection_", ",_", "self_", "._", "handle_", ",_", "self_", "._", "task_", ",_", "self_", "._", "unique_", ",_", "self_", "._", "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_", "Gea", "rman", "Jo", "b", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "a", " ", "job", " ", "request", "...", " ", "used", " ", "in", " ", "Gea", "rman", "Client", " ", "to", " ", "represent", " ", "job", " ", "state", "s", "\"\"\"_", "\\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_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "gear", "man", "\\u", "job_", ",_", "initial", "\\u", "priority_", "=_", "PRIORITY", "\\u", "NONE_", ",_", "background_", "=_", "False_", ",_", "max", "\\u", "attempts_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "gear", "man", "\\u", "job_", "=_", "gear", "man", "\\u", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "priority_", "=_", "initial", "\\u", "priority_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "background_", "=_", "background_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "connecti", "on", "\\u", "attempts_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "connecti", "on", "\\u", "attempts_", "=_", "max", "\\u", "attempts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "initialize", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "initialize", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hold", "s", " ", "WORK", "\\u", "COMPLET", "E", " ", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hold", "s", " ", "WORK", "\\u", "EXCEPTION", " ", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exception_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Queue", "s", " ", "to", " ", "hold", " ", "WORK", "\\u", "WARN", "ING", ",", " ", "WORK", "\\u", "DATA", " ", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "warn", "ing", "\\u", "updates_", "=_", "collections_", "._", "deque_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "updates_", "=_", "collections_", "._", "deque_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hold", "s", " ", "WORK", "\\u", "STATUS", " ", "/", " ", "STATUS", "\\u", "REQ", " ", "responses_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "status_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "state_", "=_", "JOB", "\\u", "UNKNOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timed", "\\u", "out_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "initialize", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "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_", "status", "\\u", "updates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Dep", "reca", "ted", " ", "sinc", "e", " ", "2.0", ".1", ",", " ", "remo", "ving", " ", "in", " ", "next", " ", "major", " ", "release", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "queue_", "=_", "collections_", "._", "deque_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "queue_", "._", "append_", "(_", "(_", "self_", "._", "status_", "._", "get_", "(_", "'", "numerat", "or", "'_", ",_", "0_", ")_", ",_", "self_", "._", "status_", "._", "get_", "(_", "'", "denominator", "'_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "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_", "server", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Dep", "reca", "ted", " ", "sinc", "e", " ", "2.0", ".1", ",", " ", "remo", "ving", " ", "in", " ", "next", " ", "major", " ", "release", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "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_", "job_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "gear", "man", "\\u", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "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_", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "background", "\\u", "complete_", "=_", "bool_", "(_", "self_", "._", "background_", "and_", "self_", "._", "state_", "in_", "(_", "JOB", "\\u", "CREATED_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fore", "ground", "\\u", "complete_", "=_", "bool_", "(_", "not_", "self_", "._", "background_", "and_", "self_", "._", "state_", "in_", "(_", "JOB", "\\u", "FAILED_", ",_", "JOB", "\\u", "COMPLETE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "ly", "\\u", "complete_", "=_", "background", "\\u", "complete_", "or_", "fore", "ground", "\\u", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "actual", "ly", "\\u", "complete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gea", "rman", "Jo", "b", "Request_", "(_", "object_", ")_", ":_", "\\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 ", " _", "format", "ted", "\\u", "representation_", "=_", "'<", "Gea", "rman", "Jo", "b", "Request", " ", "task", "=", "%", "r", ",", " ", "unique", "=", "%", "r", ",", " ", "priorit", "y", "=", "%", "r", ",", " ", "background", "=", "%", "r", ",", " ", "state", "=", "%", "r", ",", " ", "timed", "\\u", "out", "=", "%", "r", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format", "ted", "\\u", "representation_", "%_", "(_", "self_", "._", "job_", "._", "task_", ",_", "self_", "._", "job_", "._", "unique_", ",_", "self_", "._", "priority_", ",_", "self_", "._", "background_", ",_", "self_", "._", "state_", ",_", "self_", "._", "timed", "\\u", "out_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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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, 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, 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 ]
Unused import
anandology/pyjamas/library/pyjamas/gmaps/Marker.py
[ { "content": "from gwt.gmaps.Marker import (\n Marker,\n MarkerImage,\n MarkerOptions,\n createListenerMethods,\n dictToJs,\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from gwt.gmaps.Marker import (\n Marker,\n MarkerImage,\n MarkerOptions,\n createListenerMethods,\n dictToJs,\n)", "start_line": 0, "start_column": 0, "end_line": 6, "end_column": 1 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "gw", "t_", "._", "gma", "ps_", "._", "Marker_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Marker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mark", "er", "Image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mark", "er", "Options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Listen", "er", "Methods_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict", "To", "Js", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
joestump/python-oauth2/oauth2/_compat.py
[ { "content": "try:\n TEXT = unicode\nexcept NameError: #pragma NO COVER Py3k\n PY3 = True\n TEXT = str\n STRING_TYPES = (str, bytes)\nelse: #pragma NO COVER Python2\n PY3 = False\n STRING_TYPES = (unicode, bytes)\n\n\ntry:\n import urlparse\nexcept ImportError: #pragma NO COVER Py3k\n from urllib.parse import parse_qs\n from urllib.parse import parse_qsl\n from urllib.parse import quote\n from urllib.parse import unquote\n from urllib.parse import unquote_to_bytes\n from urllib.parse import urlencode\n from urllib.parse import urlsplit\n from urllib.parse import urlunsplit\n from urllib.parse import urlparse\n from urllib.parse import urlunparse\nelse: #pragma NO COVER Python2\n from urlparse import parse_qs\n from urlparse import parse_qsl\n from urllib import quote\n from urllib import unquote\n from urllib import urlencode\n from urlparse import urlsplit\n from urlparse import urlunsplit\n from urlparse import urlparse\n from urlparse import urlunparse\n unquote_to_bytes = unquote\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def b(x, encoding='ascii'):\n return bytes(x, encoding)", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def b(x, encoding='ascii'):\n if isinstance(x, unicode):\n x = x.encode(encoding)\n return x", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 11 }, { "content": "def u(x, encoding='ascii'):\n if isinstance(x, TEXT): #pragma NO COVER\n return x\n try:\n return x.decode(encoding)\n except AttributeError: #pragma NO COVER\n raise ValueError('WTF: %s' % x)", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 16 } ]
[ { "span": "import urlparse", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 19 }, { "span": "from urllib.parse import parse_qs", "start_line": 27, "start_column": 4, "end_line": 27, "end_column": 37 }, { "span": "from urllib.parse import parse_qsl", "start_line": 28, "start_column": 4, "end_line": 28, "end_column": 38 }, { "span": "from urllib.parse import quote", "start_line": 29, "start_column": 4, "end_line": 29, "end_column": 34 }, { "span": "from urllib.parse import unquote_to_bytes", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 45 }, { "span": "from urllib.parse import urlencode", "start_line": 32, "start_column": 4, "end_line": 32, "end_column": 38 }, { "span": "from urllib.parse import urlsplit", "start_line": 33, "start_column": 4, "end_line": 33, "end_column": 37 }, { "span": "from urllib.parse import urlunsplit", "start_line": 34, "start_column": 4, "end_line": 34, "end_column": 39 }, { "span": "from urllib.parse import urlparse", "start_line": 35, "start_column": 4, "end_line": 35, "end_column": 37 }, { "span": "from urllib.parse import urlunparse", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 39 }, { "span": "from urlparse import parse_qs", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 33 }, { "span": "from urlparse import parse_qsl", "start_line": 39, "start_column": 4, "end_line": 39, "end_column": 34 }, { "span": "from urlparse import urlsplit", "start_line": 43, "start_column": 4, "end_line": 43, "end_column": 33 }, { "span": "from urlparse import urlunsplit", "start_line": 44, "start_column": 4, "end_line": 44, "end_column": 35 }, { "span": "from urlparse import urlparse", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 33 }, { "span": "from urlparse import urlunparse", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 35 } ]
[]
1
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 ", " _", "TEXT_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "#", "pragma", " ", "NO", " ", "COVER", " ", "Py", "3", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PY", "3_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEXT_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STRING", "\\u", "TYPES_", "=_", "(_", "str_", ",_", "bytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "pragma", " ", "NO", " ", "COVER", " ", "Pyth", "on2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PY", "3_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STRING", "\\u", "TYPES_", "=_", "(_", "unicode_", ",_", "bytes_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "#", "pragma", " ", "NO", " ", "COVER", " ", "Py", "3", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "parse", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "parse", "\\u", "qs", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "unqu", "ote", "\\u", "to", "\\u", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlsplit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlu", "nsp", "lit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlu", "npar", "se_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "pragma", " ", "NO", " ", "COVER", " ", "Pyth", "on2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "parse", "\\u", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "parse", "\\u", "qs", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urlsplit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urlu", "nsp", "lit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urlu", "npar", "se_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unqu", "ote", "\\u", "to", "\\u", "bytes_", "=_", "unquote_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "b_", "(_", "x_", ",_", "encoding_", "=_", "'", "ascii", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bytes_", "(_", "x_", ",_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "b_", "(_", "x_", ",_", "encoding_", "=_", "'", "ascii", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "x_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "x_", "._", "encode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\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_", "(_", "x_", ",_", "encoding_", "=_", "'", "ascii", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "x_", ",_", "TEXT_", ")_", ":_", "#", "pragma", " ", "NO", " ", "COVER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\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 ", " _", "return_", "x_", "._", "decode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "#", "pragma", " ", "NO", " ", "COVER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "WT", "F", ":", " ", "%", "s", "'_", "%_", "x_", ")_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 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, 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, 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 ]
Unused local variable
galaxyproject/pulsar/pulsar/client/action_mapper.py
[ { "content": " def path_rewrite(self, path_helper, path=None):\n if not path:\n path = self.path\n new_path = path_helper.from_posix_with_new_base(self.path, self.source_directory, self.destination_directory)\n return None if new_path == self.path else new_path", "metadata": "root.RewriteAction.path_rewrite", "header": "['class', 'RewriteAction', '(', 'BaseAction', ')', ':', '___EOS___']", "index": 354 } ]
[ { "span": "path ", "start_line": 356, "start_column": 12, "end_line": 356, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Rewrite", "Action_", "(_", "Base", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "path", "\\u", "rewrite", "_", "(_", "self_", ",_", "path", "\\u", "helper_", ",_", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "self_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "path_", "=_", "path", "\\u", "helper_", "._", "from", "\\u", "posix", "\\u", "with", "\\u", "new", "\\u", "base_", "(_", "self_", "._", "path_", ",_", "self_", "._", "source", "\\u", "directory_", ",_", "self_", "._", "destinat", "ion", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "if_", "new", "\\u", "path_", "==_", "self_", "._", "path_", "else_", "new", "\\u", "path_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ui/django-post_office/post_office/south_migrations/0011_auto__chg_field_email_context.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n models = {\n u'post_office.attachment': {\n 'Meta': {'object_name': 'Attachment'},\n 'emails': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': \"'attachments'\", 'symmetrical': 'False', 'to': u\"orm['post_office.Email']\"}),\n 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n },\n u'post_office.email': {\n 'Meta': {'object_name': 'Email'},\n 'bcc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'cc': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'context': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'from_email': ('django.db.models.fields.CharField', [], {'max_length': '254'}),\n 'headers': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),\n 'html_message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'priority': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'scheduled_time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),\n 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),\n 'subject': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n 'template': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['post_office.EmailTemplate']\", 'null': 'True', 'blank': 'True'}),\n 'to': ('django.db.models.fields.TextField', [], {'blank': 'True'})\n },\n u'post_office.emailtemplate': {\n 'Meta': {'object_name': 'EmailTemplate'},\n 'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'html_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'subject': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})\n },\n u'post_office.log': {\n 'Meta': {'object_name': 'Log'},\n 'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'email': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'logs'\", 'to': u\"orm['post_office.Email']\"}),\n 'exception_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'message': ('django.db.models.fields.TextField', [], {}),\n 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {})\n }\n }\n\n complete_apps = ['post_office']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n\n # Changing field 'Email.context'\n db.alter_column(u'post_office_email', 'context', self.gf('jsonfield.fields.JSONField')(null=True))", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n\n # Changing field 'Email.context'\n db.alter_column(u'post_office_email', 'context', self.gf('jsonfield.fields.JSONField')(default=''))", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\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_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\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_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "post", "\\u", "office", ".", "attach", "ment", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Attach", "ment", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attach", "ment", "s", "'\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "post", "\\u", "office", ".", "Ema", "il", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "post", "\\u", "office", ".", "email", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Ema", "il", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bcc", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cc", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "context", "'_", ":_", "(_", "'", "jsonfi", "eld", ".", "fields", ".", "JSO", "NF", "iel", "d", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "\\u", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "254", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "(_", "'", "jsonfi", "eld", ".", "fields", ".", "JSO", "NF", "iel", "d", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "html", "\\u", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "schedule", "d\\u", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "post", "\\u", "office", ".", "Ema", "il", "Templa", "te", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "post", "\\u", "office", ".", "email", "template", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Ema", "il", "Templa", "te", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "html", "\\u", "content", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "post", "\\u", "office", ".", "log", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Log", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "logs", "'\"_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "post", "\\u", "office", ".", "Ema", "il", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exception", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "post", "\\u", "office", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chang", "ing", " ", "field", " ", "'", "Ema", "il", ".", "context", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "alter", "\\u", "column_", "(_", "u", "'", "post", "\\u", "office", "\\u", "email", "'_", ",_", "'", "context", "'_", ",_", "self_", "._", "gf_", "(_", "'", "jsonfi", "eld", ".", "fields", ".", "JSO", "NF", "iel", "d", "'_", ")_", "(_", "null_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chang", "ing", " ", "field", " ", "'", "Ema", "il", ".", "context", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "alter", "\\u", "column_", "(_", "u", "'", "post", "\\u", "office", "\\u", "email", "'_", ",_", "'", "context", "'_", ",_", "self_", "._", "gf_", "(_", "'", "jsonfi", "eld", ".", "fields", ".", "JSO", "NF", "iel", "d", "'_", ")_", "(_", "default_", "=_", "''_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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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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 ]
Unused local variable
xraypy/xraylarch/plugins/epics/xrfcontrol.py
[ { "content": " def onSaveMCAFile(self, event=None, **kws):\n tmp = '''\n # print 'SaveMCA File'\n deffile = ''\n if hasattr(self.mca, 'sourcefile'):\n deffile = \"%s%s\" % (deffile, getattr(self.mca, 'sourcefile'))\n if hasattr(self.mca, 'areaname'):\n deffile = \"%s%s\" % (deffile, getattr(self.mca, 'areaname'))\n if deffile == '':\n deffile ='test'\n if not deffile.endswith('.mca'):\n deffile = deffile + '.mca'\n '''\n\n deffile = 'save.mca' # fix_filename(str(deffile))\n outfile = FileSave(self, \"Save MCA File\",\n default_file=deffile,\n wildcard=FILE_WILDCARDS)\n\n environ = []\n if self.scandb is not None:\n c, table = self.scandb.get_table('pvs')\n pvrows = self.scandb.query(table).all()\n for row in pvrows:\n addr = str(row.name)\n desc = str(row.notes)\n val = self.scandb.pvs[addr].get(as_string=True)\n environ.append((addr, val, desc))\n\n if outfile is not None:\n self.det.save_mcafile(outfile, environ=environ)", "metadata": "root.EpicsXRFDisplayFrame.onSaveMCAFile", "header": "['class', 'EpicsXRFDisplayFrame', '(', 'XRFDisplayFrame', ')', ':', '___EOS___']", "index": 184 }, { "content": " def createMainPanel(self):\n epicspanel = self.createEpicsPanel()\n ctrlpanel = self.createControlPanel()\n plotpanel = self.panel = self.createPlotPanel()\n self.panel.SetName('plotpanel')\n tx, ty = self.wids['ptable'].GetBestSize()\n cx, cy = ctrlpanel.GetBestSize()\n px, py = plotpanel.GetBestSize()\n\n self.SetSize((950, 625))\n self.SetMinSize((450, 350))\n\n style = wx.ALIGN_LEFT|wx.EXPAND|wx.ALL\n\n bsizer = wx.BoxSizer(wx.HORIZONTAL)\n bsizer.Add(ctrlpanel, 0, style, 1)\n bsizer.Add(plotpanel, 1, style, 1)\n hline = wx.StaticLine(self, size=(425, 2), style=wx.LI_HORIZONTAL|style)\n\n sizer = wx.BoxSizer(wx.VERTICAL)\n sizer.Add(epicspanel, 0, style, 1)\n sizer.Add(hline, 0, style, 1)\n sizer.Add(bsizer, 1, style, 1)\n pack(self, sizer)\n\n self.set_roilist(mca=None)", "metadata": "root.EpicsXRFDisplayFrame.createMainPanel", "header": "['class', 'EpicsXRFDisplayFrame', '(', 'XRFDisplayFrame', ')', ':', '___EOS___']", "index": 304 }, { "content": " def createEpicsPanel(self):\n pane = wx.Panel(self, name='epics panel')\n psizer = wx.GridBagSizer(4, 12) # wx.BoxSizer(wx.HORIZONTAL)\n\n btnpanel = wx.Panel(pane, name='buttons')\n\n nmca = self.nmca\n NPERROW = 6\n self.SetFont(Font(9))\n if self.det_type.lower().startswith('me-4') and nmca<5:\n btnsizer = wx.GridBagSizer(2, 2)\n else:\n btnsizer = wx.GridBagSizer(int((nmca+NPERROW-2)/(1.0*NPERROW)), NPERROW)\n\n style = wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL\n rstyle = wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL\n bkg_choices = ['None']\n\n psizer.Add(SimpleText(pane, ' MCAs: '), (0, 0), (1, 1), style, 1)\n for i in range(1, 1+nmca):\n bkg_choices.append(\"%i\" % i)\n b = Button(btnpanel, '%i' % i, size=(30, 25),\n action=partial(self.onSelectDet, index=i))\n self.wids['det%i' % i] = b\n loc = divmod(i-1, NPERROW)\n if self.det_type.lower().startswith('me-4') and nmca<NPERROW-1:\n loc = self.me4_layout[i-1]\n btnsizer.Add(b, loc, (1, 1), style, 1)\n pack(btnpanel, btnsizer)\n nrows = 1 + loc[0]\n\n if self.det_type.lower().startswith('me-4') and nmca<5:\n nrows = 2\n\n psizer.Add(btnpanel, (0, 1), (nrows, 1), style, 1)\n\n self.wids['det_status'] = SimpleText(pane, ' ', size=(120, -1), style=style)\n self.wids['deadtime'] = SimpleText(pane, ' ', size=(120, -1), style=style)\n\n self.wids['bkg_det'] = Choice(pane, size=(75, -1), choices=bkg_choices,\n action=self.onSelectDet)\n\n self.wids['dwelltime'] = FloatCtrl(pane, value=0.0, precision=1, minval=0,\n size=(80, -1), act_on_losefocus=True,\n action=self.onSetDwelltime)\n self.wids['elapsed'] = SimpleText(pane, ' ', size=(80, -1), style=style)\n\n b1 = Button(pane, 'Start', size=(90, 25), action=self.onStart)\n b2 = Button(pane, 'Stop', size=(90, 25), action=self.onStop)\n b3 = Button(pane, 'Erase', size=(90, 25), action=self.onErase)\n b4 = Button(pane, 'Continuous', size=(90, 25), action=partial(self.onStart,\n dtime=0))\n\n bkg_lab = SimpleText(pane, 'Background MCA:', size=(150, -1))\n pre_lab = SimpleText(pane, 'Preset Time (s):', size=(125, -1))\n ela_lab = SimpleText(pane, 'Elapsed Time (s):', size=(125, -1))\n sta_lab = SimpleText(pane, 'Status :', size=(100, -1))\n dea_lab = SimpleText(pane, '% Deadtime:', size=(100, -1))\n\n\n psizer.Add(bkg_lab, (0, 2), (1, 1), style, 1)\n psizer.Add(self.wids['bkg_det'], (1, 2), (1, 1), style, 1)\n psizer.Add(pre_lab, (0, 3), (1, 1), style, 1)\n psizer.Add(ela_lab, (1, 3), (1, 1), style, 1)\n psizer.Add(self.wids['dwelltime'], (0, 4), (1, 1), style, 1)\n psizer.Add(self.wids['elapsed'], (1, 4), (1, 1), style, 1)\n\n psizer.Add(b1, (0, 5), (1, 1), style, 1)\n psizer.Add(b4, (0, 6), (1, 1), style, 1)\n psizer.Add(b2, (1, 5), (1, 1), style, 1)\n psizer.Add(b3, (1, 6), (1, 1), style, 1)\n\n psizer.Add(sta_lab, (0, 7), (1, 1), style, 1)\n psizer.Add(self.wids['det_status'], (0, 8), (1, 1), style, 1)\n psizer.Add(dea_lab, (1, 7), (1, 1), style, 1)\n psizer.Add(self.wids['deadtime'], (1, 8), (1, 1), style, 1)\n pack(pane, psizer)\n # pane.SetMinSize((500, 53))\n self.det.connect_displays(status=self.wids['det_status'],\n elapsed=self.wids['elapsed'],\n deadtime=self.wids['deadtime'])\n\n wx.CallAfter(self.onSelectDet, index=1, init=True)\n self.timer_counter = 0\n self.mca_timer = wx.Timer(self)\n self.Bind(wx.EVT_TIMER, self.UpdateData, self.mca_timer)\n self.mca_timer.Start(100)\n return pane", "metadata": "root.EpicsXRFDisplayFrame.createEpicsPanel", "header": "['class', 'EpicsXRFDisplayFrame', '(', 'XRFDisplayFrame', ')', ':', '___EOS___']", "index": 331 }, { "content": " def ShowROIStatus(self, left, right, name='', panel=0):\n if left > right:\n return\n sum = self.ydata[left:right].sum()\n dt = self.mca.real_time\n roi_ave = self.roi_aves[panel]\n roi_ave.update(sum)\n cps = roi_ave.get_cps()\n nmsg, cmsg, rmsg = '', '', ''\n if len(name) > 0:\n nmsg = \" %s\" % name\n cmsg = \" Counts={:10,.0f}\".format(sum)\n if cps is not None and cps > 0:\n rmsg = \" CPS={:10,.1f}\".format(cps)\n self.write_message(\"%s%s%s\" % (nmsg, cmsg, rmsg), panel=panel)", "metadata": "root.EpicsXRFDisplayFrame.ShowROIStatus", "header": "['class', 'EpicsXRFDisplayFrame', '(', 'XRFDisplayFrame', ')', ':', '___EOS___']", "index": 453 } ]
[ { "span": "tmp ", "start_line": 185, "start_column": 8, "end_line": 185, "end_column": 11 }, { "span": "tx,", "start_line": 309, "start_column": 8, "end_line": 309, "end_column": 10 }, { "span": "ty ", "start_line": 309, "start_column": 12, "end_line": 309, "end_column": 14 }, { "span": "cx,", "start_line": 310, "start_column": 8, "end_line": 310, "end_column": 10 }, { "span": "cy ", "start_line": 310, "start_column": 12, "end_line": 310, "end_column": 14 }, { "span": "px,", "start_line": 311, "start_column": 8, "end_line": 311, "end_column": 10 }, { "span": "py ", "start_line": 311, "start_column": 12, "end_line": 311, "end_column": 14 }, { "span": "rstyle ", "start_line": 346, "start_column": 8, "end_line": 346, "end_column": 14 }, { "span": "dt ", "start_line": 457, "start_column": 8, "end_line": 457, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Epi", "cs", "XR", "FD", "isp", "lay", "Frame_", "(_", "XR", "FD", "isp", "lay", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Save", "MC", "AF", "ile_", "(_", "self_", ",_", "event_", "=_", "None_", ",_", "**_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "print", " ", "'", "Save", "MC", "A", " ", "File", "'", "\\", "10", ";", " ", " ", " ", " ", "def", "file", " ", "=", " ", "''", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "has", "attr", "(", "self", ".", "mca", ",", " ", "'", "sourcef", "ile", "')", ":", "\\", "10", ";", " ", " ", " ", " ", "def", "file", " ", "=", " ", "\"%", "s", "%", "s", "\"", " ", "%", " ", "(", "def", "file", ",", " ", "getattr", "(", "self", ".", "mca", ",", " ", "'", "sourcef", "ile", "'))", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "has", "attr", "(", "self", ".", "mca", ",", " ", "'", "area", "name", "')", ":", "\\", "10", ";", " ", " ", " ", " ", "def", "file", " ", "=", " ", "\"%", "s", "%", "s", "\"", " ", "%", " ", "(", "def", "file", ",", " ", "getattr", "(", "self", ".", "mca", ",", " ", "'", "area", "name", "'))", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "def", "file", " ", "==", " ", "''", ":", "\\", "10", ";", " ", " ", " ", " ", "def", "file", " ", "='", "test", "'", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "def", "file", ".", "ends", "with", "('.", "mca", "')", ":", "\\", "10", ";", " ", " ", " ", " ", "def", "file", " ", "=", " ", "def", "file", " ", "+", " ", "'.", "mca", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def", "file_", "=_", "'", "save", ".", "mca", "'_", "#", " ", "fix", "\\u", "filename", "(", "str", "(", "def", "file", "))", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "=_", "File", "Save_", "(_", "self_", ",_", "\"", "Save", " ", "MC", "A", " ", "File", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "file_", "=_", "def", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wildcard_", "=_", "FILE", "\\u", "WIL", "DC", "ARD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "environ_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "scan", "db_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", ",_", "table_", "=_", "self_", "._", "scan", "db_", "._", "get", "\\u", "table_", "(_", "'", "pvs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pv", "rows_", "=_", "self_", "._", "scan", "db_", "._", "query_", "(_", "table_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "pv", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "str_", "(_", "row_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "str_", "(_", "row_", "._", "notes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "self_", "._", "scan", "db_", "._", "pvs", "_", "[_", "addr_", "]_", "._", "get_", "(_", "as", "\\u", "string_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "append_", "(_", "(_", "addr_", ",_", "val_", ",_", "desc_", ")_", ")_", "\\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_", "outfile_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "det_", "._", "save", "\\u", "mca", "file_", "(_", "outfile_", ",_", "environ_", "=_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Epi", "cs", "XR", "FD", "isp", "lay", "Frame_", "(_", "XR", "FD", "isp", "lay", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Main", "Panel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "epic", "span", "el_", "=_", "self_", "._", "create", "Epi", "cs", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctrl", "panel_", "=_", "self_", "._", "create", "Control", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "panel_", "=_", "self_", "._", "panel_", "=_", "self_", "._", "create", "Plot", "Panel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panel_", "._", "Set", "Name_", "(_", "'", "plot", "panel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx_", ",_", "ty_", "=_", "self_", "._", "wids_", "[_", "'", "ptable", "'_", "]_", "._", "Get", "Bes", "t", "Size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cx_", ",_", "cy_", "=_", "ctrl", "panel_", "._", "Get", "Bes", "t", "Size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "px_", ",_", "py_", "=_", "plot", "panel_", "._", "Get", "Bes", "t", "Size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Set", "Size_", "(_", "(_", "950", "_", ",_", "625_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Set", "Min", "Size_", "(_", "(_", "450_", ",_", "350_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "wx_", "._", "ALIGN", "\\u", "LEFT_", "|_", "wx_", "._", "EXPAND_", "|_", "wx_", "._", "ALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bsi", "zer_", "=_", "wx_", "._", "Box", "Sizer_", "(_", "wx_", "._", "HORIZONTAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bsi", "zer_", "._", "Add_", "(_", "ctrl", "panel_", ",_", "0_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bsi", "zer_", "._", "Add_", "(_", "plot", "panel_", ",_", "1_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hline", "_", "=_", "wx_", "._", "Static", "Line_", "(_", "self_", ",_", "size_", "=_", "(_", "425", "_", ",_", "2_", ")_", ",_", "style_", "=_", "wx_", "._", "LI", "\\u", "HORIZONTAL_", "|_", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sizer_", "=_", "wx_", "._", "Box", "Sizer_", "(_", "wx_", "._", "VERTICAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "epic", "span", "el_", ",_", "0_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "hline", "_", ",_", "0_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sizer_", "._", "Add_", "(_", "bsi", "zer_", ",_", "1_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack_", "(_", "self_", ",_", "sizer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "roi", "list_", "(_", "mca", "_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Epi", "cs", "XR", "FD", "isp", "lay", "Frame_", "(_", "XR", "FD", "isp", "lay", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Epi", "cs", "Panel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pane_", "=_", "wx_", "._", "Panel_", "(_", "self_", ",_", "name_", "=_", "'", "epic", "s", " ", "panel", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "=_", "wx_", "._", "Grid", "Bag", "Sizer_", "(_", "4_", ",_", "12_", ")_", "#", " ", "wx", ".", "Box", "Sizer", "(", "wx", ".", "HORI", "ZON", "TAL", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "btn", "panel_", "=_", "wx_", "._", "Panel_", "(_", "pane_", ",_", "name_", "=_", "'", "buttons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nm", "ca_", "=_", "self_", "._", "nm", "ca_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NP", "ERR", "OW", "_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Set", "Font_", "(_", "Font_", "(_", "9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "det", "\\u", "type_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "'", "me", "-", "4", "'_", ")_", "and_", "nm", "ca_", "<_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "btn", "sizer_", "=_", "wx_", "._", "Grid", "Bag", "Sizer_", "(_", "2_", ",_", "2_", ")_", "\\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 ", " _", "btn", "sizer_", "=_", "wx_", "._", "Grid", "Bag", "Sizer_", "(_", "int_", "(_", "(_", "nm", "ca_", "+_", "NP", "ERR", "OW", "_", "-_", "2_", ")_", "/_", "(_", "1.0_", "*_", "NP", "ERR", "OW", "_", ")_", ")_", ",_", "NP", "ERR", "OW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "style_", "=_", "wx_", "._", "ALIGN", "\\u", "LEFT_", "|_", "wx_", "._", "ALIGN", "\\u", "CENTER", "\\u", "VERTICAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rst", "yle", "_", "=_", "wx_", "._", "ALIGN", "\\u", "RIGHT_", "|_", "wx_", "._", "ALIGN", "\\u", "CENTER", "\\u", "VERTICAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bkg", "\\u", "choices_", "=_", "[_", "'", "Non", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "Simple", "Text_", "(_", "pane_", ",_", "'", " ", "MC", "As", ":", " ", "'_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "1_", "+_", "nm", "ca_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bkg", "\\u", "choices_", "._", "append_", "(_", "\"%", "i", "\"_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "Button_", "(_", "btn", "panel_", ",_", "'%", "i", "'_", "%_", "i_", ",_", "size_", "=_", "(_", "30_", ",_", "25_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "partial_", "(_", "self_", "._", "on", "Select", "Det", "_", ",_", "index_", "=_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wids_", "[_", "'", "det", "%", "i", "'_", "%_", "i_", "]_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "=_", "divmod_", "(_", "i_", "-_", "1_", ",_", "NP", "ERR", "OW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "det", "\\u", "type_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "'", "me", "-", "4", "'_", ")_", "and_", "nm", "ca_", "<_", "NP", "ERR", "OW", "_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loc_", "=_", "self_", "._", "me", "4", "\\u", "layout_", "[_", "i_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "btn", "sizer_", "._", "Add_", "(_", "b_", ",_", "loc_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pack_", "(_", "btn", "panel_", ",_", "btn", "sizer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nrows_", "=_", "1_", "+_", "loc_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "det", "\\u", "type_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "'", "me", "-", "4", "'_", ")_", "and_", "nm", "ca_", "<_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nrows_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "btn", "panel_", ",_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "nrows_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wids_", "[_", "'", "det", "\\u", "status", "'_", "]_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", " ", "'_", ",_", "size_", "=_", "(_", "120_", ",_", "-_", "1_", ")_", ",_", "style_", "=_", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wids_", "[_", "'", "dead", "time", "'_", "]_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", " ", "'_", ",_", "size_", "=_", "(_", "120_", ",_", "-_", "1_", ")_", ",_", "style_", "=_", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wids_", "[_", "'", "bkg", "\\u", "det", "'_", "]_", "=_", "Choice_", "(_", "pane_", ",_", "size_", "=_", "(_", "75_", ",_", "-_", "1_", ")_", ",_", "choices_", "=_", "bkg", "\\u", "choices_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "self_", "._", "on", "Select", "Det", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wids_", "[_", "'", "dwe", "ll", "time", "'_", "]_", "=_", "Float", "Ctrl_", "(_", "pane_", ",_", "value_", "=_", "0.0_", ",_", "precision_", "=_", "1_", ",_", "minval_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "(_", "80_", ",_", "-_", "1_", ")_", ",_", "act", "\\u", "on", "\\u", "lose", "focus_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "self_", "._", "on", "Set", "Dw", "ell", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wids_", "[_", "'", "ela", "pse", "d", "'_", "]_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", " ", "'_", ",_", "size_", "=_", "(_", "80_", ",_", "-_", "1_", ")_", ",_", "style_", "=_", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b1_", "=_", "Button_", "(_", "pane_", ",_", "'", "Start", "'_", ",_", "size_", "=_", "(_", "90_", ",_", "25_", ")_", ",_", "action_", "=_", "self_", "._", "on", "Start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "Button_", "(_", "pane_", ",_", "'", "Sto", "p", "'_", ",_", "size_", "=_", "(_", "90_", ",_", "25_", ")_", ",_", "action_", "=_", "self_", "._", "on", "Stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b3_", "=_", "Button_", "(_", "pane_", ",_", "'", "Erase", "'_", ",_", "size_", "=_", "(_", "90_", ",_", "25_", ")_", ",_", "action_", "=_", "self_", "._", "on", "Erase", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b4", "_", "=_", "Button_", "(_", "pane_", ",_", "'", "Continu", "ous", "'_", ",_", "size_", "=_", "(_", "90_", ",_", "25_", ")_", ",_", "action_", "=_", "partial_", "(_", "self_", "._", "on", "Start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtime", "_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bkg", "\\u", "lab_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", "Back", "ground", " ", "MC", "A", ":'_", ",_", "size_", "=_", "(_", "150_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pre", "\\u", "lab_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", "Preset", " ", "Time", " ", "(", "s", "):'_", ",_", "size_", "=_", "(_", "125_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ela", "\\u", "lab_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", "El", "aps", "ed", " ", "Time", " ", "(", "s", "):'_", ",_", "size_", "=_", "(_", "125_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sta", "\\u", "lab_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'", "Status", " ", ":'_", ",_", "size_", "=_", "(_", "100_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dea", "\\u", "lab_", "=_", "Simple", "Text_", "(_", "pane_", ",_", "'%", " ", "Dead", "time", ":'_", ",_", "size_", "=_", "(_", "100_", ",_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "bkg", "\\u", "lab_", ",_", "(_", "0_", ",_", "2_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "self_", "._", "wids_", "[_", "'", "bkg", "\\u", "det", "'_", "]_", ",_", "(_", "1_", ",_", "2_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "pre", "\\u", "lab_", ",_", "(_", "0_", ",_", "3_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "ela", "\\u", "lab_", ",_", "(_", "1_", ",_", "3_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "self_", "._", "wids_", "[_", "'", "dwe", "ll", "time", "'_", "]_", ",_", "(_", "0_", ",_", "4_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "self_", "._", "wids_", "[_", "'", "ela", "pse", "d", "'_", "]_", ",_", "(_", "1_", ",_", "4_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "b1_", ",_", "(_", "0_", ",_", "5_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "b4", "_", ",_", "(_", "0_", ",_", "6_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "b2_", ",_", "(_", "1_", ",_", "5_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "b3_", ",_", "(_", "1_", ",_", "6_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "sta", "\\u", "lab_", ",_", "(_", "0_", ",_", "7_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "self_", "._", "wids_", "[_", "'", "det", "\\u", "status", "'_", "]_", ",_", "(_", "0_", ",_", "8_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "dea", "\\u", "lab_", ",_", "(_", "1_", ",_", "7_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psi", "zer_", "._", "Add_", "(_", "self_", "._", "wids_", "[_", "'", "dead", "time", "'_", "]_", ",_", "(_", "1_", ",_", "8_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", ",_", "style_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack_", "(_", "pane_", ",_", "psi", "zer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pane", ".", "Set", "Min", "Size", "((", "500", ",", " ", "5", "3", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "det_", "._", "connect", "\\u", "display", "s_", "(_", "status_", "=_", "self_", "._", "wids_", "[_", "'", "det", "\\u", "status", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "elapsed_", "=_", "self_", "._", "wids_", "[_", "'", "ela", "pse", "d", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dead", "time_", "=_", "self_", "._", "wids_", "[_", "'", "dead", "time", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wx_", "._", "Call", "After_", "(_", "self_", "._", "on", "Select", "Det", "_", ",_", "index_", "=_", "1_", ",_", "init_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer", "\\u", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mca", "\\u", "timer_", "=_", "wx_", "._", "Timer_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Bind_", "(_", "wx_", "._", "EV", "T", "\\u", "TIMER", "_", ",_", "self_", "._", "Update", "Data_", ",_", "self_", "._", "mca", "\\u", "timer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mca", "\\u", "timer_", "._", "Start_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pane_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Epi", "cs", "XR", "FD", "isp", "lay", "Frame_", "(_", "XR", "FD", "isp", "lay", "Frame_", ")_", ":_", "\\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_", "Show", "ROI", "Status_", "(_", "self_", ",_", "left_", ",_", "right_", ",_", "name_", "=_", "''_", ",_", "panel_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "left_", ">_", "right_", ":_", "\\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_", "sum_", "=_", "self_", "._", "ydata_", "[_", "left_", ":_", "right_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "self_", "._", "mca", "_", "._", "real", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roi", "\\u", "ave_", "=_", "self_", "._", "roi", "\\u", "ave", "s_", "[_", "panel_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roi", "\\u", "ave_", "._", "update_", "(_", "sum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cps", "_", "=_", "roi", "\\u", "ave_", "._", "get", "\\u", "cps", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nms", "g_", ",_", "cms", "g_", ",_", "rms", "g_", "=_", "''_", ",_", "''_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "name_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nms", "g_", "=_", "\"", " ", "%", "s", "\"_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cms", "g_", "=_", "\"", " ", "Count", "s", "={", ":", "10", ",.", "0f", "}\"_", "._", "format_", "(_", "sum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cps", "_", "is_", "not_", "None_", "and_", "cps", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rms", "g_", "=_", "\"", " ", "CPS", "={", ":", "10", ",.", "1f", "}\"_", "._", "format_", "(_", "cps", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write", "\\u", "message_", "(_", "\"%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "nms", "g_", ",_", "cms", "g_", ",_", "rms", "g_", ")_", ",_", "panel_", "=_", "panel_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Non-standard exception raised in special method
thomasballinger/curtsies/curtsies/formatstring.py
[ { "content": " def __setitem__(self, key, value):\n raise Exception(\"Cannot change value.\")", "metadata": "root.FrozenDict.__setitem__", "header": "['class', 'FrozenDict', '(', 'dict', ')', ':', '___EOS___']", "index": 51 }, { "content": " def __setitem__(self, index, value):\n raise Exception(\"No!\")", "metadata": "root.FmtStr.__setitem__", "header": "['class', 'FmtStr', '(', 'object', ')', ':', '___EOS___']", "index": 481 } ]
[ { "span": "def __setitem__(self, key, value):", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 38 }, { "span": "def __setitem__(self, index, value):", "start_line": 481, "start_column": 4, "end_line": 481, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "Fro", "zen", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Cann", "ot", " ", "change", " ", "value", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fmt", "Str_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "index_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "No", "!\"_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
jacebrowning/memegen/tests/test_routes_image.py
[ { "content": "def describe_get():\n\n def describe_visible():\n\n def basic(client):\n path = os.path.join(IMAGES, 'iw', 'hello', 'world.jpg')\n if os.path.exists(path):\n os.remove(path)\n\n response = client.get(\"/iw/hello/world.jpg\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n assert os.path.isfile(path)\n\n def with_only_1_line(client):\n response = client.get(\"/iw/hello.jpg\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n\n @pytest.mark.xfail(os.name == 'nt', reason=\"Windows has a path limit\")\n def with_lots_of_text(client):\n top = \"-\".join([\"hello\"] * 20)\n bottom = \"-\".join([\"world\"] * 20)\n response = client.get(\"/iw/\" + top + \"/\" + bottom + \".jpg\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n\n def describe_hidden():\n\n def when_jpg(client):\n response = client.get(\"/_aXcJaGVsbG8vd29ybGQJ.jpg\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n\n def describe_alt():\n\n def when_style(client):\n response = client.get(\"/sad-biden/hello.jpg?alt=scowl\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n\n def it_redirects_to_lose_alt_when_default_style(client):\n response = client.get(\"/sad-biden/hello.jpg?alt=default\")\n\n assert 302 == response.status_code\n assert '<a href=\"/sad-biden/hello.jpg\">' in \\\n load(response, as_json=False)\n\n def it_redirects_to_lose_alt_when_unknown_style(client):\n response = client.get(\"/sad-biden/hello.jpg?alt=__unknown__\")\n\n assert 302 == response.status_code\n assert '<a href=\"/sad-biden/hello.jpg\">' in \\\n load(response, as_json=False)\n\n def it_keeps_alt_after_template_redirect(client):\n response = client.get(\"/sad-joe/hello.jpg?alt=scowl\")\n\n assert 302 == response.status_code\n assert '<a href=\"/sad-biden/hello.jpg?alt=scowl\">' in \\\n load(response, as_json=False)\n\n def it_keeps_alt_after_text_redirect(client):\n response = client.get(\"/sad-biden.jpg?alt=scowl\")\n\n assert 302 == response.status_code\n assert '-vote.jpg?alt=scowl\">' in \\\n load(response, as_json=False)\n\n def when_url(client):\n url = \"http://www.gstatic.com/webp/gallery/1.jpg\"\n response = client.get(\"/sad-biden/hello.jpg?alt=\" + url)\n\n expect(response.status_code) == 200\n expect(response.mimetype) == 'image/jpeg'\n\n def it_returns_an_error_with_non_image_urls(client):\n url = \"http://example.com\"\n response = client.get(\"/sad-biden/hello.jpg?alt=\" + url)\n\n expect(response.status_code) == 415\n\n def it_redirects_to_lose_alt_when_unknown_url(client):\n url = \"http://example.com/not/a/real/image.jpg\"\n response = client.get(\"/sad-biden/hello.jpg?alt=\" + url)\n\n expect(response.status_code) == 302\n expect(load(response, as_json=False)).contains(\n '<a href=\"/sad-biden/hello.jpg\">')\n\n def it_redirects_to_lose_alt_when_bad_url(client):\n url = \"http:invalid\"\n response = client.get(\"/sad-biden/hello.jpg?alt=\" + url)\n\n expect(response.status_code) == 302\n expect(load(response, as_json=False)).contains(\n '<a href=\"/sad-biden/hello.jpg\">')\n\n def describe_latest():\n\n def when_existing(client):\n open(LATEST, 'w').close() # force the file to exist\n response = client.get(\"/latest.jpg\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n\n def when_missing(client):\n try:\n os.remove(LATEST)\n except FileNotFoundError:\n pass\n\n response = client.get(\"/latest.jpg\")\n\n assert 200 == response.status_code\n assert 'image/png' == response.mimetype\n\n def describe_redirects():\n\n def when_missing_dashes(client):\n response = client.get(\"/iw/HelloThere_World/How-areYOU.jpg\")\n\n assert 302 == response.status_code\n assert '<a href=\"/iw/hello-there-world/how-are-you.jpg\">' in \\\n load(response, as_json=False)\n\n def when_no_text(client):\n response = client.get(\"/live.jpg\")\n\n assert 302 == response.status_code\n assert '<a href=\"/live/_/do-it-live!.jpg\">' in \\\n load(response, as_json=False)\n\n def when_aliased_template(client):\n response = client.get(\"/insanity-wolf/hello/world.jpg\")\n\n assert 302 == response.status_code\n assert '<a href=\"/iw/hello/world.jpg\">' in \\\n load(response, as_json=False)\n\n def when_jpeg_extension_without_text(client):\n response = client.get(\"/iw.jpeg\")\n\n assert 302 == response.status_code\n assert '<a href=\"/iw.jpg\">' in \\\n load(response, as_json=False)\n\n def when_jpeg_extension_with_text(client):\n response = client.get(\"/iw/hello/world.jpeg\")\n\n assert 302 == response.status_code\n assert '<a href=\"/iw/hello/world.jpg\">' in \\\n load(response, as_json=False)\n\n def describe_errors():\n\n def when_unknown_template(client):\n response = client.get(\"/make/sudo/give.me.jpg\")\n\n assert 200 == response.status_code\n assert 'image/jpeg' == response.mimetype\n # unit tests ensure this is a placeholder image\n\n @pytest.mark.xfail(os.name == 'nt', reason=\"Windows has a path limit\")\n def when_too_much_text_for_a_filename(client):\n top = \"hello\"\n bottom = \"-\".join([\"world\"] * 50)\n response = client.get(\"/iw/\" + top + \"/\" + bottom + \".jpg\")\n\n assert 414 == response.status_code\n assert {\n 'message': \"Filename too long.\"\n } == load(response)", "metadata": "root.describe_get", "header": "['module', '___EOS___']", "index": 15 } ]
[ { "span": "describe_visible(", "start_line": 17, "start_column": 8, "end_line": 17, "end_column": 24 }, { "span": "basic(", "start_line": 19, "start_column": 12, "end_line": 19, "end_column": 17 }, { "span": "with_only_1_line(", "start_line": 30, "start_column": 12, "end_line": 30, "end_column": 28 }, { "span": "describe_hidden(", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 23 }, { "span": "when_jpg(", "start_line": 47, "start_column": 12, "end_line": 47, "end_column": 20 }, { "span": "describe_alt(", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 20 }, { "span": "when_style(", "start_line": 55, "start_column": 12, "end_line": 55, "end_column": 22 }, { "span": "it_redirects_to_lose_alt_when_default_style(", "start_line": 61, "start_column": 12, "end_line": 61, "end_column": 55 }, { "span": "it_redirects_to_lose_alt_when_unknown_style(", "start_line": 68, "start_column": 12, "end_line": 68, "end_column": 55 }, { "span": "it_keeps_alt_after_template_redirect(", "start_line": 75, "start_column": 12, "end_line": 75, "end_column": 48 }, { "span": "it_keeps_alt_after_text_redirect(", "start_line": 82, "start_column": 12, "end_line": 82, "end_column": 44 }, { "span": "when_url(", "start_line": 89, "start_column": 12, "end_line": 89, "end_column": 20 }, { "span": "it_returns_an_error_with_non_image_urls(", "start_line": 96, "start_column": 12, "end_line": 96, "end_column": 51 }, { "span": "it_redirects_to_lose_alt_when_unknown_url(", "start_line": 102, "start_column": 12, "end_line": 102, "end_column": 53 }, { "span": "it_redirects_to_lose_alt_when_bad_url(", "start_line": 110, "start_column": 12, "end_line": 110, "end_column": 49 }, { "span": "describe_latest(", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 23 }, { "span": "when_existing(", "start_line": 120, "start_column": 12, "end_line": 120, "end_column": 25 }, { "span": "when_missing(", "start_line": 127, "start_column": 12, "end_line": 127, "end_column": 24 }, { "span": "describe_redirects(", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 26 }, { "span": "when_missing_dashes(", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 31 }, { "span": "when_no_text(", "start_line": 147, "start_column": 12, "end_line": 147, "end_column": 24 }, { "span": "when_aliased_template(", "start_line": 154, "start_column": 12, "end_line": 154, "end_column": 33 }, { "span": "when_jpeg_extension_without_text(", "start_line": 161, "start_column": 12, "end_line": 161, "end_column": 44 }, { "span": "when_jpeg_extension_with_text(", "start_line": 168, "start_column": 12, "end_line": 168, "end_column": 41 }, { "span": "describe_errors(", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 23 }, { "span": "when_unknown_template(", "start_line": 177, "start_column": 12, "end_line": 177, "end_column": 33 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "descri", "be", "\\u", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "descri", "be", "\\u", "visible_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "basic_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "IMAGES", "_", ",_", "'", "iw", "'_", ",_", "'", "hell", "o", "'_", ",_", "'", "world", ".", "jp", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", "/", "hell", "o", "/", "world", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "with", "\\u", "only", "\\u", "1", "\\u", "line_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", "/", "hell", "o", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "xfail_", "(_", "os_", "._", "name_", "==_", "'", "nt", "'_", ",_", "reason_", "=_", "\"", "Window", "s", " ", "has", " ", "a", " ", "path", " ", "limit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "with", "\\u", "lots", "\\u", "of", "\\u", "text_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "\"-\"_", "._", "join_", "(_", "[_", "\"", "hell", "o", "\"_", "]_", "*_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottom_", "=_", "\"-\"_", "._", "join_", "(_", "[_", "\"", "world", "\"_", "]_", "*_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", "/\"_", "+_", "top_", "+_", "\"/\"_", "+_", "bottom_", "+_", "\".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\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_", "descri", "be", "\\u", "hidden_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "whe", "n", "\\u", "jp", "g_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "\\u", "a", "Xc", "Ja", "GV", "sb", "G", "8", "vd", "2", "9", "yb", "GQ", "J", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\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_", "descri", "be", "\\u", "alt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "whe", "n", "\\u", "style_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=", "sco", "wl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "redirec", "ts", "\\u", "to", "\\u", "lose", "\\u", "alt", "\\u", "whe", "n", "\\u", "default", "\\u", "style_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=", "default", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "redirec", "ts", "\\u", "to", "\\u", "lose", "\\u", "alt", "\\u", "whe", "n", "\\u", "unknown", "\\u", "style_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=", "\\u\\u", "unknown", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "keep", "s", "\\u", "alt", "\\u", "after", "\\u", "template", "\\u", "redirect_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "jo", "e", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=", "sco", "wl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=", "sco", "wl", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "keep", "s", "\\u", "alt", "\\u", "after", "\\u", "text", "\\u", "redirect_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", ".", "jp", "g", "?", "alt", "=", "sco", "wl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'-", "vote", ".", "jp", "g", "?", "alt", "=", "sco", "wl", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "whe", "n", "\\u", "url_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://", "www", ".", "gst", "atic", ".", "com", "/", "webp", "/", "gallery", "/", "1", ".", "jp", "g", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=\"_", "+_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "(_", "response_", "._", "status", "\\u", "code_", ")_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "(_", "response_", "._", "mimetype_", ")_", "==_", "'", "image", "/", "jpeg", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "return", "s", "\\u", "an", "\\u", "error", "\\u", "with", "\\u", "non", "\\u", "image", "\\u", "urls_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=\"_", "+_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "(_", "response_", "._", "status", "\\u", "code_", ")_", "==_", "415", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "redirec", "ts", "\\u", "to", "\\u", "lose", "\\u", "alt", "\\u", "whe", "n", "\\u", "unknown", "\\u", "url_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", "://", "example", ".", "com", "/", "not", "/", "a", "/", "real", "/", "image", ".", "jp", "g", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=\"_", "+_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "(_", "response_", "._", "status", "\\u", "code_", ")_", "==_", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "(_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", ")_", "._", "contains_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "a", " ", "href", "=\"", "/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "it", "\\u", "redirec", "ts", "\\u", "to", "\\u", "lose", "\\u", "alt", "\\u", "whe", "n", "\\u", "bad", "\\u", "url_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "\"", "http", ":", "invalid", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "?", "alt", "=\"_", "+_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "(_", "response_", "._", "status", "\\u", "code_", ")_", "==_", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "(_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", ")_", "._", "contains_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "a", " ", "href", "=\"", "/", "sad", "-", "bid", "en", "/", "hell", "o", ".", "jp", "g", "\">'_", ")_", "\\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_", "descri", "be", "\\u", "latest_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "whe", "n", "\\u", "existing_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", "LATE", "ST_", ",_", "'", "w", "'_", ")_", "._", "close_", "(_", ")_", "#", " ", "force", " ", "the", " ", "file", " ", "to", " ", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "late", "st", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "whe", "n", "\\u", "missing_", "(_", "client_", ")_", ":_", "\\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_", "(_", "LATE", "ST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "File", "Not", "Foun", "d", "Error_", ":_", "\\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_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "late", "st", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "png", "'_", "==_", "response_", "._", "mimetype_", "\\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_", "descri", "be", "\\u", "redirects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "whe", "n", "\\u", "missi", "ng", "\\u", "dashes", "_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", "/", "Hell", "o", "There", "\\u", "Wor", "ld", "/", "Ho", "w", "-", "are", "YOU", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "iw", "/", "hell", "o", "-", "there", "-", "world", "/", "how", "-", "are", "-", "you", ".", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "whe", "n", "\\u", "no", "\\u", "text_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "live", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "live", "/\\u", "/", "do", "-", "it", "-", "live", "!.", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "whe", "n", "\\u", "aliased", "\\u", "template_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "ins", "ani", "ty", "-", "wolf", "/", "hell", "o", "/", "world", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "iw", "/", "hell", "o", "/", "world", ".", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "whe", "n", "\\u", "jpeg", "\\u", "extensi", "on", "\\u", "with", "out", "\\u", "text_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", ".", "jpeg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "iw", ".", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "whe", "n", "\\u", "jpeg", "\\u", "extensi", "on", "\\u", "with", "\\u", "text_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", "/", "hell", "o", "/", "world", ".", "jpeg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "302_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'<", "a", " ", "href", "=\"", "/", "iw", "/", "hell", "o", "/", "world", ".", "jp", "g", "\">'_", "in_", "load_", "(_", "response_", ",_", "as", "\\u", "json_", "=_", "False_", ")_", "\\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_", "descri", "be", "\\u", "errors_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "whe", "n", "\\u", "unknown", "\\u", "template_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "make", "/", "sudo", "/", "give", ".", "me", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "200_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "image", "/", "jpeg", "'_", "==_", "response_", "._", "mimetype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unit", " ", "tests", " ", "ensure", " ", "this", " ", "is", " ", "a", " ", "placehold", "er", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "xfail_", "(_", "os_", "._", "name_", "==_", "'", "nt", "'_", ",_", "reason_", "=_", "\"", "Window", "s", " ", "has", " ", "a", " ", "path", " ", "limit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "whe", "n", "\\u", "too", "\\u", "muc", "h", "\\u", "text", "\\u", "for", "\\u", "a", "\\u", "filename_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "\"", "hell", "o", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottom_", "=_", "\"-\"_", "._", "join_", "(_", "[_", "\"", "world", "\"_", "]_", "*_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "client_", "._", "get_", "(_", "\"/", "iw", "/\"_", "+_", "top_", "+_", "\"/\"_", "+_", "bottom_", "+_", "\".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "414", "_", "==_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "\"", "File", "name", " ", "too", " ", "long", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "==_", "load_", "(_", "response_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ejeschke/ginga/ginga/mockw/CanvasRenderMock.py
[ { "content": "#\n# CanvasRenderMock.py -- for rendering into a ImageViewMock widget\n#\n# Eric Jeschke (eric@naoj.org)\n#\n# Copyright (c) Eric R. Jeschke. All rights reserved.\n# This is open-source software licensed under a BSD license.\n# Please see the file LICENSE.txt for details.\n#\n# force registration of all canvas types\nimport ginga.canvas.types.all\n\n\n\n#END\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RenderContext(object):\n\n\n\n\n\n\n\n\n\n\n\n ##### DRAWING OPERATIONS #####\n\n\n\n\n\n\n", "metadata": "root.RenderContext", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, viewer):\n self.viewer = viewer\n\n # TODO: encapsulate this drawable\n #self.cr = GraphicsContext(self.viewer.pixmap)\n self.cr = None", "metadata": "root.RenderContext.__init__", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 14 }, { "content": " def __get_color(self, color, alpha):\n # return a color in the widget's native object\n # color is either a string or a 3-tuple of floats in 0-1 range\n clr = None\n return clr", "metadata": "root.RenderContext.__get_color", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def set_line_from_shape(self, shape):\n pass", "metadata": "root.RenderContext.set_line_from_shape", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def set_fill_from_shape(self, shape):\n pass", "metadata": "root.RenderContext.set_fill_from_shape", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": " def set_font_from_shape(self, shape):\n pass", "metadata": "root.RenderContext.set_font_from_shape", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 33 }, { "content": " def initialize_from_shape(self, shape, line=True, fill=True, font=True):\n if line:\n self.set_line_from_shape(shape)\n if fill:\n self.set_fill_from_shape(shape)\n if font:\n self.set_font_from_shape(shape)", "metadata": "root.RenderContext.initialize_from_shape", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def set_line(self, color, alpha=1.0, linewidth=1, style='solid'):\n pass", "metadata": "root.RenderContext.set_line", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def set_fill(self, color, alpha=1.0):\n pass", "metadata": "root.RenderContext.set_fill", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def set_font(self, fontname, fontsize, color='black', alpha=1.0):\n pass", "metadata": "root.RenderContext.set_font", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def text_extents(self, text):\n # TODO: how to mock this?\n width = 200\n height = 15\n return width, height", "metadata": "root.RenderContext.text_extents", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def draw_text(self, cx, cy, text, rot_deg=0.0):\n #self.cr.draw_text(cx, cy, text)\n pass", "metadata": "root.RenderContext.draw_text", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def draw_polygon(self, cpoints):\n #self.cr.draw_polygon(cpoints)\n pass", "metadata": "root.RenderContext.draw_polygon", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def draw_circle(self, cx, cy, cradius):\n cradius = float(cradius)\n self.draw_ellipse(cx, cy, cradius, cradius, 0.0)", "metadata": "root.RenderContext.draw_circle", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " def draw_ellipse(self, cx, cy, cradius, cyradius, theta):\n #self.cr.draw_ellipse((cx, cy), (cxradius, cyradius), theta)\n pass", "metadata": "root.RenderContext.draw_ellipse", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 73 }, { "content": " def draw_line(self, cx1, cy1, cx2, cy2):\n #self.cr.draw_line(cx1, cy1, cx2, cy2)\n pass", "metadata": "root.RenderContext.draw_line", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def draw_path(self, cpoints):\n for i in range(len(cpoints) - 1):\n cx1, cy1 = cpoints[i]\n cx2, cy2 = cpoints[i+1]\n #self.cr.draw_line(cx1, cy1, cx2, cy2)", "metadata": "root.RenderContext.draw_path", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 81 }, { "content": " def draw_bezier_curve(self, cp):\n pass", "metadata": "root.RenderContext.draw_bezier_curve", "header": "['class', 'RenderContext', '(', 'object', ')', ':', '___EOS___']", "index": 87 }, { "content": "class CanvasRenderer(object):\n\n\n", "metadata": "root.CanvasRenderer", "header": "['module', '___EOS___']", "index": 90 }, { "content": " def __init__(self, viewer):\n self.viewer = viewer", "metadata": "root.CanvasRenderer.__init__", "header": "['class', 'CanvasRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def setup_cr(self, shape):\n cr = RenderContext(self.viewer)\n cr.initialize_from_shape(shape, font=False)\n return cr", "metadata": "root.CanvasRenderer.setup_cr", "header": "['class', 'CanvasRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def get_dimensions(self, shape):\n cr = self.setup_cr(shape)\n cr.set_font_from_shape(shape)\n return cr.text_extents(shape.text)", "metadata": "root.CanvasRenderer.get_dimensions", "header": "['class', 'CanvasRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 100 } ]
[ { "span": "import ginga.canvas.types.all", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Can", "vas", "Render", "Moc", "k", ".", "py", " ", "--", " ", "for", " ", "render", "ing", " ", "int", "o", " ", "a", " ", "Image", "View", "Moc", "k", " ", "widget_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Eri", "c", " ", "Je", "sch", "ke", " ", "(", "eric", "@", "nao", "j", ".", "org", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Eri", "c", " ", "R", ".", " ", "Je", "sch", "ke", ".", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "open", "-", "source", " ", "software", " ", "license", "d", " ", "under", " ", "a", " ", "BS", "D", " ", "license", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "see", " ", "the", " ", "file", " ", "LICENSE", ".", "txt", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "registration", " ", "of", " ", "all", " ", "canv", "as", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ging", "a_", "._", "canvas_", "._", "types_", "._", "all_", "\\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_", "\\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_", "Render", "Context_", "(_", "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\\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_", "#####", " ", "DRAW", "ING", " ", "OPERATION", "S", " ", "#####", "_", "\\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\\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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "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_", ",_", "viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "viewer_", "=_", "viewer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "encapsulat", "e", " ", "this", " ", "drawa", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "cr", " ", "=", " ", "Graphic", "s", "Context", "(", "self", ".", "viewer", ".", "pixmap", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "color_", "(_", "self_", ",_", "color_", ",_", "alpha_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "a", " ", "color", " ", "in", " ", "the", " ", "widget", "'", "s", " ", "nativ", "e", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "color", " ", "is", " ", "eit", "her", " ", "a", " ", "string", " ", "or", " ", "a", " ", "3", "-", "tuple", " ", "of", " ", "float", "s", " ", "in", " ", "0", "-1", " ", "range_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "clr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "line", "\\u", "from", "\\u", "shape_", "(_", "self_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "fill", "\\u", "from", "\\u", "shape_", "(_", "self_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "font", "\\u", "from", "\\u", "shape_", "(_", "self_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "initialize", "\\u", "from", "\\u", "shape_", "(_", "self_", ",_", "shape_", ",_", "line_", "=_", "True_", ",_", "fill_", "=_", "True_", ",_", "font_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "line", "\\u", "from", "\\u", "shape_", "(_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fill_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "fill", "\\u", "from", "\\u", "shape_", "(_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "font_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "font", "\\u", "from", "\\u", "shape_", "(_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "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_", "def_", "set\\u", "line_", "(_", "self_", ",_", "color_", ",_", "alpha_", "=_", "1.0_", ",_", "linewidth_", "=_", "1_", ",_", "style_", "=_", "'", "solid", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "fill_", "(_", "self_", ",_", "color_", ",_", "alpha_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "font_", "(_", "self_", ",_", "font", "name_", ",_", "fontsize_", ",_", "color_", "=_", "'", "black", "'_", ",_", "alpha_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "text", "\\u", "extents_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "how", " ", "to", " ", "mock", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "width_", ",_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "text_", "(_", "self_", ",_", "cx_", ",_", "cy_", ",_", "text_", ",_", "rot", "\\u", "deg_", "=_", "0.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cr", ".", "draw", "\\u", "text", "(", "cx", ",", " ", "cy", ",", " ", "text", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "polygon_", "(_", "self_", ",_", "cpo", "ints_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cr", ".", "draw", "\\u", "poly", "gon", "(", "cpo", "ints", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "circle_", "(_", "self_", ",_", "cx_", ",_", "cy_", ",_", "cra", "diu", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cra", "diu", "s_", "=_", "float_", "(_", "cra", "diu", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "\\u", "ellipse_", "(_", "cx_", ",_", "cy_", ",_", "cra", "diu", "s_", ",_", "cra", "diu", "s_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "ellipse_", "(_", "self_", ",_", "cx_", ",_", "cy_", ",_", "cra", "diu", "s_", ",_", "cyr", "adi", "us_", ",_", "theta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cr", ".", "draw", "\\u", "ellips", "e", "((", "cx", ",", " ", "cy", "),", " ", "(", "cx", "radi", "us", ",", " ", "cyr", "adi", "us", "),", " ", "theta", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "line_", "(_", "self_", ",_", "cx", "1_", ",_", "cy", "1_", ",_", "cx", "2_", ",_", "cy", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cr", ".", "draw", "\\u", "line", "(", "cx", "1", ",", " ", "cy", "1", ",", " ", "cx", "2", ",", " ", "cy", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "path_", "(_", "self_", ",_", "cpo", "ints_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "cpo", "ints_", ")_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cx", "1_", ",_", "cy", "1_", "=_", "cpo", "ints_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cx", "2_", ",_", "cy", "2_", "=_", "cpo", "ints_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cr", ".", "draw", "\\u", "line", "(", "cx", "1", ",", " ", "cy", "1", ",", " ", "cx", "2", ",", " ", "cy", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Render", "Context_", "(_", "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_", "def_", "draw", "\\u", "bezier", "\\u", "curve_", "(_", "self_", ",_", "cp_", ")_", ":_", "\\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_", "Can", "vas", "Renderer_", "(_", "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_", "[SEP]_", "class_", "Can", "vas", "Renderer_", "(_", "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_", ",_", "viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "viewer_", "=_", "viewer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Can", "vas", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "cr_", "(_", "self_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "Render", "Context_", "(_", "self_", "._", "viewer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "._", "initialize", "\\u", "from", "\\u", "shape_", "(_", "shape_", ",_", "font_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Can", "vas", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "dimensions_", "(_", "self_", ",_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr_", "=_", "self_", "._", "setup", "\\u", "cr_", "(_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr_", "._", "set\\u", "font", "\\u", "from", "\\u", "shape_", "(_", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cr_", "._", "text", "\\u", "extents_", "(_", "shape_", "._", "text_", ")_", "\\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,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 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, 4, 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, 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 ]
Unused local variable
rackspace/pyrax/pyrax/cloudloadbalancers.py
[ { "content": " def delete_health_monitor(self, loadbalancer):\n \"\"\"\n Deletes the health monitor for the load balancer.\n \"\"\"\n uri = \"/loadbalancers/%s/healthmonitor\" % utils.get_id(loadbalancer)\n resp, body = self.api.method_delete(uri)", "metadata": "root.CloudLoadBalancerManager.delete_health_monitor", "header": "['class', 'CloudLoadBalancerManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 679 }, { "content": " def delete_connection_throttle(self, loadbalancer):\n \"\"\"\n Deletes all connection throttling settings for the load balancer.\n \"\"\"\n uri = \"/loadbalancers/%s/connectionthrottle\" % utils.get_id(loadbalancer)\n resp, body = self.api.method_delete(uri)", "metadata": "root.CloudLoadBalancerManager.delete_connection_throttle", "header": "['class', 'CloudLoadBalancerManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 721 }, { "content": " def delete_ssl_termination(self, loadbalancer):\n \"\"\"\n Deletes the SSL Termination configuration for the load balancer.\n \"\"\"\n uri = \"/loadbalancers/%s/ssltermination\" % utils.get_id(loadbalancer)\n resp, body = self.api.method_delete(uri)", "metadata": "root.CloudLoadBalancerManager.delete_ssl_termination", "header": "['class', 'CloudLoadBalancerManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 791 }, { "content": " def update_metadata(self, loadbalancer, metadata, node=None):\n \"\"\"\n Updates the existing metadata with the supplied dictionary. If\n 'node' is supplied, the metadata for that node is updated instead\n of for the load balancer.\n \"\"\"\n # Get the existing metadata\n md = self.get_metadata(loadbalancer, raw=True)\n id_lookup = dict([(itm[\"key\"], itm[\"id\"]) for itm in md])\n metadata_list = []\n # Updates must be done individually\n for key, val in metadata.items():\n try:\n meta_id = id_lookup[key]\n if node:\n uri = \"/loadbalancers/%s/nodes/%s/metadata/%s\" % (\n utils.get_id(loadbalancer), utils.get_id(node),\n meta_id)\n else:\n uri = \"/loadbalancers/%s/metadata\" % utils.get_id(loadbalancer)\n req_body = {\"meta\": {\"value\": val}}\n resp, body = self.api.method_put(uri, body=req_body)\n except KeyError:\n # Not an existing key; add to metadata_list\n metadata_list.append({\"key\": key, \"value\": val})\n if metadata_list:\n # New items; POST them\n if node:\n uri = \"/loadbalancers/%s/nodes/%s/metadata\" % (\n utils.get_id(loadbalancer), utils.get_id(node))\n else:\n uri = \"/loadbalancers/%s/metadata\" % utils.get_id(loadbalancer)\n req_body = {\"metadata\": metadata_list}\n resp, body = self.api.method_post(uri, body=req_body)", "metadata": "root.CloudLoadBalancerManager.update_metadata", "header": "['class', 'CloudLoadBalancerManager', '(', 'BaseManager', ')', ':', '___EOS___']", "index": 838 } ]
[ { "span": "resp,", "start_line": 684, "start_column": 8, "end_line": 684, "end_column": 12 }, { "span": "body ", "start_line": 684, "start_column": 14, "end_line": 684, "end_column": 18 }, { "span": "resp,", "start_line": 726, "start_column": 8, "end_line": 726, "end_column": 12 }, { "span": "body ", "start_line": 726, "start_column": 14, "end_line": 726, "end_column": 18 }, { "span": "resp,", "start_line": 796, "start_column": 8, "end_line": 796, "end_column": 12 }, { "span": "body ", "start_line": 796, "start_column": 14, "end_line": 796, "end_column": 18 }, { "span": "resp,", "start_line": 871, "start_column": 12, "end_line": 871, "end_column": 16 }, { "span": "body ", "start_line": 871, "start_column": 18, "end_line": 871, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Cloud", "Load", "Balance", "r", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "health", "\\u", "monitor_", "(_", "self_", ",_", "loadbalancer", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", "s", " ", "the", " ", "health", " ", "monit", "or", " ", "for", " ", "the", " ", "load", " ", "balancer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "health", "monit", "or", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", ",_", "body_", "=_", "self_", "._", "api_", "._", "method", "\\u", "delete_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Load", "Balance", "r", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "connecti", "on", "\\u", "throttle_", "(_", "self_", ",_", "loadbalancer", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", "s", " ", "all", " ", "connecti", "on", " ", "thro", "ttl", "ing", " ", "settings", " ", "for", " ", "the", " ", "load", " ", "balancer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "connecti", "ont", "hro", "ttl", "e", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", ",_", "body_", "=_", "self_", "._", "api_", "._", "method", "\\u", "delete_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Load", "Balance", "r", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "ssl", "\\u", "termination", "_", "(_", "self_", ",_", "loadbalancer", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", "s", " ", "the", " ", "SS", "L", " ", "Terminati", "on", " ", "configura", "tion", " ", "for", " ", "the", " ", "load", " ", "balancer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "ssl", "termination", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", ",_", "body_", "=_", "self_", "._", "api_", "._", "method", "\\u", "delete_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Load", "Balance", "r", "Manager_", "(_", "Base", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "metadata_", "(_", "self_", ",_", "loadbalancer", "_", ",_", "metadata_", ",_", "node_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", "s", " ", "the", " ", "exist", "ing", " ", "metadata", " ", "with", " ", "the", " ", "supplie", "d", " ", "dictionar", "y", ".", " ", "If", "\\", "10", ";", " ", " ", " ", " ", "'", "node", "'", " ", "is", " ", "supplie", "d", ",", " ", "the", " ", "metadata", " ", "for", " ", "tha", "t", " ", "node", " ", "is", " ", "update", "d", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "for", " ", "the", " ", "load", " ", "balancer", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "exist", "ing", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "md_", "=_", "self_", "._", "get", "\\u", "metadata_", "(_", "loadbalancer", "_", ",_", "raw_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "lookup_", "=_", "dict_", "(_", "[_", "(_", "itm_", "[_", "\"", "key", "\"_", "]_", ",_", "itm_", "[_", "\"", "id", "\"_", "]_", ")_", "for_", "itm_", "in_", "md_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", "s", " ", "must", " ", "be", " ", "don", "e", " ", "individual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "metadata_", "._", "items_", "(_", ")_", ":_", "\\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 ", " _", "meta", "\\u", "id_", "=_", "id", "\\u", "lookup_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "nodes", "/", "%", "s", "/", "metadata", "/", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", ",_", "utils_", "._", "get", "\\u", "id_", "(_", "node_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "meta", "\\u", "id_", ")_", "\\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 ", " ", "_", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "metadata", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req", "\\u", "body_", "=_", "{_", "\"", "meta", "\"_", ":_", "{_", "\"", "value", "\"_", ":_", "val_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", ",_", "body_", "=_", "self_", "._", "api_", "._", "method", "\\u", "put_", "(_", "uri_", ",_", "body_", "=_", "req", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "an", " ", "exist", "ing", " ", "key", ";", " ", "add", " ", "to", " ", "metadata", "\\u", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata", "\\u", "list_", "._", "append_", "(_", "{_", "\"", "key", "\"_", ":_", "key_", ",_", "\"", "value", "\"_", ":_", "val_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "metadata", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "items", ";", " ", "POST", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "nodes", "/", "%", "s", "/", "metadata", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", ",_", "utils_", "._", "get", "\\u", "id_", "(_", "node_", ")_", ")_", "\\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 ", " _", "uri_", "=_", "\"/", "loadbalancer", "s", "/", "%", "s", "/", "metadata", "\"_", "%_", "utils_", "._", "get", "\\u", "id_", "(_", "loadbalancer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req", "\\u", "body_", "=_", "{_", "\"", "metadata", "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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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rapidsms/rapidsms/rapidsms/contrib/messagelog/south_migrations/0001_initial.py
[ { "content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'messagelog.message': {\n 'Meta': {'object_name': 'Message'},\n 'connection': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['rapidsms.Connection']\", 'null': 'True'}),\n 'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['rapidsms.Contact']\", 'null': 'True'}),\n 'date': ('django.db.models.fields.DateTimeField', [], {}),\n 'direction': ('django.db.models.fields.CharField', [], {'max_length': '1'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'text': ('django.db.models.fields.TextField', [], {})\n },\n u'rapidsms.backend': {\n 'Meta': {'object_name': 'Backend'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'})\n },\n u'rapidsms.connection': {\n 'Meta': {'unique_together': \"(('backend', 'identity'),)\", 'object_name': 'Connection'},\n 'backend': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['rapidsms.Backend']\"}),\n 'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['rapidsms.Contact']\", 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'identity': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n u'rapidsms.contact': {\n 'Meta': {'object_name': 'Contact'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.CharField', [], {'max_length': '6', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})\n }\n }\n\n complete_apps = ['messagelog']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding model 'Message'\n db.create_table(u'messagelog_message', (\n (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('contact', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['rapidsms.Contact'], null=True)),\n ('connection', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['rapidsms.Connection'], null=True)),\n ('direction', self.gf('django.db.models.fields.CharField')(max_length=1)),\n ('date', self.gf('django.db.models.fields.DateTimeField')()),\n ('text', self.gf('django.db.models.fields.TextField')()),\n ))\n db.send_create_signal(u'messagelog', ['Message'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting model 'Message'\n db.delete_table(u'messagelog_message')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 22 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\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_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "message", "log", ".", "message", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Messag", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "connecti", "on", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "rapid", "sms", ".", "Connect", "ion", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "rapid", "sms", ".", "Conta", "ct", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "direction", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "rapid", "sms", ".", "back", "end", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Back", "end", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "20", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "rapid", "sms", ".", "connecti", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "back", "end", "',", " ", "'", "identi", "ty", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Connect", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "back", "end", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "rapid", "sms", ".", "Back", "end", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contact", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "rapid", "sms", ".", "Conta", "ct", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "identi", "ty", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "rapid", "sms", ".", "contact", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Conta", "ct", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "6", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "message", "log", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Messag", "e", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "u", "'", "message", "log", "\\u", "message", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "u", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "contact", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "rapid", "sms", ".", "Conta", "ct", "'_", "]_", ",_", "null_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "connecti", "on", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "rapid", "sms", ".", "Connect", "ion", "'_", "]_", ",_", "null_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "direction", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "text", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "u", "'", "message", "log", "'_", ",_", "[_", "'", "Messag", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Messag", "e", "'_", "\\u\\u\\uNL\\u\\u\\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, 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 ]
Except block handles 'BaseException'
hgascon/pulsar/pulsar/core/sippy/Udp_server.py
[ { "content": " def run(self):\n while True:\n self.userv.wi_available.acquire()\n while len(self.userv.wi) == 0:\n self.userv.wi_available.wait()\n wi = self.userv.wi.pop(0)\n if wi == None:\n # Shutdown request, relay it further\n self.userv.wi.append(None)\n self.userv.wi_available.notify()\n self.userv.wi_available.release()\n if wi == None:\n break\n data, address = wi\n try:\n ai = socket.getaddrinfo(address[0], None, self.userv.family)\n except:\n continue\n if self.userv.family == socket.AF_INET:\n address = (ai[0][4][0], address[1])\n else:\n address = (ai[0][4][0], address[1], ai[0][4][2], ai[0][4][3])\n for i in range(0, 20):\n try:\n if self.userv.skt.sendto(data, address) == len(data):\n break\n except socket.error, why:\n if why[0] not in (EWOULDBLOCK, ENOBUFS, EAGAIN):\n break\n sleep(0.01)\n self.userv = None", "metadata": "root.AsyncSender.run", "header": "['class', 'AsyncSender', '(', 'Thread', ')', ':', '___EOS___']", "index": 43 }, { "content": " def handle_read(self, data, address):\n self.stats[2] += 1\n try:\n self.data_callback(data, address, self)\n except:\n print datetime.now(), 'Udp_server: unhandled exception when processing incoming data'\n print '-' * 70\n traceback.print_exc(file = sys.stdout)\n print '-' * 70\n sys.stdout.flush()", "metadata": "root.Udp_server.handle_read", "header": "['class', 'Udp_server', '(', 'object', ')', ':', '___EOS___']", "index": 157 } ]
[ { "span": "except:", "start_line": 59, "start_column": 12, "end_line": 59, "end_column": 19 }, { "span": "except:", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Async", "Sender_", "(_", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "self_", "._", "user", "v_", "._", "wi", "_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wi", "_", "=_", "self_", "._", "user", "v_", "._", "wi", "_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wi", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shut", "down", " ", "request", ",", " ", "relay", " ", "it", " ", "fur", "ther_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "v_", "._", "wi", "_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "notify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "user", "v_", "._", "wi", "\\u", "available_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wi", "_", "==_", "None_", ":_", "\\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_", "data_", ",_", "address_", "=_", "wi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ai_", "=_", "socket_", "._", "getadd", "rin", "fo_", "(_", "address_", "[_", "0_", "]_", ",_", "None_", ",_", "self_", "._", "user", "v_", "._", "family_", ")_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "user", "v_", "._", "family_", "==_", "socket_", "._", "AF", "\\u", "INET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "(_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "0_", "]_", ",_", "address_", "[_", "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 ", " _", "address_", "=_", "(_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "0_", "]_", ",_", "address_", "[_", "1_", "]_", ",_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "2_", "]_", ",_", "ai_", "[_", "0_", "]_", "[_", "4_", "]_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "20_", ")_", ":_", "\\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_", "self_", "._", "user", "v_", "._", "sk", "t_", "._", "sendto_", "(_", "data_", ",_", "address_", ")_", "==_", "len_", "(_", "data_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "why_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "why_", "[_", "0_", "]_", "not_", "in_", "(_", "EW", "OU", "LDB", "LOCK_", ",_", "ENO", "BUF", "S_", ",_", "EA", "GAIN", "_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "user", "v_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Udp", "\\u", "server_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "read_", "(_", "self_", ",_", "data_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stats_", "[_", "2_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data\\u", "callback_", "(_", "data_", ",_", "address_", ",_", "self_", ")_", "\\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 ", " _", "print_", "datetime_", "._", "now_", "(_", ")_", ",_", "'", "Udp", "\\u", "server", ":", " ", "unhandled", " ", "exception", " ", "whe", "n", " ", "process", "ing", " ", "inco", "ming", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-'_", "*_", "70_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", "file_", "=_", "sys_", "._", "stdout_", ")_", "\\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, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jplana/python-etcd/src/etcd/tests/unit/test_old_request.py
[ { "content": " def test_test_and_test_failure(self):\n \"\"\" Exception will be raised if prevValue != value in test_set \"\"\"\n\n client = etcd.Client()\n client.api_execute = mock.Mock(\n side_effect=ValueError(\n 'The given PrevValue is not equal'\n ' to the value of the key : TestAndSet: 1!=3'))\n try:\n result = client.test_and_set(\n '/testkey',\n 'newvalue',\n 'test', ttl=19)\n except ValueError as e:\n #from ipdb import set_trace; set_trace()\n self.assertEquals(\n 'The given PrevValue is not equal'\n ' to the value of the key : TestAndSet: 1!=3', str(e))", "metadata": "root.TestClientRequest.test_test_and_test_failure", "header": "['class', 'TestClientRequest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 81 } ]
[ { "span": "result ", "start_line": 90, "start_column": 12, "end_line": 90, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Client", "Request_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "test\\u", "and", "\\u", "test\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Except", "ion", " ", "will", " ", "be", " ", "raise", "d", " ", "if", " ", "prev", "Value", " ", "!=", " ", "value", " ", "in", " ", "test\\u", "set", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "etcd", "_", "._", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "api", "\\u", "execute_", "=_", "mock_", "._", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "side", "\\u", "effect_", "=_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "give", "n", " ", "Prev", "Value", " ", "is", " ", "not", " ", "equal", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "to", " ", "the", " ", "value", " ", "of", " ", "the", " ", "key", " ", ":", " ", "Test", "And", "Set", ":", " ", "1", "!=", "3", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "client_", "._", "test\\u", "and", "\\u", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "test", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "newval", "ue", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ",_", "ttl_", "=_", "19_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "ipd", "b", " ", "import", " ", "set\\u", "trace", ";", " ", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "give", "n", " ", "Prev", "Value", " ", "is", " ", "not", " ", "equal", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "to", " ", "the", " ", "value", " ", "of", " ", "the", " ", "key", " ", ":", " ", "Test", "And", "Set", ":", " ", "1", "!=", "3", "'_", ",_", "str_", "(_", "e_", ")_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
EricssonResearch/calvin-base/calvin/runtime/south/plugins/storage/twistedimpl/securedht/tests/test_dht_server_nice4.py
[ { "content": " @pytest.inlineCallbacks\n def test_dht_multi(self, monkeypatch):\n iface = \"0.0.0.0\"\n a = None\n b = None\n q = Queue.Queue()\n\n\n def server_started(aa, *args):\n for b in args:\n if isinstance(b, twisted.python.failure.Failure):\n b.printTraceback()\n else:\n _log.debug(\"** %s\" % b)\n q.put([aa,args])\n\n try:\n amount_of_servers = 5\n # Twisted is using 20 threads so having > 20 server\n # causes threadlocks really easily.\n\n servers = []\n callbacks = []\n for servno in range(0, amount_of_servers):\n a = AutoDHTServer()\n servers.append(a)\n callback = CalvinCB(server_started, str(servno))\n servers[servno].start(iface, network=\"Niklas\", cb=callback, name=name + \"{}\".format(servno))\n callbacks.append(callback)\n \n # Wait for start\n started = []\n while len(started) < amount_of_servers:\n try:\n server = yield threads.defer_to_thread(q.get)\n except Queue.Empty:\n _log.debug(\"Queue empty!\")\n #raise \n if server not in started:\n started.append(server)\n #print(\"DHT Servers added: {}\".format(started))\n callbacks[int(server[0][0])].func = lambda *args, **kvargs:None\n else:\n print(\"Server: {} already started.\" \\\n \" {} out of {}\".format(started,\n len(started),\n amount_of_servers))\n\n print(\"All {} out of {} started\".format(started,\n len(started),\n amount_of_servers))\n for servno in range(0, amount_of_servers):\n assert [str(servno), self._sucess_start] in started\n \n yield threads.defer_to_thread(q.queue.clear)\n yield threads.defer_to_thread(time.sleep, 8)\n\n key = \"HARE\"\n value = json.dumps([\"morot\"])\n set_def = servers[0].append(key=key, value=value)\n set_value = yield threads.defer_to_thread(set_def.wait, 10)\n assert set_value\n print(\"Node with port {} posted append key={}, value={}\".format(servers[0].dht_server.port.getHost().port, key, value))\n value = json.dumps([\"selleri\"])\n set_def = servers[0].append(key=key, value=value)\n set_value = yield threads.defer_to_thread(set_def.wait, 10)\n assert set_value\n print(\"Node with port {} posted append key={}, value={}\".format(servers[0].dht_server.port.getHost().port, key, value))\n get_def = servers[0].get_concat(key=key)\n get_value = yield threads.defer_to_thread(get_def.wait, 10)\n assert set(json.loads(get_value)) == set([\"morot\", \"selleri\"])\n print(\"Node with port {} confirmed key={}, value={} was reachable\".format(servers[0].dht_server.port.getHost().port, key, get_value))\n\n drawNetworkState(\"1nice_graph.png\", servers, amount_of_servers)\n yield threads.defer_to_thread(time.sleep, 7)\n drawNetworkState(\"1middle_graph.png\", servers, amount_of_servers)\n yield threads.defer_to_thread(time.sleep, 7)\n drawNetworkState(\"1end_graph.png\", servers, amount_of_servers)\n\n get_def = servers[0].get_concat(key=key)\n get_value = yield threads.defer_to_thread(get_def.wait, 10)\n assert set(json.loads(get_value)) == set([\"morot\", \"selleri\"])\n print(\"Node with port {} got right value: {}\".format(servers[0].dht_server.port.getHost().port, get_value))\n value = json.dumps([\"morot\"])\n set_def = servers[0].remove(key=key, value=value)\n set_value = yield threads.defer_to_thread(set_def.wait, 10)\n assert set_value\n print(\"Node with port {} posted remove key={}, value={}\".format(servers[0].dht_server.port.getHost().port, key, value))\n get_def = servers[1].get_concat(key=key)\n get_value = yield threads.defer_to_thread(get_def.wait, 10)\n assert set(json.loads(get_value)) == set([\"selleri\"])\n print(\"Node with port {} got right value: {}\".format(servers[0].dht_server.port.getHost().port, get_value))\n for i in range(0, amount_of_servers):\n name_dir = os.path.join(_cert_conf[\"CA_default\"][\"runtimes_dir\"], \"{}{}\".format(name, i))\n filenames = os.listdir(os.path.join(name_dir, \"others\"))\n print(\"Node with port {} has {} certificates in store\".format(servers[i].dht_server.port.getHost().port, len(filenames)))\n\n except AssertionError as e:\n print(\"Node with port {} got wrong value: {}, should have been {}\".format(servers[0].dht_server.port.getHost().port, get_value, value))\n pytest.fail(traceback.format_exc())\n except Exception as e:\n traceback.print_exc()\n pytest.fail(traceback.format_exc())\n finally:\n yield threads.defer_to_thread(time.sleep, 10)\n i = 0\n for server in servers:\n name_dir = os.path.join(_cert_conf[\"CA_default\"][\"runtimes_dir\"], name + \"{}\".format(i))\n shutil.rmtree(os.path.join(name_dir, \"others\"), ignore_errors=True)\n os.mkdir(os.path.join(name_dir, \"others\"))\n i += 1\n server.stop()", "metadata": "root.TestDHT.test_dht_multi", "header": "['class', 'TestDHT', '(', 'object', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "b ", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "DH", "T_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "dht", "\\u", "multi_", "(_", "self_", ",_", "monkeypatch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iface_", "=_", "\"", "0.", "0.", "0.", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "Queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "server", "\\u", "started_", "(_", "aa_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "b_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "b_", ",_", "twisted_", "._", "python_", "._", "failure_", "._", "Failure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "b_", "._", "print", "Trace", "back_", "(_", ")_", "\\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 ", " ", "_", "\\u", "log_", "._", "debug_", "(_", "\"**", " ", "%", "s", "\"_", "%_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", "._", "put_", "(_", "[_", "aa_", ",_", "args_", "]_", ")_", "\\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 ", " _", "amo", "unt", "\\u", "of", "\\u", "servers_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Twi", "sted", " ", "is", " ", "usi", "ng", " ", "20", " ", "thread", "s", " ", "so", " ", "hav", "ing", " ", ">", " ", "20", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "caus", "es", " ", "thread", "lock", "s", " ", "reall", "y", " ", "easi", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "servers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callbacks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "serv", "no_", "in_", "range_", "(_", "0_", ",_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "Auto", "DH", "TS", "erver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "servers_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "=_", "Cal", "vin", "CB_", "(_", "server", "\\u", "started_", ",_", "str_", "(_", "serv", "no_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "servers_", "[_", "serv", "no_", "]_", "._", "start_", "(_", "iface_", ",_", "network_", "=_", "\"", "Ni", "kla", "s", "\"_", ",_", "cb_", "=_", "callback_", ",_", "name_", "=_", "name_", "+_", "\"{}\"_", "._", "format_", "(_", "serv", "no_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callbacks_", "._", "append_", "(_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "for", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "started_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "started_", ")_", "<_", "amo", "unt", "\\u", "of", "\\u", "servers_", ":_", "\\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 ", " ", "_", "server_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "q_", "._", "get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "log_", "._", "debug_", "(_", "\"", "Queue", " ", "empty", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "server_", "not_", "in_", "started_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "started_", "._", "append_", "(_", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(\"", "DH", "T", " ", "Server", "s", " ", "adde", "d", ":", " ", "{}", "\".", "format", "(", "start", "ed", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "callbacks_", "[_", "int_", "(_", "server_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "]_", "._", "func_", "=_", "lambda_", "*_", "args_", ",_", "**_", "kv", "args_", ":_", "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 ", " ", "_", "print_", "(_", "\"", "Server", ":", " ", "{}", " ", "alr", "ead", "y", " ", "start", "ed", ".\"_", "\"", " ", "{}", " ", "out", " ", "of", " ", "{}\"_", "._", "format_", "(_", "started_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "started_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "All", " ", "{}", " ", "out", " ", "of", " ", "{}", " ", "start", "ed", "\"_", "._", "format_", "(_", "started_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "started_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "serv", "no_", "in_", "range_", "(_", "0_", ",_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "[_", "str_", "(_", "serv", "no_", ")_", ",_", "self_", "._", "\\u", "suce", "ss", "\\u", "start_", "]_", "in_", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "q_", "._", "queue_", "._", "clear_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "time_", "._", "sleep_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "\"", "HAR", "E", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "json_", "._", "dumps_", "(_", "[_", "\"", "mor", "ot", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "def_", "=_", "servers_", "[_", "0_", "]_", "._", "append_", "(_", "key_", "=_", "key_", ",_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "value_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "set\\u", "def_", "._", "wait_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "poste", "d", " ", "append", " ", "key", "={}", ",", " ", "value", "={}\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "key_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "json_", "._", "dumps_", "(_", "[_", "\"", "seller", "i", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "def_", "=_", "servers_", "[_", "0_", "]_", "._", "append_", "(_", "key_", "=_", "key_", ",_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "value_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "set\\u", "def_", "._", "wait_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "poste", "d", " ", "append", " ", "key", "={}", ",", " ", "value", "={}\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "key_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "def_", "=_", "servers_", "[_", "0_", "]_", "._", "get", "\\u", "concat_", "(_", "key_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "value_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "get", "\\u", "def_", "._", "wait_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "json_", "._", "loads_", "(_", "get", "\\u", "value_", ")_", ")_", "==_", "set_", "(_", "[_", "\"", "mor", "ot", "\"_", ",_", "\"", "seller", "i", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "confirm", "ed", " ", "key", "={}", ",", " ", "value", "={}", " ", "was", " ", "reachable", "\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "key_", ",_", "get", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "draw", "Network", "State_", "(_", "\"", "1", "nice\\u", "graph", ".", "png", "\"_", ",_", "servers_", ",_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "time_", "._", "sleep_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "draw", "Network", "State_", "(_", "\"", "1", "middle", "\\u", "graph", ".", "png", "\"_", ",_", "servers_", ",_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "time_", "._", "sleep_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "draw", "Network", "State_", "(_", "\"", "1e", "nd", "\\u", "graph", ".", "png", "\"_", ",_", "servers_", ",_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "def_", "=_", "servers_", "[_", "0_", "]_", "._", "get", "\\u", "concat_", "(_", "key_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "value_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "get", "\\u", "def_", "._", "wait_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "json_", "._", "loads_", "(_", "get", "\\u", "value_", ")_", ")_", "==_", "set_", "(_", "[_", "\"", "mor", "ot", "\"_", ",_", "\"", "seller", "i", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "got", " ", "right", " ", "value", ":", " ", "{}\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "get", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "json_", "._", "dumps_", "(_", "[_", "\"", "mor", "ot", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "def_", "=_", "servers_", "[_", "0_", "]_", "._", "remove_", "(_", "key_", "=_", "key_", ",_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "value_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "set\\u", "def_", "._", "wait_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "poste", "d", " ", "remove", " ", "key", "={}", ",", " ", "value", "={}\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "key_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "def_", "=_", "servers_", "[_", "1_", "]_", "._", "get", "\\u", "concat_", "(_", "key_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "value_", "=_", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "get", "\\u", "def_", "._", "wait_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "json_", "._", "loads_", "(_", "get", "\\u", "value_", ")_", ")_", "==_", "set_", "(_", "[_", "\"", "seller", "i", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "got", " ", "right", " ", "value", ":", " ", "{}\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "get", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "amo", "unt", "\\u", "of", "\\u", "servers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "cert", "\\u", "conf_", "[_", "\"", "CA", "\\u", "default", "\"_", "]_", "[_", "\"", "runt", "imes", "\\u", "dir", "\"_", "]_", ",_", "\"{}", "{}\"_", "._", "format_", "(_", "name_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filenames_", "=_", "os_", "._", "listdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "name", "\\u", "dir_", ",_", "\"", "other", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "has", " ", "{}", " ", "certificates", " ", "in", " ", "store", "\"_", "._", "format_", "(_", "servers_", "[_", "i_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "len_", "(_", "filenames_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Node", " ", "with", " ", "port", " ", "{}", " ", "got", " ", "wrong", " ", "value", ":", " ", "{}", ",", " ", "shou", "ld", " ", "have", " ", "bee", "n", " ", "{}\"_", "._", "format_", "(_", "servers_", "[_", "0_", "]_", "._", "dht", "\\u", "server_", "._", "port_", "._", "get", "Host_", "(_", ")_", "._", "port_", ",_", "get", "\\u", "value_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pytest_", "._", "fail_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pytest_", "._", "fail_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\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 ", " _", "yield_", "threads_", "._", "defer", "\\u", "to", "\\u", "thread_", "(_", "time_", "._", "sleep_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "server_", "in_", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "cert", "\\u", "conf_", "[_", "\"", "CA", "\\u", "default", "\"_", "]_", "[_", "\"", "runt", "imes", "\\u", "dir", "\"_", "]_", ",_", "name_", "+_", "\"{}\"_", "._", "format_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "os_", "._", "path_", "._", "join_", "(_", "name", "\\u", "dir_", ",_", "\"", "other", "s", "\"_", ")_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "name", "\\u", "dir_", ",_", "\"", "other", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "stop_", "(_", ")_" ]
[ 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
JeremyOT/Toto/tests/test_tasks.py
[ { "content": "import unittest\n\nfrom uuid import uuid4\nfrom time import time, sleep\nfrom toto.tasks import TaskQueue, AwaitableInstance, InstancePool\nfrom tornado.ioloop import IOLoop\nfrom tornado.gen import coroutine\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class _Instance(object):\n\n\n", "metadata": "root._Instance", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self):\n self.counter = 0", "metadata": "root._Instance.__init__", "header": "['class', '_Instance', '(', 'object', ')', ':', '___EOS___']", "index": 10 }, { "content": " def increment(self):\n self.counter += 1\n return self.counter", "metadata": "root._Instance.increment", "header": "['class', '_Instance', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def value(self):\n return self.counter", "metadata": "root._Instance.value", "header": "['class', '_Instance', '(', 'object', ')', ':', '___EOS___']", "index": 17 }, { "content": "class TestTasks(unittest.TestCase):\n\n \n\n \n\n", "metadata": "root.TestTasks", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def test_add_task(self):\n queue = TaskQueue()\n self.assertEquals(len(queue), 0)\n task_results = []\n task = lambda x: task_results.append(x)\n queue.add_task(task, 1)\n queue.add_task(task, 2)\n queue.add_task(task, 3)\n start = time()\n while 1:\n if len(task_results) == 3:\n break\n if time() - start > 5:\n break\n sleep(0.01)\n self.assertEquals(len(task_results), 3)\n self.assertEquals(task_results, [1, 2, 3])", "metadata": "root.TestTasks.test_add_task", "header": "['class', 'TestTasks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_yield_task(self):\n queue = TaskQueue()\n task_results = []\n @coroutine\n def yield_tasks():\n task = lambda x: x\n futures = []\n futures.append(queue.yield_task(task, 1))\n futures.append(queue.yield_task(task, 2))\n futures.append(queue.yield_task(task, 3))\n res = yield futures\n task_results[:] = res\n loop = IOLoop()\n loop.make_current()\n loop.run_sync(yield_tasks)\n self.assertEquals(len(task_results), 3)\n self.assertEquals(task_results, [1, 2, 3])", "metadata": "root.TestTasks.test_yield_task", "header": "['class', 'TestTasks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_add_task_exception(self):\n queue = TaskQueue()\n self.assertEquals(len(queue), 0)\n task_results = []\n def task(x):\n task_results.append(x)\n raise Exception('failure')\n queue.add_task(task, 1)\n queue.add_task(task, 2)\n queue.add_task(task, 3)\n start = time()\n while 1:\n if len(task_results) == 3:\n break\n if time() - start > 5:\n break\n sleep(0.01)\n self.assertEquals(len(task_results), 3)\n self.assertEquals(task_results, [1, 2, 3])", "metadata": "root.TestTasks.test_add_task_exception", "header": "['class', 'TestTasks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_yield_task_exception(self):\n queue = TaskQueue()\n task_results = []\n @coroutine\n def yield_tasks():\n def task(x):\n raise Exception('failure')\n futures = []\n futures.append(queue.yield_task(task, 1))\n futures.append(queue.yield_task(task, 2))\n futures.append(queue.yield_task(task, 3))\n for f in futures:\n try:\n yield f\n except Exception as e:\n task_results.append(e)\n loop = IOLoop()\n loop.make_current()\n loop.run_sync(yield_tasks)\n self.assertEquals(len(task_results), 3)\n for e in task_results:\n self.assertEquals(e.message, 'failure')", "metadata": "root.TestTasks.test_yield_task_exception", "header": "['class', 'TestTasks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def test_awaitable(self):\n instance = _Instance()\n instance.increment()\n self.assertEquals(instance.value(), 1)\n awaitable = AwaitableInstance(instance)\n @coroutine\n def yield_tasks():\n self.assertEquals((yield awaitable.increment()), 2)\n self.assertEquals((yield awaitable.increment()), 3)\n self.assertEquals((yield awaitable.increment()), 4)\n self.assertEquals((yield awaitable.value()), 4) \n loop = IOLoop()\n loop.make_current()\n loop.run_sync(yield_tasks)\n self.assertEquals(instance.value(), 4)", "metadata": "root.TestTasks.test_awaitable", "header": "['class', 'TestTasks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " def test_instance_pool(self):\n instance1 = _Instance()\n instance2 = _Instance()\n pool = InstancePool([instance1, instance2])\n pool.increment()\n pool.increment()\n self.assertEquals(instance1.value(), 1)\n self.assertEquals(instance2.value(), 1)\n pool.transaction(lambda i: i.increment())\n pool.transaction(lambda i: i.increment())\n self.assertEquals(instance1.value(), 2)\n self.assertEquals(instance2.value(), 2)\n @coroutine\n def yield_tasks():\n self.assertEquals((yield pool.await().increment()), 3)\n self.assertEquals((yield pool.await().increment()), 3)\n self.assertEquals(instance1.value(), 3)\n self.assertEquals(instance2.value(), 3)\n self.assertEquals((yield pool.await_transaction(lambda i: i.increment())), 4)\n self.assertEquals((yield pool.await_transaction(lambda i: i.increment())), 4)\n loop = IOLoop()\n loop.make_current()\n loop.run_sync(yield_tasks)\n self.assertEquals(instance1.value(), 4)\n self.assertEquals(instance2.value(), 4)", "metadata": "root.TestTasks.test_instance_pool", "header": "['class', 'TestTasks', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 117 } ]
[ { "span": "from uuid import uuid4", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "uuid_", "import_", "uuid4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", ",_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tot", "o_", "._", "tasks_", "import_", "Task", "Queue_", ",_", "Await", "able", "Instance_", ",_", "Insta", "nce", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "ioloop_", "import_", "IO", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "gen_", "import_", "coroutine_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Instance_", "(_", "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_", "[SEP]_", "class_", "\\u", "Instance_", "(_", "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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Instance_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "increment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Instance_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "counter_", "\\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", "Tasks_", "(_", "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_", "[SEP]_", "class_", "Test", "Tasks_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "add", "\\u", "task_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue_", "=_", "Task", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "queue_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "lambda_", "x_", ":_", "task", "\\u", "results_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "._", "add", "\\u", "task_", "(_", "task_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "._", "add", "\\u", "task_", "(_", "task_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "._", "add", "\\u", "task_", "(_", "task_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "task", "\\u", "results_", ")_", "==_", "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_", "if_", "time_", "(_", ")_", "-_", "start_", ">_", "5_", ":_", "\\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_", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "task", "\\u", "results_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "task", "\\u", "results_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tasks_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "yield", "\\u", "task_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue_", "=_", "Task", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "yield", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "lambda_", "x_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "._", "append_", "(_", "queue_", "._", "yield", "\\u", "task_", "(_", "task_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "._", "append_", "(_", "queue_", "._", "yield", "\\u", "task_", "(_", "task_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "._", "append_", "(_", "queue_", "._", "yield", "\\u", "task_", "(_", "task_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "futures_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "results_", "[_", ":_", "]_", "=_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "=_", "IO", "Loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "make", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "run", "\\u", "sync_", "(_", "yield", "\\u", "tasks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "task", "\\u", "results_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "task", "\\u", "results_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tasks_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "task", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue_", "=_", "Task", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "queue_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "task_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "results_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "fail", "ure", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "queue_", "._", "add", "\\u", "task_", "(_", "task_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "._", "add", "\\u", "task_", "(_", "task_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "._", "add", "\\u", "task_", "(_", "task_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "task", "\\u", "results_", ")_", "==_", "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_", "if_", "time_", "(_", ")_", "-_", "start_", ">_", "5_", ":_", "\\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_", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "task", "\\u", "results_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "task", "\\u", "results_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tasks_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "yield", "\\u", "task", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue_", "=_", "Task", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "yield", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "task_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "fail", "ure", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "futures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "._", "append_", "(_", "queue_", "._", "yield", "\\u", "task_", "(_", "task_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "._", "append_", "(_", "queue_", "._", "yield", "\\u", "task_", "(_", "task_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "futures_", "._", "append_", "(_", "queue_", "._", "yield", "\\u", "task_", "(_", "task_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "futures_", ":_", "\\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 ", " _", "yield_", "f_", "\\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 ", " _", "task", "\\u", "results_", "._", "append_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "=_", "IO", "Loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "make", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "run", "\\u", "sync_", "(_", "yield", "\\u", "tasks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "task", "\\u", "results_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "task", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "e_", "._", "message_", ",_", "'", "fail", "ure", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tasks_", "(_", "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_", "def_", "test\\u", "await", "able_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "=_", "\\u", "Instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance_", "._", "value_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "await", "able_", "=_", "Await", "able", "Instance_", "(_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "yield", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "await", "able_", "._", "increment_", "(_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "await", "able_", "._", "increment_", "(_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "await", "able_", "._", "increment_", "(_", ")_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "await", "able_", "._", "value_", "(_", ")_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "=_", "IO", "Loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "make", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "run", "\\u", "sync_", "(_", "yield", "\\u", "tasks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance_", "._", "value_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tasks_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "instance", "\\u", "pool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "1_", "=_", "\\u", "Instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "2_", "=_", "\\u", "Instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "=_", "Insta", "nce", "Pool_", "(_", "[_", "instance", "1_", ",_", "instance", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "increment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "1_", "._", "value_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "2_", "._", "value_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "transaction_", "(_", "lambda_", "i_", ":_", "i_", "._", "increment_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "transaction_", "(_", "lambda_", "i_", ":_", "i_", "._", "increment_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "1_", "._", "value_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "2_", "._", "value_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "yield", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "pool_", "._", "await_", "(_", ")_", "._", "increment_", "(_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "pool_", "._", "await_", "(_", ")_", "._", "increment_", "(_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "1_", "._", "value_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "2_", "._", "value_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "pool_", "._", "await", "\\u", "transaction_", "(_", "lambda_", "i_", ":_", "i_", "._", "increment_", "(_", ")_", ")_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "(_", "yield_", "pool_", "._", "await", "\\u", "transaction_", "(_", "lambda_", "i_", ":_", "i_", "._", "increment_", "(_", ")_", ")_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "=_", "IO", "Loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "make", "\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop_", "._", "run", "\\u", "sync_", "(_", "yield", "\\u", "tasks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "1_", "._", "value_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "instance", "2_", "._", "value_", "(_", ")_", ",_", "4_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 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, 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, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
sassoftware/conary/conary/conaryclient/update.py
[ { "content": " def _mergeGroupChanges(self, uJob, primaryJobList, transitiveClosure,\n redirectHack, recurse, ineligible, checkPrimaryPins,\n installedPrimaries, installMissingRefs=False,\n updateOnly=False, respectBranchAffinity=True,\n alwaysFollowLocalChanges=False,\n removeNotByDefault = False):\n\n def lookupPathHashes(infoList, old = False):\n result = []\n if old:\n for s in self.db.getPathHashesForTroveList(infoList):\n if s is None:\n result.append(set())\n else:\n result.append(s)\n\n return result\n else:\n troveSource = uJob.getTroveSource()\n # we can't assume that the troveSource has all\n # of the child troves for packages we can see.\n # Specifically, the troveSource could have come from\n # a relative changeset that only contains byDefault True\n # components - here we're looking at both byDefault\n # True and False components (in trove.diff)\n hasTroveList = troveSource.hasTroves(infoList)\n for info, hasTrove in itertools.izip(infoList, hasTroveList):\n if hasTrove:\n ph = troveSource.getTrove(withFiles = False, *info).\\\n getPathHashes()\n result.append(ph)\n else:\n result.append(set())\n return result\n\n def _findErasures(primaryErases, newJob, referencedTroves, recurse,\n ineligible):\n # this batches a bunch of hasTrove/trovesArePinned calls. It\n # doesn't get the ones we find implicitly, unfortunately\n class ErasureInfoCache:\n\n def __init__(self, db):\n self.db = db\n self.hasTrovesCache = {}\n self.pinnedCache = {}\n self.referencesCache = {}\n\n def hasTrove(self, info):\n return self.hasTrovesCache.get(info, None)\n\n def isPinned(self, info):\n return self.pinnedCache[info]\n\n def getReferences(self, info):\n return self.referencesCache[info]\n\n def populate(self, jobList):\n erasures = [ (job[0], job[1][0], job[1][1]) for job\n in jobList if job[1][0] is not None ]\n hasTroveList = self.db.hasTroves(erasures)\n self.hasTrovesCache.update(\n itertools.izip(erasures, hasTroveList))\n present = [ x[0] for x in\n itertools.izip(erasures, hasTroveList)\n if x[1] ]\n pinnedList = self.db.trovesArePinned(present)\n self.pinnedCache.update(\n itertools.izip(present, pinnedList))\n\n referenceList = self.db.getTroveTroves(\n present, weakRefs = False,\n pristineOnly = False)\n self.referencesCache.update(\n itertools.izip(present, referenceList))\n\n # each node is a ((name, version, flavor), state, edgeList\n # fromUpdate)\n # state is ERASE, KEEP, or UNKNOWN\n #\n # fromUpdate is True if erasing this node reflects a trove being\n # replaced by a different one in the Job (an update, not an erase)\n # We need to track this to know what's being removed, but we don't\n # need to cause them to be removed.\n nodeList = []\n nodeIdx = {}\n ERASE = 1\n KEEP = 2\n UNKNOWN = 3\n\n infoCache = ErasureInfoCache(self.db)\n infoCache.populate(newJob)\n infoCache.populate(primaryErases)\n\n jobQueue = util.IterableQueue()\n # The order of this chain matters. It's important that we handle\n # all of the erasures we already know about before getting to the\n # ones which are implicit. That gets the state right for ones\n # which are explicit (since arriving there implicitly gets\n # ignored). Handling updates from newJob first prevents duplicates\n # from primaryErases\n for job, isPrimary in itertools.chain(\n itertools.izip(newJob, itertools.repeat(False)),\n itertools.izip(primaryErases, itertools.repeat(True)),\n jobQueue):\n oldInfo = (job[0], job[1][0], job[1][1])\n\n if oldInfo[1] is None:\n # skip new installs\n continue\n\n if oldInfo in nodeIdx:\n # See the note above about chain order (this wouldn't\n # work w/o it)\n continue\n\n present = infoCache.hasTrove(oldInfo)\n if present is None:\n infoCache.populate(\n [ job ] + [ x[0] for x in jobQueue.peekRemainder() ] )\n present = infoCache.hasTrove(oldInfo)\n\n if not present:\n # no need to erase something we don't have installed\n continue\n\n # erasures which are part of an\n # update are guaranteed to occur\n if job in newJob:\n assert(job[2][0])\n state = ERASE\n fromUpdate = True\n else:\n # If it's pinned, we keep it.\n if infoCache.isPinned(oldInfo):\n state = KEEP\n if isPrimary and checkPrimaryPins:\n raise UpdatePinnedTroveError(oldInfo)\n elif isPrimary:\n # primary updates are guaranteed to occur (if the\n # trove is not pinned).\n state = ERASE\n else:\n state = UNKNOWN\n\n fromUpdate = False\n\n assert(oldInfo not in nodeIdx)\n nodeIdx[oldInfo] = len(nodeList)\n nodeList.append([ oldInfo, state, [], fromUpdate ])\n\n if not recurse: continue\n\n if not trove.troveIsCollection(oldInfo[0]): continue\n for inclInfo in infoCache.getReferences(oldInfo):\n # we only use strong references when erasing.\n if inclInfo in ineligible:\n continue\n\n jobQueue.add(((inclInfo[0], inclInfo[1:], (None, None),\n False), False))\n\n # For nodes which we haven't decided to erase, we need to track\n # down all of the collections which include those troves.\n needParents = [ (nodeId, info) for nodeId, (info, state, edges,\n alreadyHandled)\n in enumerate(nodeList) if state == UNKNOWN ]\n while needParents:\n containers = self.db.getTroveContainers(\n x[1] for x in needParents)\n newNeedParents = []\n for (nodeId, nodeInfo), containerList in \\\n itertools.izip(needParents, containers):\n for containerInfo in containerList:\n if containerInfo in nodeIdx:\n containerId = nodeIdx[containerInfo]\n nodeList[containerId][2].append(nodeId)\n else:\n containerId = len(nodeList)\n nodeIdx[containerInfo] = containerId\n nodeList.append([ containerInfo, KEEP, [ nodeId ],\n False])\n newNeedParents.append((containerId, containerInfo))\n needParents = newNeedParents\n\n # don't erase nodes which are referenced by troves we're about\n # to install - the only troves we list here are primary installs,\n # and they should never be erased.\n for info in referencedTroves:\n if info in nodeIdx:\n node = nodeList[nodeIdx[info]]\n node[1] = KEEP\n\n seen = [ False ] * len(nodeList)\n # DFS to mark troves as KEEP\n keepNodes = [ nodeId for nodeId, node in enumerate(nodeList)\n if node[1] == KEEP ]\n while keepNodes:\n nodeId = keepNodes.pop()\n if seen[nodeId]: continue\n seen[nodeId] = True\n nodeList[nodeId][1] = KEEP\n keepNodes += nodeList[nodeId][2]\n\n # anything which isn't to KEEP is to erase, but skip those which\n # are already being removed by a trvCs\n eraseList = ((x[0][0], (x[0][1], x[0][2]), (None, None), False)\n for x in nodeList if x[1] != KEEP and not x[3])\n\n return set(eraseList)\n\n def _troveTransitiveClosure(db, itemList):\n itemQueue = util.IterableQueue()\n fullSet = set()\n for item in itertools.chain(itemList, itemQueue):\n if item in fullSet: continue\n fullSet.add(item)\n\n if not trove.troveIsCollection(item[0]): continue\n trv = db.getTrove(withFiles = False, pristine = False, *item)\n\n for x in trv.iterTroveList(strongRefs=True, weakRefs=True):\n itemQueue.add(x)\n\n return fullSet\n\n def _filterDoubleRemovesDueToLocalUpdates(newJob, replacedJobs):\n # it's possible that a locally removed half of a local update\n # trove will match up to something that is due to be installed\n # despite the fact that its match has been removed by the user.\n # We don't want to disallow that type of match - it is useful\n # information and may be corrrect. However, we don't want to\n # have a double removal, which is what will happen in some cases\n # - conary will switch the erased version mentioned in the local\n # update to the installed version, which could be a part of\n # another update. In such cases, we remove the \"erase\" part\n # of the local update.\n eraseCount = {}\n for job in newJob:\n oldInfo = job[0], job[1][0], job[1][1]\n if oldInfo in replacedJobs:\n if oldInfo in eraseCount:\n eraseCount[oldInfo] += 1\n else:\n eraseCount[oldInfo] = 1\n\n doubleErased = [ x[0] for x in eraseCount.iteritems() if x[1] > 1 ]\n for oldInfo in doubleErased:\n newJob.remove((oldInfo[0], (oldInfo[1], oldInfo[2]),\n replacedJobs[oldInfo], False))\n newJob.add((oldInfo[0], (None, None),\n replacedJobs[oldInfo], False))\n\n\n\n # def _mergeGroupChanges -- main body begins here\n erasePrimaries = set(x for x in primaryJobList\n if x[2][0] is None)\n relativePrimaries = set(x for x in primaryJobList\n if x[2][0] is not None and\n not x[3])\n absolutePrimaries = set(x for x in primaryJobList\n if x[3])\n assert(len(relativePrimaries) + len(absolutePrimaries) +\n len(erasePrimaries) == len(primaryJobList))\n\n log.lowlevel('_mergeGroupChanges(recurse=%s,'\n ' checkPrimaryPins=%s,'\n ' installMissingRefs=%s, '\n ' updateOnly=%s, '\n ' respectBranchAffinity=%s,'\n ' alwaysFollowLocalChanges=%s)',\n recurse, checkPrimaryPins, installMissingRefs,\n updateOnly, respectBranchAffinity,\n alwaysFollowLocalChanges)\n\n troveSource = uJob.getTroveSource()\n\n\n # ineligible needs to be a transitive closure when recurse is set\n if recurse:\n ineligible = _troveTransitiveClosure(self.db, ineligible)\n\n for job in erasePrimaries:\n # an erase primary can't be part of an update (but their children\n # can, so add this after we've recursed)\n ineligible.add((job[0], job[1][0], job[1][1]))\n\n # Build the trove which contains all of the absolute change sets\n # we may need to install. Build a set of all of the trove names\n # in that trove as well.\n availableTrove = trove.Trove(\"@update\", versions.NewVersion(),\n deps.Flavor(), None)\n\n names = set()\n for job in transitiveClosure:\n if job[2][0] is None: continue\n if not job[3]: continue\n if (job[0], job[2][0], job[2][1]) in ineligible: continue\n\n availableTrove.addTrove(job[0], job[2][0], job[2][1],\n presentOkay = True)\n names.add(job[0])\n\n avail = set(availableTrove.iterTroveList(strongRefs=True))\n\n # Build the set of all relative install jobs (transitive closure)\n relativeUpdateJobs = set(job for job in transitiveClosure if\n job[2][0] is not None and not job[3])\n\n # Look for relative updates whose sources are not currently installed\n relativeUpdates = [ ((x[0], x[1][0], x[1][1]), x)\n for x in relativeUpdateJobs if x[1][0] is not None]\n isPresentList = self.db.hasTroves([ x[0] for x in relativeUpdates ])\n\n for (info, job), isPresent in itertools.izip(relativeUpdates,\n isPresentList):\n if not isPresent:\n relativeUpdateJobs.remove(job)\n newTrove = job[0], job[2][0], job[2][1]\n\n if newTrove not in avail:\n ineligible.add(newTrove)\n\n # skip relative installs that are already present.\n relativeInstalls = [ ((x[0], x[2][0], x[2][1]), x)\n for x in relativeUpdateJobs if x[2][0] is not None]\n isPresentList = self.db.hasTroves([ x[0] for x in relativeInstalls ])\n for (newTrove, job), isPresent in itertools.izip(relativeInstalls,\n isPresentList):\n if isPresent:\n relativeUpdateJobs.remove(job)\n ineligible.add(newTrove)\n if job[1][0]:\n # this used to be a relative upgrade, but the target\n # is installed, so turn it into an erase.\n erasePrimaries.add((job[0], (job[1][0], job[1][1]),\n (None, None), False))\n\n # Get all of the currently installed and referenced troves which\n # match something being installed absolute. Troves being removed\n # through a relative changeset aren't allowed to be removed by\n # something else.\n (installedNotReferenced,\n installedAndReferenced,\n referencedStrong,\n referencedWeak) = self.db.db.getCompleteTroveSet(names)\n\n installedTroves = installedNotReferenced | installedAndReferenced\n referencedNotInstalled = referencedStrong | referencedWeak\n log.lowlevel('referencedNotInstalled: %s', referencedNotInstalled)\n log.lowlevel('ineligible: %s', ineligible)\n\n installedTroves.difference_update(ineligible)\n installedTroves.difference_update(\n (job[0], job[1][0], job[1][1]) for job in relativeUpdateJobs)\n referencedNotInstalled.difference_update(ineligible)\n referencedNotInstalled.difference_update(\n (job[0], job[1][0], job[1][1]) for job in relativeUpdateJobs)\n\n\n # The job between referencedTroves and installedTroves tells us\n # a lot about what the user has done to his system.\n primaryLocalUpdates = self.getPrimaryLocalUpdates(names)\n localUpdates = list(primaryLocalUpdates)\n if localUpdates:\n localUpdates += self.getChildLocalUpdates(uJob.getSearchSource(),\n localUpdates,\n installedTroves,\n referencedNotInstalled)\n # make some assertions about the local updates:\n # 1. a missing trove can only be a part of one local update\n # 2. a present trove can only be a part of one local update\n\n # although we needed parent updates to get the correct set of\n # local updates related to this job, we don't care local updates\n # that aren't related to troves in our job.\n localUpdates = [ x for x in localUpdates if x[0] in names ]\n\n localUpdatesByPresent = \\\n dict( ((job[0], job[2][0], job[2][1]), job[1]) for\n job in localUpdates if job[1][0] is not None and\n job[2][0] is not None)\n localUpdatesByMissing = \\\n dict( ((job[0], job[1][0], job[1][1]), job[2]) for\n job in localUpdates if job[1][0] is not None and\n job[2][0] is not None)\n primaryLocalUpdates = set((job[0], job[2][0], job[2][1])\n for job in primaryLocalUpdates)\n localErases = set((job[0], job[1][0], job[1][1])\n for job in localUpdates if job[2][0] is None)\n # Troves which were locally updated to version on the same branch\n # no longer need to be listed as referenced. The trove which replaced\n # it is always a better match for the new items (installed is better\n # than not installed as long as the branches are the same). This\n # doesn't apply if the trove which was originally installed is\n # part of this update though, as troves which are referenced and\n # part of the update are handled separately.\n\n # keep track of troves that are changes on the same branch,\n # since those are still explicit user requests and might\n # override implied updates that would downgrade this trove.\n sameBranchLocalUpdates = {}\n\n for job in sorted(localUpdates):\n if job[1][0] is not None and job[2][0] is not None:\n if (job[1][0].branch() == job[2][0].branch() and\n (job[0], job[1][0], job[1][1]) not in avail):\n del localUpdatesByPresent[(job[0], job[2][0], job[2][1])]\n del localUpdatesByMissing[(job[0], job[1][0], job[1][1])]\n referencedNotInstalled.remove((job[0], job[1][0], job[1][1]))\n log.lowlevel('reworking same-branch local update: %s', job)\n # track this update for since it means the user\n # requested this version explicitly\n sameBranchLocalUpdates[job[0], job[2][0], job[2][1]] = (job[1][0], job[1][1])\n else:\n log.lowlevel('local update: %s', job)\n\n del localUpdates\n\n # Build the set of the incoming troves which are either already\n # installed or already referenced.\n alreadyInstalled = (installedTroves & avail) | installedPrimaries\n alreadyReferenced = referencedNotInstalled & avail\n\n del avail\n\n\n existsTrv = trove.Trove(\"@update\", versions.NewVersion(),\n deps.Flavor(), None)\n [ existsTrv.addTrove(*x) for x in installedTroves ]\n [ existsTrv.addTrove(*x) for x in referencedNotInstalled ]\n\n jobList = availableTrove.diff(existsTrv,\n getPathHashes=lookupPathHashes)[2]\n\n # alreadyReferenced troves are in both the update set\n # and the installed set. They are a good match for themselves.\n jobList += [(x[0], (x[1], x[2]), (x[1], x[2]), 0) for x in alreadyReferenced ]\n\n installJobs = [ x for x in jobList if x[1][0] is None and\n x[2][0] is not None ]\n updateJobs = [ x for x in jobList if x[1][0] is not None and\n x[2][0] is not None ]\n pins = self.db.trovesArePinned([ (x[0], x[1][0], x[1][1])\n for x in updateJobs ])\n jobByNew = dict( ((job[0], job[2][0], job[2][1]), (job[1], pin)) for\n (job, pin) in itertools.izip(updateJobs, pins) )\n jobByNew.update(\n dict( ((job[0], job[2][0], job[2][1]), (job[1], False)) for\n job in installJobs))\n\n del jobList, installJobs, updateJobs\n\n # Relative jobs override pins and need to match up against the\n # right thing.\n jobByNew.update(\n dict( ((job[0], job[2][0], job[2][1]), (job[1], False)) for\n job in relativeUpdateJobs))\n\n respectFlavorAffinity = True\n # the newTroves parameters are described below.\n newTroves = sorted((((x[0], x[2][0], x[2][1]),\n True, {}, False, False, False, False, None,\n respectBranchAffinity,\n respectFlavorAffinity, True,\n True, updateOnly)\n for x in itertools.chain(absolutePrimaries,\n relativePrimaries)),\n # compare on the string of the version, since it might\n # not have timestamps\n key=lambda y: (y[0][0], str(y[0][1]), y[0][2]) + y[1:])\n\n newJob = set()\n notByDefaultRemovals = set()\n\n # ensure the user-specified respect branch affinity setting is not\n # lost.\n neverRespectBranchAffinity = not respectBranchAffinity\n replacedJobs = {}\n\n while newTroves:\n # newTroves tuple values\n # newInfo: the (n, v, f) of the trove to install\n # isPrimary: true if user specified this trove on the command line\n # byDefaultDict: mapping of trove tuple to byDefault setting, as\n # specified by the primary parent trove\n # parentInstalled: True if the parent of this trove was installed.\n # Used to determine whether to install troves\n # with weak references.\n # parentReplacedWasPinned: True if this trove's parent would\n # have replaced a trove that is pinned.\n # parentUpdated: True if the parent of this trove was installed.\n # or updated.\n # primaryInstalled: True if the primary that led to this update\n # was an install.\n # branchHint: if newInfo's parent trove switched branches, this\n # provides the to/from information on that switch.\n # If this child trove is making the same switch, we\n # allow it even if the switch is overriding branch\n # affinity.\n # respectBranchAffinity: If true, we generally try to respect\n # the user's choice to switch a trove from one branch\n # to another. We might not respect branch affinity\n # if a) a primary trove update is overriding branch\n # affinity, or b) the call to mergeGroupChanges\n # had respectBranchAffinity False\n # respectFlavorAffinity: If true, we generally try to respect\n # the user's choice to switch a trove from one flavor\n # to another. We might not respect flavor affinity\n # for the same reasons we might not respect branch\n # affinity.\n # installRedirects: If True, we install redirects even when they\n # are not upgrades.\n # followLocalChanges: see the code where it is used for a\n # description.\n # updateOnly: If true, only update troves, don't install them\n # fresh.\n (newInfo, isPrimary, byDefaultDict, parentInstalled,\n parentReplacedWasPinned, parentUpdated, primaryInstalled,\n branchHint, respectBranchAffinity, respectFlavorAffinity,\n installRedirects, followLocalChanges,\n updateOnly) = newTroves.pop(0)\n\n byDefault = isPrimary or byDefaultDict[newInfo]\n\n log.lowlevel('''\\\n*******\n%s=%s[%s]\nprimary: %s byDefault:%s parentUpdated: %s parentInstalled: %s primaryInstalled: %s updateOnly: %s\nbranchHint: %s\nbranchAffinity: %s flavorAffinity: %s installRedirects: %s\nfollowLocalChanges: %s\n\n''',\n newInfo[0], newInfo[1], newInfo[2], isPrimary,\n byDefault, parentUpdated, parentInstalled,\n primaryInstalled, updateOnly, branchHint,\n respectBranchAffinity, respectFlavorAffinity,\n installRedirects, followLocalChanges)\n trv = None\n jobAdded = False\n replaced = (None, None)\n recurseThis = True\n childrenFollowLocalChanges = alwaysFollowLocalChanges\n pinned = False\n while True:\n # this loop should only be called once - it's basically a\n # way to create a quick GOTO structure, without needing\n # to call another function (which would be expensive in\n # this loop).\n if newInfo in alreadyInstalled:\n # No need to install it twice\n # but count it as 'added' for the purposes of\n # whether or not to recurse\n jobAdded = True\n job = (newInfo[0], (newInfo[1], newInfo[2]),\n (newInfo[1], newInfo[2]), False)\n log.lowlevel('SKIP: already installed')\n break\n elif newInfo in ineligible:\n log.lowlevel('SKIP: ineligible')\n break\n elif newInfo in alreadyReferenced:\n log.lowlevel('new trove in alreadyReferenced')\n # meaning: this trove is referenced by something\n # installed, but is not installed itself.\n\n if isPrimary or installMissingRefs or primaryInstalled:\n # They really want it installed this time. We removed\n # this entry from the already-installed @update trove\n # so localUpdates already tells us the best match for it.\n pass\n elif parentUpdated and newInfo in referencedWeak:\n # The only link to this trove is a weak reference.\n # A weak-only reference means an intermediate trove\n # was missing. But parentUpdated says we've now\n # updated an intermediate trove, so install\n # this trove too.\n pass\n else:\n # We already know about this trove, and decided we\n # don't want it. We do want to keep the item which\n # replaced it though.\n if newInfo in localUpdatesByMissing:\n info = ((newInfo[0],)\n + localUpdatesByMissing[newInfo])\n alreadyInstalled.add(info)\n log.lowlevel('local update - marking present part %s'\n 'as already installed', info)\n log.lowlevel('SKIP: already referenced')\n break\n\n replaced, pinned = jobByNew[newInfo]\n replacedInfo = (newInfo[0], replaced[0], replaced[1])\n\n log.lowlevel('replaces: %s', replacedInfo)\n\n if replaced[0] is not None:\n if newInfo in alreadyReferenced:\n # This section is the corrolary to the section\n # above. We only enter here if we've decided\n # to install this trove even though its\n # already referenced.\n if replacedInfo in referencedNotInstalled:\n # don't allow this trove to not be installed\n # because the trove its replacing is not installed.\n # Find an installed update or just install the trove\n # fresh.\n replaced = localUpdatesByMissing.get(replacedInfo,\n (None, None))\n replacedInfo = (replacedInfo[0], replaced[0],\n replaced[1])\n log.lowlevel('replaced is not installed, using local update %s instead', replacedInfo)\n if replaced[0]:\n log.lowlevel('following local changes')\n childrenFollowLocalChanges = True\n replacedJobs[replacedInfo] = (newInfo[1], newInfo[2])\n pinned = self.db.trovesArePinned([replacedInfo])[0]\n elif replacedInfo in referencedNotInstalled:\n # the trove on the local system is one that's referenced\n # but not installed, so, normally we would not install\n # this trove.\n # BUT if this is a primary (or in certain other cases)\n # we always want to have the update happen.\n # In the case of a primary trove,\n # if the referenced trove is replaced by another trove\n # on the the system (by a localUpdate) then we remove\n # that trove instead. If not, we just install this\n # trove as a fresh update.\n log.lowlevel('replaced trove is not installed')\n if followLocalChanges:\n skipLocal = False\n elif installMissingRefs:\n skipLocal = False\n elif (parentInstalled and not parentReplacedWasPinned):\n skipLocal = False\n elif replacedInfo not in localErases and not parentReplacedWasPinned:\n skipLocal = False\n else:\n skipLocal = True\n\n\n if skipLocal:\n # followLocalChanges states that, even though\n # the given trove is not a primary, we still want\n # replace a localUpdate if available instead of\n # skipping the update. This flag can be set if\n # a) an ancestor of this trove is a primary trove\n # that switched from a referencedNotInstalled\n # to an installed trove or b) its passed in to\n # the function that we _always_ follow local\n # changes.\n log.lowlevel('SKIP: not following local changes')\n break\n\n freshInstallOkay = (isPrimary or\n (parentInstalled\n and not parentReplacedWasPinned)\n or byDefault\n or installMissingRefs)\n # we always want to install the trove even if there's\n # no local update to match to if it's a primary, or\n # if the trove's parent was just installed\n # (if the parent was installed, we just added a\n # strong reference, which overrides any other\n # references that might suggest not to install it.)\n\n replaced = localUpdatesByMissing.get(replacedInfo,\n (None, None))\n\n\n if (replaced[0] is None and not freshInstallOkay):\n log.lowlevel('SKIP: not allowing fresh install')\n break\n\n childrenFollowLocalChanges = True\n\n replacedInfo = (replacedInfo[0], replaced[0],\n replaced[1])\n replacedJobs[replacedInfo] = (newInfo[1], newInfo[2])\n if replaced[0]:\n pinned = self.db.trovesArePinned([replacedInfo])[0]\n log.lowlevel('using local update to replace %s, following local changes', replacedInfo)\n\n elif not installRedirects:\n if not redirectHack.get(newInfo, True):\n # a parent redirect was added as an upgrade\n # but this would be a new install of this child\n # trove. Skip it.\n log.lowlevel('SKIP: is a redirect that would be'\n ' a fresh install, but '\n ' installRedirects=False')\n break\n elif redirectHack.get(newInfo, False):\n # we are upgrading a redirect, so don't allow any child\n # redirects to be installed unless they have a matching\n # trove to redirect on the system.\n log.lowlevel('INSTALL: upgrading redirect')\n installRedirects = False\n\n if replaced[0] and respectBranchAffinity:\n log.lowlevel('checking branch affinity')\n # do branch affinity checks\n\n newBranch = newInfo[1].branch()\n installedBranch = replacedInfo[1].branch()\n\n if replacedInfo in localUpdatesByPresent:\n notInstalledVer = localUpdatesByPresent[replacedInfo][0]\n notInstalledBranch = notInstalledVer.branch()\n # create alreadyBranchSwitch variable for\n # readability\n alreadyBranchSwitch = True\n else:\n notInstalledBranch = None\n alreadyBranchSwitch = False\n\n\n # Check to see if there's reason to be concerned\n # about branch affinity.\n if installedBranch == newBranch:\n log.lowlevel('not branch switch')\n # we didn't switch branches. No branch\n # affinity concerns. If the user has made\n # a local change that would make this new\n # install a downgrade, skip it.\n if (not isPrimary\n and newInfo[1] < replaced[0]\n and replacedInfo in sameBranchLocalUpdates\n and (replacedInfo in primaryLocalUpdates\n or not parentUpdated)):\n log.lowlevel('SKIP: avoiding downgrade')\n\n # don't let this trove be erased, pretend\n # like it was explicitly requested.\n alreadyInstalled.add(replacedInfo)\n break\n elif notInstalledBranch == installedBranch:\n log.lowlevel('INSTALL: branch switch is reversion')\n # we are reverting back to the branch we were\n # on before. We don't worry about downgrades\n # because we're already overriding the user's\n # branch choice\n pass\n else:\n log.lowlevel('is a new branch switch')\n # Either a) we've made a local change from branch 1\n # to branch 2 and now we're updating to branch 3,\n # or b) there's no local change but we're switching\n # branches.\n\n # Generally, we respect branch affinity and don't\n # do branch switches. There\n # are a few exceptions:\n if isPrimary:\n # the user explicitly asked to switch\n # to this branch, so we have to honor it.\n\n if alreadyBranchSwitch:\n # it turns out the _current_ installed\n # trove is a local change. The user\n # is messing with branches too much -\n # don't bother with branch affinity.\n respectBranchAffinity = False\n log.lowlevel('INSTALL: is a branch switch on top of a branch switch and is primary')\n else:\n log.lowlevel('INSTALL: is a new branch switch and is primary')\n elif (installedBranch, newBranch) == branchHint:\n # Exception: if the parent trove\n # just made this move, then allow it.\n log.lowlevel('INSTALL: matches parent\\'s branch switch')\n pass\n elif ((replacedInfo in installedAndReferenced\n or replacedInfo in sameBranchLocalUpdates)\n and not alreadyBranchSwitch\n and parentUpdated):\n # Exception: The user has not switched this\n # trove's branch explicitly, and now\n # we have an implicit request to switch\n # the branch.\n log.lowlevel('INSTALL: implicit branch switch, parent installed')\n pass\n else:\n # we're not installing this trove -\n # It doesn't match any of our exceptions.\n # It could be that it's a trove with\n # no references to it on the system\n # (and so a branch switch would be strange)\n # or it could be that it is a switch\n # to a third branch by the user.\n # Since we're rejecting the update due to\n # branch affinity, we don't consider any of its\n # child troves for updates either.\n log.lowlevel('SKIP: not installing branch switch')\n recurseThis = False\n alreadyInstalled.add(replacedInfo)\n break\n\n if replaced[0] and respectFlavorAffinity:\n if replacedInfo in localUpdatesByPresent:\n notInstalledFlavor = localUpdatesByPresent[replacedInfo][1]\n # create alreadyBranchSwitch variable for\n # readability\n #alreadyFlavorSwitch = True\n pass\n elif replacedInfo in sameBranchLocalUpdates:\n notInstalledFlavor = sameBranchLocalUpdates[replacedInfo][1]\n else:\n notInstalledFlavor = None\n\n if (notInstalledFlavor is not None\n and not deps.compatibleFlavors(notInstalledFlavor, replacedInfo[2])\n and not deps.compatibleFlavors(replacedInfo[2], newInfo[2])):\n if isPrimary:\n respectFlavorAffinity = False\n else:\n log.lowlevel('SKIP: Not reverting'\n ' incompatible flavor switch')\n recurseThis = False\n alreadyInstalled.add(replacedInfo)\n break\n\n\n\n # below are checks to see if a fresh install should completed.\n # Since its possible that an update from above could be\n # converted into a fresh install, we start a new if/elif\n # branch here.\n if replaced[0]:\n # we are dealing with a replacement, we've already\n # decided it was okay above.\n pass\n elif not byDefault:\n # This trove is being newly installed, but it's not\n # supposed to be installed by default\n log.lowlevel('SKIP: not doing not-by-default fresh install')\n break\n elif updateOnly:\n # we're not installing trove, only updating installed\n # troves.\n log.lowlevel('SKIP: not doing install due to updateOnly')\n break\n elif not isPrimary and self.cfg.excludeTroves.match(newInfo[0]):\n # New trove matches excludeTroves\n log.lowlevel('SKIP: trove matches excludeTroves')\n break\n elif not installRedirects:\n if not redirectHack.get(newInfo, True):\n # a parent redirect was added as an upgrade\n # but this would be a new install of this child\n # trove. Skip it.\n log.lowlevel('SKIP: redirect would be a fresh install')\n break\n elif redirectHack.get(newInfo, False):\n # we are upgrading a redirect, so don't allow any child\n # redirects to be installed unless they have a matching\n # trove to redirect on the system.\n log.lowlevel('installing redirect')\n installRedirects = False\n\n job = (newInfo[0], replaced, (newInfo[1], newInfo[2]), False)\n if pinned and (not isPrimary or checkPrimaryPins):\n job = self._splitPinnedJob(uJob, troveSource, job,\n force=not isPrimary)\n if job is None:\n recurseThis = False\n break\n elif (not isPrimary\n and self.cfg.excludeTroves.match(newInfo[0])):\n # New trove matches excludeTroves\n log.lowlevel('SKIP: trove matches excludeTroves')\n recurseThis = False\n break\n\n log.lowlevel('JOB ADDED: %s', job)\n newJob.add(job)\n jobAdded = True\n break\n\n log.lowlevel('recurseThis: %s\\nrecurse: %s', recurseThis, recurse)\n\n if jobAdded and removeNotByDefault and not byDefault:\n job = (newInfo[0], replaced, (newInfo[1], newInfo[2]), False)\n newJob.discard(job)\n if replaced[0]:\n notByDefaultRemovals.add(\n (newInfo[0], replaced, (None, None), False))\n elif newInfo in alreadyInstalled:\n notByDefaultRemovals.add(\n (newInfo[0], (newInfo[1], newInfo[2]),\n (None, None), False))\n\n if not recurseThis: continue\n if not recurse: continue\n if not trove.troveIsCollection(newInfo[0]): continue\n\n\n branchHint = None\n if replaced[0] and replaced[0].branch() == newInfo[1].branch():\n # if this trove didn't switch branches, then we respect branch\n # affinity for all child troves even the primary trove above us\n # did switch. We assume the user at some point switched this\n # trove to the desired branch by hand already.\n log.lowlevel('respecting branch affinity for children')\n if not neverRespectBranchAffinity:\n respectBranchAffinity = True\n elif replaced[0]:\n branchHint = (replaced[0].branch(), newInfo[1].branch())\n\n if replaced[0] and deps.compatibleFlavors(replaced[1], newInfo[2]):\n log.lowlevel('respecting flavor affinity for children')\n respectFlavorAffinity = True\n\n if trv is None:\n try:\n trv = troveSource.getTrove(withFiles = False, *newInfo)\n except TroveMissing:\n if self.db.hasTrove(*newInfo):\n trv = self.db.getTrove(withFiles = False, *newInfo)\n else:\n # it's possible that the trove source we're using\n # contains references to troves that it does not\n # actually contain. That's okay as long as the\n # excluded trove is not actually trying to be\n # installed.\n if jobAdded:\n raise\n else:\n continue\n\n if isPrimary:\n # byDefault status of troves is determined by the primary\n # trove.\n byDefaultDict = dict((x[0], x[1]) \\\n for x in trv.iterTroveListInfo())\n\n updateOnly = updateOnly or not jobAdded\n # for all children, we only want to install them as new _if_ we\n # installed their parent. If we did not install/upgrade foo, then\n # we do not install foo:runtime (though if it's installed, it\n # is reasonable to upgrade it).\n\n if isPrimary:\n primaryInstalled = jobAdded and not job[1][0]\n\n jobInstall = primaryInstalled or (jobAdded and not job[1][0])\n\n for info in sorted(trv.iterTroveList(strongRefs=True)):\n\n if not isPrimary:\n if not jobAdded and info not in byDefaultDict:\n continue\n\n # support old-style collections. _If_ this trove was not\n # mentioned in its parent trove, then set its default\n # value here.\n childByDefault = (trv.includeTroveByDefault(*info)\n and jobAdded)\n byDefaultDict.setdefault(info, childByDefault)\n\n newTroves.append((info, False,\n byDefaultDict, jobInstall, pinned, jobAdded,\n primaryInstalled,\n branchHint, respectBranchAffinity,\n respectFlavorAffinity, installRedirects,\n childrenFollowLocalChanges,\n updateOnly))\n\n _filterDoubleRemovesDueToLocalUpdates(newJob, replacedJobs)\n for job in notByDefaultRemovals:\n if job not in newJob:\n erasePrimaries.add((job[0], job[1], (None, None), False))\n alreadyInstalled.discard((job[0], job[1][0], job[1][1]))\n\n # items which were updated to redirects should be removed, no matter\n # what\n for info in set(itertools.chain(*redirectHack.values())):\n erasePrimaries.add((info[0], (info[1], info[2]), (None, None), False))\n\n eraseSet = _findErasures(erasePrimaries, newJob, alreadyInstalled,\n recurse, ineligible)\n assert(not [x for x in newJob if x[2][0] is None])\n newJob.update(eraseSet)\n return newJob", "metadata": "root.ClientUpdate._mergeGroupChanges", "header": "['class', 'ClientUpdate', '(', 'object', ')', ':', '___EOS___']", "index": 296 } ]
[ { "span": "pass", "start_line": 1039, "start_column": 28, "end_line": 1039, "end_column": 32 }, { "span": "pass", "start_line": 1067, "start_column": 32, "end_line": 1067, "end_column": 36 }, { "span": "pass", "start_line": 1077, "start_column": 32, "end_line": 1077, "end_column": 36 }, { "span": "pass", "start_line": 1100, "start_column": 32, "end_line": 1100, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Client", "Update_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "merge", "Group", "Changes_", "(_", "self_", ",_", "u", "Job_", ",_", "primary", "Jo", "b", "List_", ",_", "transiti", "ve", "Clos", "ure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "Hack", "_", ",_", "recurse_", ",_", "ine", "lig", "ible_", ",_", "check", "Prim", "ary", "Pins_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "ed", "Prim", "aries", "_", ",_", "install", "Missing", "Refs", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Only_", "=_", "False_", ",_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alw", "ay", "s", "Follow", "Local", "Changes_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "Not", "By", "Default_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "look", "up", "Path", "Hashe", "s_", "(_", "info", "List_", ",_", "old_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", "in_", "self_", "._", "db_", "._", "get", "Path", "Hashe", "s", "For", "Trove", "List_", "(_", "info", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "s_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "._", "append_", "(_", "set_", "(_", ")_", ")_", "\\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_", "._", "append_", "(_", "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_", "return_", "result_", "\\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 ", " _", "trove", "Source_", "=_", "u", "Job_", "._", "get", "Trove", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "can", "'", "t", " ", "assume", " ", "tha", "t", " ", "the", " ", "trove", "Sou", "rce", " ", "has", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "child", " ", "trove", "s", " ", "for", " ", "package", "s", " ", "we", " ", "can", " ", "see", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Specifi", "call", "y", ",", " ", "the", " ", "trove", "Sou", "rce", " ", "coul", "d", " ", "have", " ", "come", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "relative", " ", "changeset", " ", "tha", "t", " ", "only", " ", "contain", "s", " ", "by", "Default", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "component", "s", " ", "-", " ", "here", " ", "we", "'", "re", " ", "look", "ing", " ", "at", " ", "bot", "h", " ", "by", "Default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "and", " ", "Fal", "se", " ", "component", "s", " ", "(", "in", " ", "trove", ".", "diff", ")_", "\\u\\u\\uNL\\u\\u\\u_", "has", "Trove", "List_", "=_", "trove", "Source_", "._", "has", "Trove", "s_", "(_", "info", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info_", ",_", "has", "Trove", "_", "in_", "itertools_", "._", "izip_", "(_", "info", "List_", ",_", "has", "Trove", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "has", "Trove", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ph_", "=_", "trove", "Source_", "._", "get", "Trove", "_", "(_", "with", "Files_", "=_", "False_", ",_", "*_", "info_", ")_", "._", "get", "Path", "Hashe", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "ph_", ")_", "\\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_", "._", "append_", "(_", "set_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "Er", "asu", "res_", "(_", "primary", "Erase", "s_", ",_", "new", "Job_", ",_", "referenced", "Trove", "s_", ",_", "recurse_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ine", "lig", "ible_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "batche", "s", " ", "a", " ", "bunch", " ", "of", " ", "has", "Trove", "/", "trove", "s", "Are", "Pin", "ned", " ", "calls", ".", " ", "It_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "get", " ", "the", " ", "ones", " ", "we", " ", "find", " ", "implicit", "ly", ",", " ", "unfo", "rtu", "nat", "el", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Er", "asu", "re", "Info", "Cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "db_", "=_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "has", "Trove", "s", "Cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pinned", "Cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reference", "s", "Cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "Trove", "_", "(_", "self_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "has", "Trove", "s", "Cache_", "._", "get_", "(_", "info_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Pin", "ned", "_", "(_", "self_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "pinned", "Cache_", "[_", "info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Reference", "s_", "(_", "self_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "reference", "s", "Cache_", "[_", "info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "populate_", "(_", "self_", ",_", "job", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "era", "sure", "s_", "=_", "[_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "for_", "job_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "job", "List_", "if_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Trove", "List_", "=_", "self_", "._", "db_", "._", "has", "Trove", "s_", "(_", "era", "sure", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "has", "Trove", "s", "Cache_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "itertools_", "._", "izip_", "(_", "era", "sure", "s_", ",_", "has", "Trove", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "present_", "=_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "itertools_", "._", "izip_", "(_", "era", "sure", "s_", ",_", "has", "Trove", "List_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pinned", "List_", "=_", "self_", "._", "db_", "._", "trove", "s", "Are", "Pin", "ned", "_", "(_", "present_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pinned", "Cache_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "itertools_", "._", "izip_", "(_", "present_", ",_", "pinned", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reference", "List_", "=_", "self_", "._", "db_", "._", "get", "Trove", "Trove", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "present_", ",_", "weak", "Refs", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pris", "tin", "e", "Only_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reference", "s", "Cache_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "itertools_", "._", "izip_", "(_", "present_", ",_", "reference", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "each", " ", "node", " ", "is", " ", "a", " ", "((", "name", ",", " ", "version", ",", " ", "flavor", "),", " ", "state", ",", " ", "edge", "List_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "from", "Update", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "state", " ", "is", " ", "ERA", "SE", ",", " ", "KEEP", ",", " ", "or", " ", "UNKNOWN_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", "Update", " ", "is", " ", "Tru", "e", " ", "if", " ", "era", "sing", " ", "this", " ", "node", " ", "reflect", "s", " ", "a", " ", "trove", " ", "bei", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replaced", " ", "by", " ", "a", " ", "different", " ", "one", " ", "in", " ", "the", " ", "Jo", "b", " ", "(", "an", " ", "update", ",", " ", "not", " ", "an", " ", "erase", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "track", " ", "this", " ", "to", " ", "know", " ", "what", "'", "s", " ", "bei", "ng", " ", "remove", "d", ",", " ", "but", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "caus", "e", " ", "them", " ", "to", " ", "be", " ", "remove", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "Idx_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERA", "SE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KEEP", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UNKNOWN_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info", "Cache_", "=_", "Er", "asu", "re", "Info", "Cache_", "(_", "self_", "._", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "Cache_", "._", "populate_", "(_", "new", "Job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "Cache_", "._", "populate_", "(_", "primary", "Erase", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "Queue_", "=_", "util_", "._", "It", "era", "ble", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "order", " ", "of", " ", "this", " ", "chain", " ", "matte", "rs", ".", " ", "It", "'", "s", " ", "importa", "nt", " ", "tha", "t", " ", "we", " ", "handle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "of", " ", "the", " ", "era", "sure", "s", " ", "we", " ", "alr", "ead", "y", " ", "know", " ", "abo", "ut", " ", "bef", "ore", " ", "getti", "ng", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ones", " ", "whi", "ch", " ", "are", " ", "implicit", ".", " ", "Tha", "t", " ", "gets", " ", "the", " ", "state", " ", "right", " ", "for", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "are", " ", "explicit", " ", "(", "sinc", "e", " ", "arr", "ivi", "ng", " ", "there", " ", "implicit", "ly", " ", "gets", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", "d", ").", " ", "Hand", "ling", " ", "update", "s", " ", "from", " ", "new", "Jo", "b", " ", "first", " ", "prevent", "s", " ", "duplicates_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "primary", "Erase", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "job_", ",_", "is", "Prim", "ary_", "in_", "itertools_", "._", "chain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "itertools_", "._", "izip_", "(_", "new", "Job_", ",_", "itertools_", "._", "repeat_", "(_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "itertools_", "._", "izip_", "(_", "primary", "Erase", "s_", ",_", "itertools_", "._", "repeat_", "(_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "Queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Info_", "=_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "old", "Info_", "[_", "1_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "skip", " ", "new", " ", "install", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "Info_", "in_", "node", "Idx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "note", " ", "above", " ", "abo", "ut", " ", "chain", " ", "order", " ", "(", "this", " ", "wou", "ld", "n", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "work", " ", "w", "/", "o", " ", "it", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "present_", "=_", "info", "Cache_", "._", "has", "Trove", "_", "(_", "old", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "present_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info", "Cache_", "._", "populate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "job_", "]_", "+_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "job", "Queue_", "._", "peek", "Rema", "inde", "r_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "present_", "=_", "info", "Cache_", "._", "has", "Trove", "_", "(_", "old", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "present_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "need", " ", "to", " ", "erase", " ", "somet", "hing", " ", "we", " ", "don", "'", "t", " ", "have", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "era", "sure", "s", " ", "whi", "ch", " ", "are", " ", "part", " ", "of", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "are", " ", "guaran", "tee", "d", " ", "to", " ", "occur", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "job_", "in_", "new", "Job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "(_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "ERA", "SE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "Update_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "it", "'", "s", " ", "pinned", ",", " ", "we", " ", "keep", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "info", "Cache_", "._", "is", "Pin", "ned", "_", "(_", "old", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "state_", "=_", "KEEP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Prim", "ary_", "and_", "check", "Prim", "ary", "Pins_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Update", "Pin", "ned", "Trove", "Error_", "(_", "old", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Prim", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "primary", " ", "update", "s", " ", "are", " ", "guaran", "tee", "d", " ", "to", " ", "occur", " ", "(", "if", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "is", " ", "not", " ", "pinned", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "state_", "=_", "ERA", "SE_", "\\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 ", " ", " _", "state_", "=_", "UNKNOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "Update_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "old", "Info_", "not_", "in_", "node", "Idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "Idx_", "[_", "old", "Info_", "]_", "=_", "len_", "(_", "node", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "List_", "._", "append_", "(_", "[_", "old", "Info_", ",_", "state_", ",_", "[_", "]_", ",_", "from", "Update_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "recurse_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "trove_", "._", "trove", "Is", "Collection_", "(_", "old", "Info_", "[_", "0_", "]_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "incl", "Info_", "in_", "info", "Cache_", "._", "get", "Reference", "s_", "(_", "old", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "only", " ", "use", " ", "strong", " ", "reference", "s", " ", "whe", "n", " ", "era", "sing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "incl", "Info_", "in_", "ine", "lig", "ible_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "Queue_", "._", "add_", "(_", "(_", "(_", "incl", "Info_", "[_", "0_", "]_", ",_", "incl", "Info_", "[_", "1_", ":_", "]_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "nodes", " ", "whi", "ch", " ", "we", " ", "have", "n", "'", "t", " ", "decide", "d", " ", "to", " ", "erase", ",", " ", "we", " ", "need", " ", "to", " ", "track_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "down", " ", "all", " ", "of", " ", "the", " ", "collection", "s", " ", "whi", "ch", " ", "include", " ", "tho", "se", " ", "trove", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "need", "Parent", "s_", "=_", "[_", "(_", "node", "Id_", ",_", "info_", ")_", "for_", "node", "Id_", ",_", "(_", "info_", ",_", "state_", ",_", "edges_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alr", "ead", "y", "Handle", "d_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "enumerate_", "(_", "node", "List_", ")_", "if_", "state_", "==_", "UNKNOWN_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "need", "Parent", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "containers_", "=_", "self_", "._", "db_", "._", "get", "Trove", "Containers", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "[_", "1_", "]_", "for_", "x_", "in_", "need", "Parent", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Ne", "ed", "Parent", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "node", "Id_", ",_", "node", "Info_", ")_", ",_", "container", "List_", "in_", "itertools_", "._", "izip_", "(_", "need", "Parent", "s_", ",_", "containers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "container", "Info_", "in_", "container", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "container", "Info_", "in_", "node", "Idx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "container", "Id_", "=_", "node", "Idx_", "[_", "container", "Info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "List_", "[_", "container", "Id_", "]_", "[_", "2_", "]_", "._", "append_", "(_", "node", "Id_", ")_", "\\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 ", " ", " _", "container", "Id_", "=_", "len_", "(_", "node", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "Idx_", "[_", "container", "Info_", "]_", "=_", "container", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "List_", "._", "append_", "(_", "[_", "container", "Info_", ",_", "KEEP", "_", ",_", "[_", "node", "Id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Ne", "ed", "Parent", "s_", "._", "append_", "(_", "(_", "container", "Id_", ",_", "container", "Info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "need", "Parent", "s_", "=_", "new", "Ne", "ed", "Parent", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "erase", " ", "nodes", " ", "whi", "ch", " ", "are", " ", "referenced", " ", "by", " ", "trove", "s", " ", "we", "'", "re", " ", "about_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "install", " ", "-", " ", "the", " ", "only", " ", "trove", "s", " ", "we", " ", "list", " ", "here", " ", "are", " ", "primary", " ", "install", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", "y", " ", "shou", "ld", " ", "neve", "r", " ", "be", " ", "erase", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "info_", "in_", "referenced", "Trove", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info_", "in_", "node", "Idx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "node_", "=_", "node", "List_", "[_", "node", "Idx_", "[_", "info_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "[_", "1_", "]_", "=_", "KEEP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "seen_", "=_", "[_", "False_", "]_", "*_", "len_", "(_", "node", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "DF", "S", " ", "to", " ", "mark", " ", "trove", "s", " ", "as", " ", "KEEP", "_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Nodes_", "=_", "[_", "node", "Id_", "for_", "node", "Id_", ",_", "node_", "in_", "enumerate_", "(_", "node", "List_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "node_", "[_", "1_", "]_", "==_", "KEEP", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "keep", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "Id_", "=_", "keep", "Nodes_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seen_", "[_", "node", "Id_", "]_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seen_", "[_", "node", "Id_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "List_", "[_", "node", "Id_", "]_", "[_", "1_", "]_", "=_", "KEEP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keep", "Nodes_", "+=_", "node", "List_", "[_", "node", "Id_", "]_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyt", "hing", " ", "whi", "ch", " ", "isn", "'", "t", " ", "to", " ", "KEEP", " ", "is", " ", "to", " ", "erase", ",", " ", "but", " ", "skip", " ", "tho", "se", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "alr", "ead", "y", " ", "bei", "ng", " ", "remove", "d", " ", "by", " ", "a", " ", "tr", "v", "Cs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "erase", "List_", "=_", "(_", "(_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "(_", "x_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "x_", "[_", "0_", "]_", "[_", "2_", "]_", ")_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "False_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "node", "List_", "if_", "x_", "[_", "1_", "]_", "!=_", "KEEP", "_", "and_", "not_", "x_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "set_", "(_", "erase", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "trove", "Transiti", "ve", "Clos", "ure_", "(_", "db_", ",_", "item", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item", "Queue_", "=_", "util_", "._", "It", "era", "ble", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "Set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "itertools_", "._", "chain_", "(_", "item", "List_", ",_", "item", "Queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "in_", "full", "Set_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "Set_", "._", "add_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "trove_", "._", "trove", "Is", "Collection_", "(_", "item_", "[_", "0_", "]_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "v_", "=_", "db_", "._", "get", "Trove", "_", "(_", "with", "Files_", "=_", "False_", ",_", "pris", "tin", "e_", "=_", "False_", ",_", "*_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "tr", "v_", "._", "iter", "Trove", "List_", "(_", "strong", "Refs", "_", "=_", "True_", ",_", "weak", "Refs", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item", "Queue_", "._", "add_", "(_", "x_", ")_", "\\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_", "full", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "filter", "Doub", "le", "Remove", "s", "Du", "e", "To", "Local", "Update", "s_", "(_", "new", "Job_", ",_", "replaced", "Jobs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "possib", "le", " ", "tha", "t", " ", "a", " ", "local", "ly", " ", "remove", "d", " ", "half", " ", "of", " ", "a", " ", "local", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "will", " ", "match", " ", "up", " ", "to", " ", "somet", "hing", " ", "tha", "t", " ", "is", " ", "due", " ", "to", " ", "be", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "desp", "ite", " ", "the", " ", "fact", " ", "tha", "t", " ", "its", " ", "match", " ", "has", " ", "bee", "n", " ", "remove", "d", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "want", " ", "to", " ", "disallow", " ", "tha", "t", " ", "type", " ", "of", " ", "match", " ", "-", " ", "it", " ", "is", " ", "usef", "ul_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "informati", "on", " ", "and", " ", "may", " ", "be", " ", "corr", "rect", ".", " ", " ", "Ho", "we", "ver", ",", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "double", " ", "removal", ",", " ", "whi", "ch", " ", "is", " ", "what", " ", "will", " ", "happ", "en", " ", "in", " ", "some", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "cona", "ry", " ", "will", " ", "switch", " ", "the", " ", "erase", "d", " ", "version", " ", "mentioned", " ", "in", " ", "the", " ", "local_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "to", " ", "the", " ", "install", "ed", " ", "version", ",", " ", "whi", "ch", " ", "coul", "d", " ", "be", " ", "a", " ", "part", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anot", "her", " ", "update", ".", " ", " ", "In", " ", "suc", "h", " ", "case", "s", ",", " ", "we", " ", "remove", " ", "the", " ", "\"", "erase", "\"", " ", "part_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "local", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "erase", "Count_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "job_", "in_", "new", "Job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Info_", "=_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "Info_", "in_", "replaced", "Jobs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "old", "Info_", "in_", "erase", "Count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "erase", "Count_", "[_", "old", "Info_", "]_", "+=_", "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 ", " ", " _", "erase", "Count_", "[_", "old", "Info_", "]_", "=_", "1_", "\\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_", "double", "Erase", "d_", "=_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "erase", "Count_", "._", "iteritems_", "(_", ")_", "if_", "x_", "[_", "1_", "]_", ">_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "Info_", "in_", "double", "Erase", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Job_", "._", "remove_", "(_", "(_", "old", "Info_", "[_", "0_", "]_", ",_", "(_", "old", "Info_", "[_", "1_", "]_", ",_", "old", "Info_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replaced", "Jobs_", "[_", "old", "Info_", "]_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Job_", "._", "add_", "(_", "(_", "old", "Info_", "[_", "0_", "]_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replaced", "Jobs_", "[_", "old", "Info_", "]_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "\\u", "merge", "Group", "Change", "s", " ", "--", " ", "main", " ", "body", " ", "begins", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "erase", "Prim", "aries", "_", "=_", "set_", "(_", "x_", "for_", "x_", "in_", "primary", "Jo", "b", "List_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relative", "Prim", "aries", "_", "=_", "set_", "(_", "x_", "for_", "x_", "in_", "primary", "Jo", "b", "List_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "x_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abs", "olute", "Prim", "aries", "_", "=_", "set_", "(_", "x_", "for_", "x_", "in_", "primary", "Jo", "b", "List_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "relative", "Prim", "aries", "_", ")_", "+_", "len_", "(_", "abs", "olute", "Prim", "aries", "_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "erase", "Prim", "aries", "_", ")_", "==_", "len_", "(_", "primary", "Jo", "b", "List_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'\\u", "merge", "Group", "Change", "s", "(", "recurse", "=", "%", "s", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "check", "Prim", "ary", "Pin", "s", "=", "%", "s", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "install", "Missing", "Refs", "=", "%", "s", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "update", "On", "ly", "=", "%", "s", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "respec", "t", "Branc", "h", "Affi", "nit", "y", "=", "%", "s", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "alw", "ay", "s", "Follow", "Local", "Change", "s", "=", "%", "s", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recurse_", ",_", "check", "Prim", "ary", "Pins_", ",_", "install", "Missing", "Refs", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Only_", ",_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alw", "ay", "s", "Follow", "Local", "Changes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trove", "Source_", "=_", "u", "Job_", "._", "get", "Trove", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ine", "lig", "ibl", "e", " ", "need", "s", " ", "to", " ", "be", " ", "a", " ", "transiti", "ve", " ", "clos", "ure", " ", "whe", "n", " ", "recurse", " ", "is", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "recurse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ine", "lig", "ible_", "=_", "\\u", "trove", "Transiti", "ve", "Clos", "ure_", "(_", "self_", "._", "db_", ",_", "ine", "lig", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "job_", "in_", "erase", "Prim", "aries", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "an", " ", "erase", " ", "primary", " ", "can", "'", "t", " ", "be", " ", "part", " ", "of", " ", "an", " ", "update", " ", "(", "but", " ", "thei", "r", " ", "children_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", ",", " ", "so", " ", "add", " ", "this", " ", "after", " ", "we", "'", "ve", " ", "recurse", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ine", "lig", "ible_", "._", "add_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "trove", " ", "whi", "ch", " ", "contain", "s", " ", "all", " ", "of", " ", "the", " ", "abs", "olute", " ", "change", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "may", " ", "need", " ", "to", " ", "install", ".", " ", "Build", " ", "a", " ", "set", " ", "of", " ", "all", " ", "of", " ", "the", " ", "trove", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "tha", "t", " ", "trove", " ", "as", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avail", "able", "Trove", "_", "=_", "trove_", "._", "Trove", "_", "(_", "\"@", "update", "\"_", ",_", "versions_", "._", "New", "Version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deps_", "._", "Flavor_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "job_", "in_", "transiti", "ve", "Clos", "ure_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "None_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "job_", "[_", "3_", "]_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", "in_", "ine", "lig", "ible_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "avail", "able", "Trove", "_", "._", "add", "Trove", "_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "presen", "t", "Ok", "ay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "._", "add_", "(_", "job_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avail_", "=_", "set_", "(_", "avail", "able", "Trove", "_", "._", "iter", "Trove", "List_", "(_", "strong", "Refs", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "set", " ", "of", " ", "all", " ", "relative", " ", "install", " ", "jobs", " ", "(", "transiti", "ve", " ", "clos", "ure", ")_", "\\u\\u\\uNL\\u\\u\\u_", "relative", "Update", "Jobs_", "=_", "set_", "(_", "job_", "for_", "job_", "in_", "transiti", "ve", "Clos", "ure_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "and_", "not_", "job_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", " ", "for", " ", "relative", " ", "update", "s", " ", "who", "se", " ", "source", "s", " ", "are", " ", "not", " ", "currentl", "y", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "relative", "Update", "s_", "=_", "[_", "(_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ",_", "x_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "relative", "Update", "Jobs_", "if_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Present", "List_", "=_", "self_", "._", "db_", "._", "has", "Trove", "s_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "relative", "Update", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "info_", ",_", "job_", ")_", ",_", "is", "Present_", "in_", "itertools_", "._", "izip_", "(_", "relative", "Update", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Present", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "Present_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "Update", "Jobs_", "._", "remove_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Trove", "_", "=_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "Trove", "_", "not_", "in_", "avail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ine", "lig", "ible_", "._", "add_", "(_", "new", "Trove", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "skip", " ", "relative", " ", "install", "s", " ", "tha", "t", " ", "are", " ", "alr", "ead", "y", " ", "presen", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "relative", "Install", "s_", "=_", "[_", "(_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", ",_", "x_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "relative", "Update", "Jobs_", "if_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Present", "List_", "=_", "self_", "._", "db_", "._", "has", "Trove", "s_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "relative", "Install", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "new", "Trove", "_", ",_", "job_", ")_", ",_", "is", "Present_", "in_", "itertools_", "._", "izip_", "(_", "relative", "Install", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Present", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Present_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "Update", "Jobs_", "._", "remove_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ine", "lig", "ible_", "._", "add_", "(_", "new", "Trove", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "used", " ", "to", " ", "be", " ", "a", " ", "relative", " ", "upgrade", ",", " ", "but", " ", "the", " ", "target_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "install", "ed", ",", " ", "so", " ", "turn", " ", "it", " ", "int", "o", " ", "an", " ", "erase", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "erase", "Prim", "aries", "_", "._", "add_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "(_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "None_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "all", " ", "of", " ", "the", " ", "currentl", "y", " ", "install", "ed", " ", "and", " ", "referenced", " ", "trove", "s", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "match", " ", "somet", "hing", " ", "bei", "ng", " ", "install", "ed", " ", "abs", "olute", ".", " ", "Trove", "s", " ", "bei", "ng", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "through", " ", "a", " ", "relative", " ", "changeset", " ", "are", "n", "'", "t", " ", "allow", "ed", " ", "to", " ", "be", " ", "remove", "d", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "else", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "install", "ed", "Not", "Reference", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "ed", "And", "Reference", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "referenced", "Strong", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "referenced", "Wea", "k_", ")_", "=_", "self_", "._", "db_", "._", "db_", "._", "get", "Complete", "Trove", "Set_", "(_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "ed", "Trove", "s_", "=_", "install", "ed", "Not", "Reference", "d_", "|_", "install", "ed", "And", "Reference", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referenced", "Not", "Install", "ed_", "=_", "referenced", "Strong", "_", "|_", "referenced", "Wea", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "referenced", "Not", "Install", "ed", ":", " ", "%", "s", "'_", ",_", "referenced", "Not", "Install", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "ine", "lig", "ibl", "e", ":", " ", "%", "s", "'_", ",_", "ine", "lig", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "ed", "Trove", "s_", "._", "difference", "\\u", "update_", "(_", "ine", "lig", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "ed", "Trove", "s_", "._", "difference", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "for_", "job_", "in_", "relative", "Update", "Jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referenced", "Not", "Install", "ed_", "._", "difference", "\\u", "update_", "(_", "ine", "lig", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referenced", "Not", "Install", "ed_", "._", "difference", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "for_", "job_", "in_", "relative", "Update", "Jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "job", " ", "bet", "ween", " ", "referenced", "Trove", "s", " ", "and", " ", "install", "ed", "Trove", "s", " ", "tell", "s", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "lot", " ", "abo", "ut", " ", "what", " ", "the", " ", "user", " ", "has", " ", "don", "e", " ", "to", " ", "his", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "primary", "Local", "Update", "s_", "=_", "self_", "._", "get", "Prim", "ary", "Local", "Update", "s_", "(_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Update", "s_", "=_", "list_", "(_", "primary", "Local", "Update", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "local", "Update", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "Update", "s_", "+=_", "self_", "._", "get", "Chil", "d", "Local", "Update", "s_", "(_", "u", "Job_", "._", "get", "Sear", "ch", "Source_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "Update", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "ed", "Trove", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "referenced", "Not", "Install", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "some", " ", "assertion", "s", " ", "abo", "ut", " ", "the", " ", "local", " ", "update", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "a", " ", "missi", "ng", " ", "trove", " ", "can", " ", "only", " ", "be", " ", "a", " ", "part", " ", "of", " ", "one", " ", "local", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "a", " ", "presen", "t", " ", "trove", " ", "can", " ", "only", " ", "be", " ", "a", " ", "part", " ", "of", " ", "one", " ", "local", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alth", "ou", "gh", " ", "we", " ", "need", "ed", " ", "parent", " ", "update", "s", " ", "to", " ", "get", " ", "the", " ", "correct", " ", "set", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "local", " ", "update", "s", " ", "relate", "d", " ", "to", " ", "this", " ", "job", ",", " ", "we", " ", "don", "'", "t", " ", "care", " ", "local", " ", "updates_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "relate", "d", " ", "to", " ", "trove", "s", " ", "in", " ", "our", " ", "job", "._", "\\u\\u\\uNL\\u\\u\\u_", "local", "Update", "s_", "=_", "[_", "x_", "for_", "x_", "in_", "local", "Update", "s_", "if_", "x_", "[_", "0_", "]_", "in_", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local", "Update", "s", "By", "Present_", "=_", "dict_", "(_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", ",_", "job_", "[_", "1_", "]_", ")_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "in_", "local", "Update", "s_", "if_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Update", "s", "By", "Missing", "_", "=_", "dict_", "(_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ",_", "job_", "[_", "2_", "]_", ")_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "in_", "local", "Update", "s_", "if_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "primary", "Local", "Update", "s_", "=_", "set_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "job_", "in_", "primary", "Local", "Update", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Erase", "s_", "=_", "set_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "job_", "in_", "local", "Update", "s_", "if_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Trove", "s", " ", "whi", "ch", " ", "wer", "e", " ", "local", "ly", " ", "update", "d", " ", "to", " ", "version", " ", "on", " ", "the", " ", "same", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "long", "er", " ", "need", " ", "to", " ", "be", " ", "liste", "d", " ", "as", " ", "referenced", ".", " ", "The", " ", "trove", " ", "whi", "ch", " ", "replaced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "is", " ", "alw", "ay", "s", " ", "a", " ", "bett", "er", " ", "match", " ", "for", " ", "the", " ", "new", " ", "items", " ", "(", "install", "ed", " ", "is", " ", "bett", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "not", " ", "install", "ed", " ", "as", " ", "long", " ", "as", " ", "the", " ", "branch", "es", " ", "are", " ", "the", " ", "same", ").", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "sn", "'", "t", " ", "appl", "y", " ", "if", " ", "the", " ", "trove", " ", "whi", "ch", " ", "was", " ", "original", "ly", " ", "install", "ed", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", " ", "of", " ", "this", " ", "update", " ", "tho", "ugh", ",", " ", "as", " ", "trove", "s", " ", "whi", "ch", " ", "are", " ", "referenced", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", " ", "of", " ", "the", " ", "update", " ", "are", " ", "handle", "d", " ", "separately", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", " ", "track", " ", "of", " ", "trove", "s", " ", "tha", "t", " ", "are", " ", "change", "s", " ", "on", " ", "the", " ", "same", " ", "branch", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "tho", "se", " ", "are", " ", "still", " ", "explicit", " ", "user", " ", "request", "s", " ", "and", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", " ", "impli", "ed", " ", "update", "s", " ", "tha", "t", " ", "wou", "ld", " ", "down", "grade", " ", "this", " ", "trove", "._", "\\u\\u\\uNL\\u\\u\\u_", "same", "Branc", "h", "Local", "Update", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "job_", "in_", "sorted_", "(_", "local", "Update", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "and_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", "._", "branch_", "(_", ")_", "==_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", "._", "branch_", "(_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "not_", "in_", "avail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "local", "Update", "s", "By", "Present_", "[_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "local", "Update", "s", "By", "Missing", "_", "[_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "referenced", "Not", "Install", "ed_", "._", "remove_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "rew", "ork", "ing", " ", "same", "-", "branch", " ", "local", " ", "update", ":", " ", "%", "s", "'_", ",_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "track", " ", "this", " ", "update", " ", "for", " ", "sinc", "e", " ", "it", " ", "means", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "request", "ed", " ", "this", " ", "version", " ", "explicit", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "same", "Branc", "h", "Local", "Update", "s_", "[_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", "]_", "=_", "(_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "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 ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "local", " ", "update", ":", " ", "%", "s", "'_", ",_", "job_", ")_", "\\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_", "del_", "local", "Update", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "set", " ", "of", " ", "the", " ", "inco", "ming", " ", "trove", "s", " ", "whi", "ch", " ", "are", " ", "eit", "her", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", "ed", " ", "or", " ", "alr", "ead", "y", " ", "referenced", "._", "\\u\\u\\uNL\\u\\u\\u_", "alr", "ead", "y", "Install", "ed_", "=_", "(_", "install", "ed", "Trove", "s_", "&_", "avail_", ")_", "|_", "install", "ed", "Prim", "aries", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "Reference", "d_", "=_", "referenced", "Not", "Install", "ed_", "&_", "avail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "avail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "s", "Tr", "v_", "=_", "trove_", "._", "Trove", "_", "(_", "\"@", "update", "\"_", ",_", "versions_", "._", "New", "Version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deps_", "._", "Flavor_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "exist", "s", "Tr", "v_", "._", "add", "Trove", "_", "(_", "*_", "x_", ")_", "for_", "x_", "in_", "install", "ed", "Trove", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "exist", "s", "Tr", "v_", "._", "add", "Trove", "_", "(_", "*_", "x_", ")_", "for_", "x_", "in_", "referenced", "Not", "Install", "ed_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "List_", "=_", "avail", "able", "Trove", "_", "._", "diff_", "(_", "exist", "s", "Tr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "Path", "Hashe", "s_", "=_", "look", "up", "Path", "Hashe", "s_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alr", "ead", "y", "Reference", "d", " ", "trove", "s", " ", "are", " ", "in", " ", "bot", "h", " ", "the", " ", "update", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "install", "ed", " ", "set", ".", " ", " ", "The", "y", " ", "are", " ", "a", " ", "good", " ", "match", " ", "for", " ", "them", "sel", "ves", "._", "\\u\\u\\uNL\\u\\u\\u_", "job", "List_", "+=_", "[_", "(_", "x_", "[_", "0_", "]_", ",_", "(_", "x_", "[_", "1_", "]_", ",_", "x_", "[_", "2_", "]_", ")_", ",_", "(_", "x_", "[_", "1_", "]_", ",_", "x_", "[_", "2_", "]_", ")_", ",_", "0_", ")_", "for_", "x_", "in_", "alr", "ead", "y", "Reference", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Jobs_", "=_", "[_", "x_", "for_", "x_", "in_", "job", "List_", "if_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Jobs_", "=_", "[_", "x_", "for_", "x_", "in_", "job", "List_", "if_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pins_", "=_", "self_", "._", "db_", "._", "trove", "s", "Are", "Pin", "ned", "_", "(_", "[_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "update", "Jobs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "By", "New_", "=_", "dict_", "(_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", ",_", "(_", "job_", "[_", "1_", "]_", ",_", "pin_", ")_", ")_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "job_", ",_", "pin_", ")_", "in_", "itertools_", "._", "izip_", "(_", "update", "Jobs_", ",_", "pins_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "By", "New_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", ",_", "(_", "job_", "[_", "1_", "]_", ",_", "False_", ")_", ")_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "in_", "install", "Jobs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "job", "List_", ",_", "install", "Jobs_", ",_", "update", "Jobs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Relative", " ", "jobs", " ", "override", " ", "pin", "s", " ", "and", " ", "need", " ", "to", " ", "match", " ", "up", " ", "against", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "right", " ", "thing", "._", "\\u\\u\\uNL\\u\\u\\u_", "job", "By", "New_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", ",_", "(_", "job_", "[_", "1_", "]_", ",_", "False_", ")_", ")_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "in_", "relative", "Update", "Jobs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "new", "Trove", "s", " ", "parameter", "s", " ", "are", " ", "descri", "bed", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "new", "Trove", "s_", "=_", "sorted_", "(_", "(_", "(_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "x_", "[_", "2_", "]_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "{_", "}_", ",_", "False_", ",_", "False_", ",_", "False_", ",_", "False_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "update", "Only_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "itertools_", "._", "chain_", "(_", "abs", "olute", "Prim", "aries", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relative", "Prim", "aries", "_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compare", " ", "on", " ", "the", " ", "string", " ", "of", " ", "the", " ", "version", ",", " ", "sinc", "e", " ", "it", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "have", " ", "timestamps_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "lambda_", "y_", ":_", "(_", "y_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "str_", "(_", "y_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", ",_", "y_", "[_", "0_", "]_", "[_", "2_", "]_", ")_", "+_", "y_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Job_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "By", "Default", "Remo", "vals_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "the", " ", "user", "-", "specified", " ", "respec", "t", " ", "branch", " ", "affinity", " ", "setti", "ng", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lost", "._", "\\u\\u\\uNL\\u\\u\\u_", "neve", "r", "Resp", "ect", "Branc", "h", "Affi", "nit", "y_", "=_", "not_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "Jobs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "new", "Trove", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "new", "Trove", "s", " ", "tuple", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", "Info", ":", " ", "the", " ", "(", "n", ",", " ", "v", ",", " ", "f", ")", " ", "of", " ", "the", " ", "trove", " ", "to", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", "Prim", "ary", ":", " ", "true", " ", "if", " ", "user", " ", "specified", " ", "this", " ", "trove", " ", "on", " ", "the", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", "Default", "Dict", ":", " ", "mapping", " ", "of", " ", "trove", " ", "tuple", " ", "to", " ", "by", "Default", " ", "setti", "ng", ",", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "specified", " ", "by", " ", "the", " ", "primary", " ", "parent", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parent", "Install", "ed", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "parent", " ", "of", " ", "this", " ", "trove", " ", "was", " ", "install", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "dete", "rmin", "e", " ", "whe", "ther", " ", "to", " ", "install", " ", "trove", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "with", " ", "weak", " ", "reference", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parent", "Replace", "d", "Wa", "s", "Pin", "ned", ":", " ", "Tru", "e", " ", "if", " ", "this", " ", "trove", "'", "s", " ", "parent", " ", "wou", "ld_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "have", " ", "replaced", " ", "a", " ", "trove", " ", "tha", "t", " ", "is", " ", "pinned", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parent", "Update", "d", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "parent", " ", "of", " ", "this", " ", "trove", " ", "was", " ", "install", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "or", " ", "update", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "primary", "Install", "ed", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "primary", " ", "tha", "t", " ", "led", " ", "to", " ", "this", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "was", " ", "an", " ", "install", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "branch", "Hint", ":", " ", " ", "if", " ", "new", "Info", "'", "s", " ", "parent", " ", "trove", " ", "switche", "d", " ", "branch", "es", ",", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "provide", "s", " ", "the", " ", "to", "/", "from", " ", "informati", "on", " ", "on", " ", "tha", "t", " ", "switch", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "If", " ", "this", " ", "child", " ", "trove", " ", "is", " ", "mak", "ing", " ", "the", " ", "same", " ", "switch", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "allow", " ", "it", " ", "even", " ", "if", " ", "the", " ", "switch", " ", "is", " ", "overrid", "ing", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "affinity", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "respec", "t", "Branc", "h", "Affi", "nit", "y", ":", " ", "If", " ", "true", ",", " ", "we", " ", "genera", "ll", "y", " ", "try", " ", "to", " ", "respec", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "the", " ", "user", "'", "s", " ", "choice", " ", "to", " ", "switch", " ", "a", " ", "trove", " ", "from", " ", "one", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "to", " ", "anot", "her", ".", " ", " ", "We", " ", "mig", "ht", " ", "not", " ", "respec", "t", " ", "branch", " ", "affinity", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "if", " ", "a", ")", " ", "a", " ", "primary", " ", "trove", " ", "update", " ", "is", " ", "overrid", "ing", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "affinity", ",", " ", "or", " ", "b", ")", " ", "the", " ", "call", " ", "to", " ", "merge", "Group", "Changes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "had", " ", "respec", "t", "Branc", "h", "Affi", "nit", "y", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "respec", "t", "Fla", "vor", "Affi", "nit", "y", ":", " ", "If", " ", "true", ",", " ", "we", " ", "genera", "ll", "y", " ", "try", " ", "to", " ", "respec", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "the", " ", "user", "'", "s", " ", "choice", " ", "to", " ", "switch", " ", "a", " ", "trove", " ", "from", " ", "one", " ", "flavor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "to", " ", "anot", "her", ".", " ", " ", "We", " ", "mig", "ht", " ", "not", " ", "respec", "t", " ", "flavor", " ", "affinity", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "for", " ", "the", " ", "same", " ", "reasons", " ", "we", " ", "mig", "ht", " ", "not", " ", "respec", "t", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "affinity", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", "Redirect", "s", ":", " ", "If", " ", "Tru", "e", ",", " ", "we", " ", "install", " ", "redirec", "ts", " ", "even", " ", "whe", "n", " ", "the", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "are", " ", "not", " ", "upgrade", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "follow", "Local", "Change", "s", ":", " ", "see", " ", "the", " ", "code", " ", "where", " ", "it", " ", "is", " ", "used", " ", "for", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "description", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "On", "ly", ":", " ", " ", "If", " ", "true", ",", " ", "only", " ", "update", " ", "trove", "s", ",", " ", "don", "'", "t", " ", "install", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "fresh", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "new", "Info_", ",_", "is", "Prim", "ary_", ",_", "by", "Default", "Dict_", ",_", "parent", "Install", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "Replace", "d", "Wa", "s", "Pin", "ned", "_", ",_", "parent", "Update", "d_", ",_", "primary", "Install", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch", "Hint_", ",_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", ",_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Redirects_", ",_", "follow", "Local", "Changes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Only_", ")_", "=_", "new", "Trove", "s_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "by", "Default_", "=_", "is", "Prim", "ary_", "or_", "by", "Default", "Dict_", "[_", "new", "Info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'''", "\\\\", "\\", "10", ";", "*******", "\\", "10", ";", "%", "s", "=", "%", "s", "[", "%", "s", "]", "\\", "10", ";", "primary", ":", " ", "%", "s", " ", " ", "by", "Default", ":", "%", "s", " ", " ", "parent", "Update", "d", ":", " ", "%", "s", " ", "parent", "Install", "ed", ":", " ", "%", "s", " ", "primary", "Install", "ed", ":", " ", "%", "s", " ", "update", "On", "ly", ":", " ", "%", "s", "\\", "10", ";", "branch", "Hint", ":", " ", "%", "s", "\\", "10", ";", "branch", "Affi", "nit", "y", ":", " ", "%", "s", " ", " ", " ", "flavor", "Affi", "nit", "y", ":", " ", "%", "s", " ", "install", "Redirect", "s", ":", " ", "%", "s", "\\", "10", ";", "follow", "Local", "Change", "s", ":", " ", "%", "s", "\\", "10", ";", "\\", "10", ";'", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Info_", "[_", "0_", "]_", ",_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ",_", "is", "Prim", "ary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "by", "Default_", ",_", "parent", "Update", "d_", ",_", "parent", "Install", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "primary", "Install", "ed_", ",_", "update", "Only_", ",_", "branch", "Hint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", ",_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Redirects_", ",_", "follow", "Local", "Changes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "v_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "Added", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "_", "=_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recurse", "Thi", "s_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "ren", "Follow", "Local", "Changes_", "=_", "alw", "ay", "s", "Follow", "Local", "Changes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pinned", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "loop", " ", "shou", "ld", " ", "only", " ", "be", " ", "call", "ed", " ", "onc", "e", " ", "-", " ", "it", "'", "s", " ", "basic", "ally", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "way", " ", "to", " ", "create", " ", "a", " ", "quick", " ", "GOT", "O", " ", "structure", ",", " ", "with", "out", " ", "need", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "call", " ", "anot", "her", " ", "function", " ", "(", "whi", "ch", " ", "wou", "ld", " ", "be", " ", "expen", "sive", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "loop", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new", "Info_", "in_", "alr", "ead", "y", "Install", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "need", " ", "to", " ", "install", " ", "it", " ", "twi", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "count", " ", "it", " ", "as", " ", "'", "adde", "d", "'", " ", "for", " ", "the", " ", "purpose", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "ther", " ", "or", " ", "not", " ", "to", " ", "recurse_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "Added", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "alr", "ead", "y", " ", "install", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "new", "Info_", "in_", "ine", "lig", "ible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "ine", "lig", "ibl", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "new", "Info_", "in_", "alr", "ead", "y", "Reference", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "new", " ", "trove", " ", "in", " ", "alr", "ead", "y", "Reference", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "meaning", ":", " ", "this", " ", "trove", " ", "is", " ", "referenced", " ", "by", " ", "something_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", "ed", ",", " ", "but", " ", "is", " ", "not", " ", "install", "ed", " ", "its", "elf", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "Prim", "ary_", "or_", "install", "Missing", "Refs", "_", "or_", "primary", "Install", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "y", " ", "reall", "y", " ", "want", " ", "it", " ", "install", "ed", " ", "this", " ", "time", ".", " ", "We", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "entry", " ", "from", " ", "the", " ", "alr", "ead", "y", "-", "install", "ed", " ", "@", "update", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "local", "Update", "s", " ", "alr", "ead", "y", " ", "tell", "s", " ", "us", " ", "the", " ", "best", " ", "match", " ", "for", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parent", "Update", "d_", "and_", "new", "Info_", "in_", "referenced", "Wea", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "only", " ", "link", " ", "to", " ", "this", " ", "trove", " ", "is", " ", "a", " ", "weak", " ", "reference", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "weak", "-", "only", " ", "reference", " ", "means", " ", "an", " ", "intermediate", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "was", " ", "missi", "ng", ".", " ", " ", "Bu", "t", " ", "parent", "Update", "d", " ", "say", "s", " ", "we", "'", "ve", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", " ", "an", " ", "intermediate", " ", "trove", ",", " ", "so", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "trove", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "alr", "ead", "y", " ", "know", " ", "abo", "ut", " ", "this", " ", "trove", ",", " ", "and", " ", "decide", "d", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "want", " ", "it", ".", " ", "We", " ", "do", " ", "want", " ", "to", " ", "keep", " ", "the", " ", "item", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replaced", " ", "it", " ", "tho", "ugh", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "new", "Info_", "in_", "local", "Update", "s", "By", "Missing", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "=_", "(_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "local", "Update", "s", "By", "Missing", "_", "[_", "new", "Info_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "Install", "ed_", "._", "add_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "local", " ", "update", " ", "-", " ", "marking", " ", "presen", "t", " ", "part", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "as", " ", "alr", "ead", "y", " ", "install", "ed", "'_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "alr", "ead", "y", " ", "referenced", "'_", ")_", "\\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_", "replaced", "_", ",_", "pinned", "_", "=_", "job", "By", "New_", "[_", "new", "Info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "Info_", "=_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", "replaced", "_", "[_", "0_", "]_", ",_", "replaced", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "replace", "s", ":", " ", "%", "s", "'_", ",_", "replaced", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "new", "Info_", "in_", "alr", "ead", "y", "Reference", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "section", " ", "is", " ", "the", " ", "corr", "ola", "ry", " ", "to", " ", "the", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "above", ".", " ", " ", "We", " ", "only", " ", "enter", " ", "here", " ", "if", " ", "we", "'", "ve", " ", "decide", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "install", " ", "this", " ", "trove", " ", "even", " ", "tho", "ugh", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alr", "ead", "y", " ", "referenced", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "replaced", "Info_", "in_", "referenced", "Not", "Install", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "allow", " ", "this", " ", "trove", " ", "to", " ", "not", " ", "be", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "the", " ", "trove", " ", "its", " ", "repla", "cing", " ", "is", " ", "not", " ", "install", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "an", " ", "install", "ed", " ", "update", " ", "or", " ", "just", " ", "install", " ", "the", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fresh", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "replaced", "_", "=_", "local", "Update", "s", "By", "Missing", "_", "._", "get_", "(_", "replaced", "Info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "Info_", "=_", "(_", "replaced", "Info_", "[_", "0_", "]_", ",_", "replaced", "_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replaced", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "replaced", " ", "is", " ", "not", " ", "install", "ed", ",", " ", "usi", "ng", " ", "local", " ", "update", " ", "%", "s", " ", "inst", "ead", "'_", ",_", "replaced", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "follow", "ing", " ", "local", " ", "change", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "ren", "Follow", "Local", "Changes_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "Jobs_", "[_", "replaced", "Info_", "]_", "=_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pinned", "_", "=_", "self_", "._", "db_", "._", "trove", "s", "Are", "Pin", "ned", "_", "(_", "[_", "replaced", "Info_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "replaced", "Info_", "in_", "referenced", "Not", "Install", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "trove", " ", "on", " ", "the", " ", "local", " ", "system", " ", "is", " ", "one", " ", "tha", "t", "'", "s", " ", "referenced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "not", " ", "install", "ed", ",", " ", "so", ",", " ", "normal", "ly", " ", "we", " ", "wou", "ld", " ", "not", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "trove", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUT", " ", "if", " ", "this", " ", "is", " ", "a", " ", "primary", " ", "(", "or", " ", "in", " ", "cert", "ain", " ", "other", " ", "case", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "alw", "ay", "s", " ", "want", " ", "to", " ", "have", " ", "the", " ", "update", " ", "happ", "en", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "the", " ", "case", " ", "of", " ", "a", " ", "primary", " ", "trove", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "referenced", " ", "trove", " ", "is", " ", "replaced", " ", "by", " ", "anot", "her", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "the", " ", "system", " ", "(", "by", " ", "a", " ", "local", "Update", ")", " ", "then", " ", "we", " ", "remove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "trove", " ", "inst", "ead", ".", " ", " ", "If", " ", "not", ",", " ", "we", " ", "just", " ", "install", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "as", " ", "a", " ", "fresh", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "replaced", " ", "trove", " ", "is", " ", "not", " ", "install", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "follow", "Local", "Changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip", "Local_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "install", "Missing", "Refs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip", "Local_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "parent", "Install", "ed_", "and_", "not_", "parent", "Replace", "d", "Wa", "s", "Pin", "ned", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip", "Local_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "replaced", "Info_", "not_", "in_", "local", "Erase", "s_", "and_", "not_", "parent", "Replace", "d", "Wa", "s", "Pin", "ned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip", "Local_", "=_", "False_", "\\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 ", " ", " _", "skip", "Local_", "=_", "True_", "\\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_", "skip", "Local_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "follow", "Local", "Change", "s", " ", "state", "s", " ", "tha", "t", ",", " ", "even", " ", "tho", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "give", "n", " ", "trove", " ", "is", " ", "not", " ", "a", " ", "primary", ",", " ", "we", " ", "still", " ", "want_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", " ", "a", " ", "local", "Update", " ", "if", " ", "avail", "able", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "skip", "ping", " ", "the", " ", "update", ".", " ", " ", "Thi", "s", " ", "flag", " ", "can", " ", "be", " ", "set", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", ")", " ", "an", " ", "ancestor", " ", "of", " ", "this", " ", "trove", " ", "is", " ", "a", " ", "primary", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "switche", "d", " ", "from", " ", "a", " ", "referenced", "Not", "Install", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "an", " ", "install", "ed", " ", "trove", " ", "or", " ", "b", ")", " ", "its", " ", "pass", "ed", " ", "in", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "function", " ", "tha", "t", " ", "we", " ", "\\u", "alw", "ay", "s", "\\u", " ", "follow", " ", "local_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "not", " ", "follow", "ing", " ", "local", " ", "change", "s", "'_", ")_", "\\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_", "fresh", "Install", "Ok", "ay_", "=_", "(_", "is", "Prim", "ary_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "parent", "Install", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "parent", "Replace", "d", "Wa", "s", "Pin", "ned", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "by", "Default_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "install", "Missing", "Refs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "alw", "ay", "s", " ", "want", " ", "to", " ", "install", " ", "the", " ", "trove", " ", "even", " ", "if", " ", "there", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "local", " ", "update", " ", "to", " ", "match", " ", "to", " ", "if", " ", "it", "'", "s", " ", "a", " ", "primary", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "trove", "'", "s", " ", "parent", " ", "was", " ", "just", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "if", " ", "the", " ", "parent", " ", "was", " ", "install", "ed", ",", " ", "we", " ", "just", " ", "adde", "d", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "strong", " ", "reference", ",", " ", "whi", "ch", " ", "override", "s", " ", "any", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", "s", " ", "tha", "t", " ", "mig", "ht", " ", "suggest", " ", "not", " ", "to", " ", "install", " ", "it", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "replaced", "_", "=_", "local", "Update", "s", "By", "Missing", "_", "._", "get_", "(_", "replaced", "Info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "replaced", "_", "[_", "0_", "]_", "is_", "None_", "and_", "not_", "fresh", "Install", "Ok", "ay_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "not", " ", "allow", "ing", " ", "fresh", " ", "install", "'_", ")_", "\\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_", "child", "ren", "Follow", "Local", "Changes_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "replaced", "Info_", "=_", "(_", "replaced", "Info_", "[_", "0_", "]_", ",_", "replaced", "_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replaced", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "Jobs_", "[_", "replaced", "Info_", "]_", "=_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pinned", "_", "=_", "self_", "._", "db_", "._", "trove", "s", "Are", "Pin", "ned", "_", "(_", "[_", "replaced", "Info_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "usi", "ng", " ", "local", " ", "update", " ", "to", " ", "replace", " ", "%", "s", ",", " ", "follow", "ing", " ", "local", " ", "change", "s", "'_", ",_", "replaced", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "install", "Redirects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "redirec", "t", "Hack", "_", "._", "get_", "(_", "new", "Info_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "parent", " ", "redirec", "t", " ", "was", " ", "adde", "d", " ", "as", " ", "an", " ", "upgrade_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "this", " ", "wou", "ld", " ", "be", " ", "a", " ", "new", " ", "install", " ", "of", " ", "this", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", ".", " ", " ", "Ski", "p", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "is", " ", "a", " ", "redirec", "t", " ", "tha", "t", " ", "wou", "ld", " ", "be", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "a", " ", "fresh", " ", "install", ",", " ", "but", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "install", "Redirect", "s", "=", "Fal", "se", "'_", ")_", "\\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_", "elif_", "redirec", "t", "Hack", "_", "._", "get_", "(_", "new", "Info_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "up", "gradi", "ng", " ", "a", " ", "redirec", "t", ",", " ", "so", " ", "don", "'", "t", " ", "allow", " ", "any", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redirec", "ts", " ", "to", " ", "be", " ", "install", "ed", " ", "unl", "ess", " ", "the", "y", " ", "have", " ", "a", " ", "matching_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "to", " ", "redirec", "t", " ", "on", " ", "the", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "INSTA", "LL", ":", " ", "up", "gradi", "ng", " ", "redirec", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Redirects_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", "and_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "checking", " ", "branch", " ", "affinity", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "branch", " ", "affinity", " ", "checks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Branch_", "=_", "new", "Info_", "[_", "1_", "]_", "._", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "ed", "Branch_", "=_", "replaced", "Info_", "[_", "1_", "]_", "._", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "replaced", "Info_", "in_", "local", "Update", "s", "By", "Present_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "not", "Install", "ed", "Ver", "_", "=_", "local", "Update", "s", "By", "Present_", "[_", "replaced", "Info_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "Install", "ed", "Branch_", "=_", "not", "Install", "ed", "Ver", "_", "._", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "alr", "ead", "y", "Branc", "h", "Switch", " ", "variab", "le", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reada", "bility_", "\\u\\u\\uNL\\u\\u\\u_", "alr", "ead", "y", "Branc", "h", "Switch_", "=_", "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 ", " ", " _", "not", "Install", "ed", "Branch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "Branc", "h", "Switch_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "there", "'", "s", " ", "reason", " ", "to", " ", "be", " ", "concern", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abo", "ut", " ", "branch", " ", "affinity", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "install", "ed", "Branch_", "==_", "new", "Branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "not", " ", "branch", " ", "switch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "did", "n", "'", "t", " ", "switch", " ", "branch", "es", ".", " ", " ", "No", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "affinity", " ", "concern", "s", ".", " ", " ", "If", " ", "the", " ", "user", " ", "has", " ", "made", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "local", " ", "change", " ", "tha", "t", " ", "wou", "ld", " ", "make", " ", "this", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", " ", "a", " ", "down", "grade", ",", " ", "skip", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "is", "Prim", "ary_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "new", "Info_", "[_", "1_", "]_", "<_", "replaced", "_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "replaced", "Info_", "in_", "same", "Branc", "h", "Local", "Update", "s_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "replaced", "Info_", "in_", "primary", "Local", "Update", "s_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "not_", "parent", "Update", "d_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "avoid", "ing", " ", "down", "grade", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "let", " ", "this", " ", "trove", " ", "be", " ", "erase", "d", ",", " ", "pretend_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "like", " ", "it", " ", "was", " ", "explicit", "ly", " ", "request", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "alr", "ead", "y", "Install", "ed_", "._", "add_", "(_", "replaced", "Info_", ")_", "\\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_", "elif_", "not", "Install", "ed", "Branch_", "==_", "install", "ed", "Branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "INSTA", "LL", ":", " ", "branch", " ", "switch", " ", "is", " ", "reversi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "revert", "ing", " ", "back", " ", "to", " ", "the", " ", "branch", " ", "we", " ", "wer", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "bef", "ore", ".", " ", " ", "We", " ", "don", "'", "t", " ", "wor", "ry", " ", "abo", "ut", " ", "down", "grades", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "we", "'", "re", " ", "alr", "ead", "y", " ", "overrid", "ing", " ", "the", " ", "user", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "branch", " ", "choice_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\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_", "._", "low", "level_", "(_", "'", "is", " ", "a", " ", "new", " ", "branch", " ", "switch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ei", "ther", " ", "a", ")", " ", "we", "'", "ve", " ", "made", " ", "a", " ", "local", " ", "change", " ", "from", " ", "branch", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "branch", " ", "2", " ", "and", " ", "now", " ", "we", "'", "re", " ", "updat", "ing", " ", "to", " ", "branch", " ", "3", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "b", ")", " ", "there", "'", "s", " ", "no", " ", "local", " ", "change", " ", "but", " ", "we", "'", "re", " ", "switching", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "branch", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", "ly", ",", " ", "we", " ", "respec", "t", " ", "branch", " ", "affinity", " ", "and", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "branch", " ", "switche", "s", ".", " ", " ", "There", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "a", " ", "few", " ", "exception", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "Prim", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "user", " ", "explicit", "ly", " ", "ask", "ed", " ", "to", " ", "switch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "this", " ", "branch", ",", " ", "so", " ", "we", " ", "have", " ", "to", " ", "honor", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "alr", "ead", "y", "Branc", "h", "Switch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "turns", " ", "out", " ", "the", " ", "\\u", "current", "\\u", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "is", " ", "a", " ", "local", " ", "change", ".", " ", " ", "The", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "mess", "ing", " ", "with", " ", "branch", "es", " ", "too", " ", "muc", "h", " ", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "bot", "her", " ", "with", " ", "branch", " ", "affinity", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "respec", "t", "Branc", "h", "Affi", "nit", "y_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "low", "level_", "(_", "'", "INSTA", "LL", ":", " ", "is", " ", "a", " ", "branch", " ", "switch", " ", "on", " ", "top", " ", "of", " ", "a", " ", "branch", " ", "switch", " ", "and", " ", "is", " ", "primary", "'_", ")_", "\\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_", "._", "low", "level_", "(_", "'", "INSTA", "LL", ":", " ", "is", " ", "a", " ", "new", " ", "branch", " ", "switch", " ", "and", " ", "is", " ", "primary", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "install", "ed", "Branch_", ",_", "new", "Branch_", ")_", "==_", "branch", "Hint_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Except", "ion", ":", " ", "if", " ", "the", " ", "parent", " ", "trove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "made", " ", "this", " ", "move", ",", " ", "then", " ", "allow", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "INSTA", "LL", ":", " ", "matche", "s", " ", "parent", "\\\\'", "s", " ", "branch", " ", "switch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "(_", "replaced", "Info_", "in_", "install", "ed", "And", "Reference", "d_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "replaced", "Info_", "in_", "same", "Branc", "h", "Local", "Update", "s_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "alr", "ead", "y", "Branc", "h", "Switch_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "parent", "Update", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Except", "ion", ":", " ", "The", " ", "user", " ", "has", " ", "not", " ", "switche", "d", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", "'", "s", " ", "branch", " ", "explicit", "ly", ",", " ", "and", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "have", " ", "an", " ", "implicit", " ", "request", " ", "to", " ", "switch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "branch", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "INSTA", "LL", ":", " ", "implicit", " ", "branch", " ", "switch", ",", " ", "parent", " ", "install", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "not", " ", "install", "ing", " ", "this", " ", "trove", " ", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "doe", "sn", "'", "t", " ", "match", " ", "any", " ", "of", " ", "our", " ", "exception", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "coul", "d", " ", "be", " ", "tha", "t", " ", "it", "'", "s", " ", "a", " ", "trove", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "reference", "s", " ", "to", " ", "it", " ", "on", " ", "the", " ", "system_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "and", " ", "so", " ", "a", " ", "branch", " ", "switch", " ", "wou", "ld", " ", "be", " ", "stran", "ge", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "it", " ", "coul", "d", " ", "be", " ", "tha", "t", " ", "it", " ", "is", " ", "a", " ", "switch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "a", " ", "third", " ", "branch", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "we", "'", "re", " ", "reject", "ing", " ", "the", " ", "update", " ", "due", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "branch", " ", "affinity", ",", " ", "we", " ", "don", "'", "t", " ", "consider", " ", "any", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "child", " ", "trove", "s", " ", "for", " ", "update", "s", " ", "eit", "her", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "not", " ", "install", "ing", " ", "branch", " ", "switch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recurse", "Thi", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "Install", "ed_", "._", "add_", "(_", "replaced", "Info_", ")_", "\\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_", "if_", "replaced", "_", "[_", "0_", "]_", "and_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "replaced", "Info_", "in_", "local", "Update", "s", "By", "Present_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "not", "Install", "ed", "Flavor_", "=_", "local", "Update", "s", "By", "Present_", "[_", "replaced", "Info_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "alr", "ead", "y", "Branc", "h", "Switch", " ", "variab", "le", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reada", "bility_", "\\u\\u\\uNL\\u\\u\\u_", "#", "alr", "ead", "y", "Fla", "vor", "Switch", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "replaced", "Info_", "in_", "same", "Branc", "h", "Local", "Update", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "not", "Install", "ed", "Flavor_", "=_", "same", "Branc", "h", "Local", "Update", "s_", "[_", "replaced", "Info_", "]_", "[_", "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 ", " ", " _", "not", "Install", "ed", "Flavor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not", "Install", "ed", "Flavor_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "deps_", "._", "compatible", "Fla", "vor", "s_", "(_", "not", "Install", "ed", "Flavor_", ",_", "replaced", "Info_", "[_", "2_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "deps_", "._", "compatible", "Fla", "vor", "s_", "(_", "replaced", "Info_", "[_", "2_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "is", "Prim", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", "=_", "False_", "\\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_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "Not", " ", "revert", "ing", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "incomp", "atible", " ", "flavor", " ", "switch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recurse", "Thi", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alr", "ead", "y", "Install", "ed_", "._", "add_", "(_", "replaced", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "belo", "w", " ", "are", " ", "checks", " ", "to", " ", "see", " ", "if", " ", "a", " ", "fresh", " ", "install", " ", "shou", "ld", " ", "complete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "its", " ", "possib", "le", " ", "tha", "t", " ", "an", " ", "update", " ", "from", " ", "above", " ", "coul", "d", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", "ed", " ", "int", "o", " ", "a", " ", "fresh", " ", "install", ",", " ", "we", " ", "start", " ", "a", " ", "new", " ", "if", "/", "elif_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "branch", " ", "here", "._", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "deal", "ing", " ", "with", " ", "a", " ", "replace", "ment", ",", " ", "we", "'", "ve", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "decide", "d", " ", "it", " ", "was", " ", "oka", "y", " ", "above", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "by", "Default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "trove", " ", "is", " ", "bei", "ng", " ", "newl", "y", " ", "install", "ed", ",", " ", "but", " ", "it", "'", "s", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "supposed", " ", "to", " ", "be", " ", "install", "ed", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "not", " ", "doi", "ng", " ", "not", "-", "by", "-", "default", " ", "fresh", " ", "install", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "update", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "not", " ", "install", "ing", " ", "trove", ",", " ", "only", " ", "updat", "ing", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "not", " ", "doi", "ng", " ", "install", " ", "due", " ", "to", " ", "update", "On", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "is", "Prim", "ary_", "and_", "self_", "._", "cfg_", "._", "exclu", "de", "Trove", "s_", "._", "match_", "(_", "new", "Info_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "trove", " ", "matche", "s", " ", "exclu", "de", "Trove", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "trove", " ", "matche", "s", " ", "exclu", "de", "Trove", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "install", "Redirects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "redirec", "t", "Hack", "_", "._", "get_", "(_", "new", "Info_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "parent", " ", "redirec", "t", " ", "was", " ", "adde", "d", " ", "as", " ", "an", " ", "upgrade_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "this", " ", "wou", "ld", " ", "be", " ", "a", " ", "new", " ", "install", " ", "of", " ", "this", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", ".", " ", " ", "Ski", "p", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "redirec", "t", " ", "wou", "ld", " ", "be", " ", "a", " ", "fresh", " ", "install", "'_", ")_", "\\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_", "elif_", "redirec", "t", "Hack", "_", "._", "get_", "(_", "new", "Info_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "up", "gradi", "ng", " ", "a", " ", "redirec", "t", ",", " ", "so", " ", "don", "'", "t", " ", "allow", " ", "any", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redirec", "ts", " ", "to", " ", "be", " ", "install", "ed", " ", "unl", "ess", " ", "the", "y", " ", "have", " ", "a", " ", "matching_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "to", " ", "redirec", "t", " ", "on", " ", "the", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "low", "level_", "(_", "'", "install", "ing", " ", "redirec", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Redirects_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job_", "=_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", "replaced", "_", ",_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pinned", "_", "and_", "(_", "not_", "is", "Prim", "ary_", "or_", "check", "Prim", "ary", "Pins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job_", "=_", "self_", "._", "\\u", "split", "Pin", "ned", "Job_", "(_", "u", "Job_", ",_", "trove", "Source_", ",_", "job_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force_", "=_", "not_", "is", "Prim", "ary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recurse", "Thi", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "not_", "is", "Prim", "ary_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "cfg_", "._", "exclu", "de", "Trove", "s_", "._", "match_", "(_", "new", "Info_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "New", " ", "trove", " ", "matche", "s", " ", "exclu", "de", "Trove", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "log_", "._", "low", "level_", "(_", "'", "SKIP", ":", " ", "trove", " ", "matche", "s", " ", "exclu", "de", "Trove", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recurse", "Thi", "s_", "=_", "False_", "\\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_", "log_", "._", "low", "level_", "(_", "'", "JOB", " ", "ADD", "ED", ":", " ", "%", "s", "'_", ",_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Job_", "._", "add_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "Added", "_", "=_", "True_", "\\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_", "log_", "._", "low", "level_", "(_", "'", "recurse", "Thi", "s", ":", " ", "%", "s", "\\\\", "nre", "curse", ":", " ", "%", "s", "'_", ",_", "recurse", "Thi", "s_", ",_", "recurse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "job", "Added", "_", "and_", "remove", "Not", "By", "Default_", "and_", "not_", "by", "Default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", "replaced", "_", ",_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Job_", "._", "discard_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "not", "By", "Default", "Remo", "vals_", "._", "add_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", "replaced", "_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "new", "Info_", "in_", "alr", "ead", "y", "Install", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "not", "By", "Default", "Remo", "vals_", "._", "add_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "new", "Info_", "[_", "0_", "]_", ",_", "(_", "new", "Info_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "None_", ")_", ",_", "False_", ")_", ")_", "\\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_", "recurse", "Thi", "s_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "recurse_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "trove_", "._", "trove", "Is", "Collection_", "(_", "new", "Info_", "[_", "0_", "]_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "branch", "Hint_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", "and_", "replaced", "_", "[_", "0_", "]_", "._", "branch_", "(_", ")_", "==_", "new", "Info_", "[_", "1_", "]_", "._", "branch_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "this", " ", "trove", " ", "did", "n", "'", "t", " ", "switch", " ", "branch", "es", ",", " ", "then", " ", "we", " ", "respec", "t", " ", "branch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "affinity", " ", "for", " ", "all", " ", "child", " ", "trove", "s", " ", "even", " ", "the", " ", "primary", " ", "trove", " ", "above", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "did", " ", "switch", ".", " ", " ", "We", " ", "assume", " ", "the", " ", "user", " ", "at", " ", "some", " ", "point", " ", "switche", "d", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", " ", "to", " ", "the", " ", "desi", "red", " ", "branch", " ", "by", " ", "hand", " ", "alr", "ead", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "low", "level_", "(_", "'", "respec", "ting", " ", "branch", " ", "affinity", " ", "for", " ", "child", "ren", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "neve", "r", "Resp", "ect", "Branc", "h", "Affi", "nit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "replaced", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch", "Hint_", "=_", "(_", "replaced", "_", "[_", "0_", "]_", "._", "branch_", "(_", ")_", ",_", "new", "Info_", "[_", "1_", "]_", "._", "branch_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "replaced", "_", "[_", "0_", "]_", "and_", "deps_", "._", "compatible", "Fla", "vor", "s_", "(_", "replaced", "_", "[_", "1_", "]_", ",_", "new", "Info_", "[_", "2_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "low", "level_", "(_", "'", "respec", "ting", " ", "flavor", " ", "affinity", " ", "for", " ", "child", "ren", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tr", "v_", "is_", "None_", ":_", "\\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 ", " ", "_", "tr", "v_", "=_", "trove", "Source_", "._", "get", "Trove", "_", "(_", "with", "Files_", "=_", "False_", ",_", "*_", "new", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Trove", "Missing", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "db_", "._", "has", "Trove", "_", "(_", "*_", "new", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tr", "v_", "=_", "self_", "._", "db_", "._", "get", "Trove", "_", "(_", "with", "Files_", "=_", "False_", ",_", "*_", "new", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "possib", "le", " ", "tha", "t", " ", "the", " ", "trove", " ", "source", " ", "we", "'", "re", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "s", " ", "reference", "s", " ", "to", " ", "trove", "s", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "actual", "ly", " ", "contain", ".", " ", " ", "Tha", "t", "'", "s", " ", "oka", "y", " ", "as", " ", "long", " ", "as", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exclu", "ded", " ", "trove", " ", "is", " ", "not", " ", "actual", "ly", " ", "try", "ing", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "job", "Added", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\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 ", " ", " _", "continue_", "\\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_", "is", "Prim", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "by", "Default", " ", "status", " ", "of", " ", "trove", "s", " ", "is", " ", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "primary_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trove", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "by", "Default", "Dict_", "=_", "dict_", "(_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", ")_", "for_", "x_", "in_", "tr", "v_", "._", "iter", "Trove", "List", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "Only_", "=_", "update", "Only_", "or_", "not_", "job", "Added", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "all", " ", "child", "ren", ",", " ", "we", " ", "only", " ", "want", " ", "to", " ", "install", " ", "them", " ", "as", " ", "new", " ", "\\u", "if", "\\u", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", "ed", " ", "thei", "r", " ", "parent", ".", " ", " ", "If", " ", "we", " ", "did", " ", "not", " ", "install", "/", "upgrade", " ", "foo", ",", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "do", " ", "not", " ", "install", " ", "foo", ":", "runt", "ime", " ", "(", "tho", "ugh", " ", "if", " ", "it", "'", "s", " ", "install", "ed", ",", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "reason", "able", " ", "to", " ", "upgrade", " ", "it", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "Prim", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "primary", "Install", "ed_", "=_", "job", "Added", "_", "and_", "not_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "Install_", "=_", "primary", "Install", "ed_", "or_", "(_", "job", "Added", "_", "and_", "not_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "info_", "in_", "sorted_", "(_", "tr", "v_", "._", "iter", "Trove", "List_", "(_", "strong", "Refs", "_", "=_", "True_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "Prim", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "job", "Added", "_", "and_", "info_", "not_", "in_", "by", "Default", "Dict_", ":_", "\\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_", "#", " ", "support", " ", "old", "-", "style", " ", "collection", "s", ".", " ", " ", "\\u", "If", "\\u", " ", "this", " ", "trove", " ", "was", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mentioned", " ", "in", " ", "its", " ", "parent", " ", "trove", ",", " ", "then", " ", "set", " ", "its", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child", "By", "Default_", "=_", "(_", "tr", "v_", "._", "include", "Trove", "By", "Default_", "(_", "*_", "info_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "job", "Added", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "by", "Default", "Dict_", "._", "setdefault_", "(_", "info_", ",_", "child", "By", "Default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Trove", "s_", "._", "append_", "(_", "(_", "info_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "by", "Default", "Dict_", ",_", "job", "Install_", ",_", "pinned", "_", ",_", "job", "Added", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "primary", "Install", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch", "Hint_", ",_", "respec", "t", "Branc", "h", "Affi", "nit", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "respec", "t", "Fla", "vor", "Affi", "nit", "y_", ",_", "install", "Redirects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "child", "ren", "Follow", "Local", "Changes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Only_", ")_", ")_", "\\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", "filter", "Doub", "le", "Remove", "s", "Du", "e", "To", "Local", "Update", "s_", "(_", "new", "Job_", ",_", "replaced", "Jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "job_", "in_", "not", "By", "Default", "Remo", "vals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "job_", "not_", "in_", "new", "Job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "erase", "Prim", "aries", "_", "._", "add_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alr", "ead", "y", "Install", "ed_", "._", "discard_", "(_", "(_", "job_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "0_", "]_", ",_", "job_", "[_", "1_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "items", " ", "whi", "ch", " ", "wer", "e", " ", "update", "d", " ", "to", " ", "redirec", "ts", " ", "shou", "ld", " ", "be", " ", "remove", "d", ",", " ", "no", " ", "matte", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "info_", "in_", "set_", "(_", "itertools_", "._", "chain_", "(_", "*_", "redirec", "t", "Hack", "_", "._", "values_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "erase", "Prim", "aries", "_", "._", "add_", "(_", "(_", "info_", "[_", "0_", "]_", ",_", "(_", "info_", "[_", "1_", "]_", ",_", "info_", "[_", "2_", "]_", ")_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "erase", "Set_", "=_", "\\u", "find", "Er", "asu", "res_", "(_", "erase", "Prim", "aries", "_", ",_", "new", "Job_", ",_", "alr", "ead", "y", "Install", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recurse_", ",_", "ine", "lig", "ible_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "[_", "x_", "for_", "x_", "in_", "new", "Job_", "if_", "x_", "[_", "2_", "]_", "[_", "0_", "]_", "is_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Job_", "._", "update_", "(_", "erase", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "Job_", "\\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,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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 ]
Unreachable code
JoelBender/bacpypes/samples/ReadWriteFile.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"\nReadWriteFile.py\n\nThis application presents a 'console' prompt to the user asking for commands.\n\nThe 'readrecord' and 'writerecord' commands are used with record oriented files,\nand the 'readstream' and 'writestream' commands are used with stream oriented \nfiles.\n\"\"\"\n\nimport sys\n\nfrom bacpypes.debugging import bacpypes_debugging, ModuleLogger\nfrom bacpypes.consolelogging import ConfigArgumentParser\nfrom bacpypes.consolecmd import ConsoleCmd\n\nfrom bacpypes.core import run\n\nfrom bacpypes.pdu import Address\nfrom bacpypes.app import LocalDeviceObject, BIPSimpleApplication\n\nfrom bacpypes.apdu import Error, AbortPDU, \\\n AtomicReadFileRequest, \\\n AtomicReadFileRequestAccessMethodChoice, \\\n AtomicReadFileRequestAccessMethodChoiceRecordAccess, \\\n AtomicReadFileRequestAccessMethodChoiceStreamAccess, \\\n AtomicReadFileACK, \\\n AtomicWriteFileRequest, \\\n AtomicWriteFileRequestAccessMethodChoice, \\\n AtomicWriteFileRequestAccessMethodChoiceRecordAccess, \\\n AtomicWriteFileRequestAccessMethodChoiceStreamAccess, \\\n AtomicWriteFileACK\nfrom bacpypes.basetypes import ServicesSupported\n\n# some debugging\n_debug = 0\n_log = ModuleLogger(globals())\n\n# reference a simple application\nthis_application = None\n\n#\n# TestApplication\n#\n\n\n#\n# TestConsoleCmd\n#\n\n\n#\n# __main__\n#\n\ntry:\n # parse the command line arguments\n args = ConfigArgumentParser(description=__doc__).parse_args()\n\n if _debug: _log.debug(\"initialization\")\n if _debug: _log.debug(\" - args: %r\", args)\n\n # make a device object\n this_device = LocalDeviceObject(\n objectName=args.ini.objectname,\n objectIdentifier=int(args.ini.objectidentifier),\n maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),\n segmentationSupported=args.ini.segmentationsupported,\n vendorIdentifier=int(args.ini.vendoridentifier),\n )\n\n # make a simple application\n this_application = TestApplication(this_device, args.ini.address)\n\n # get the services supported\n services_supported = this_application.get_services_supported()\n if _debug: _log.debug(\" - services_supported: %r\", services_supported)\n\n # let the device object know\n this_device.protocolServicesSupported = services_supported.value\n\n # make a console\n this_console = TestConsoleCmd()\n\n _log.debug(\"running\")\n\n run()\n\nexcept Exception, e:\n _log.exception(\"an error has occurred: %s\", e)\nfinally:\n _log.debug(\"finally\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "_log.debug(\"initialization\")", "start_line": 235, "start_column": 15, "end_line": 235, "end_column": 43 }, { "span": "_log.debug(\" - args: %r\", args)", "start_line": 236, "start_column": 15, "end_line": 236, "end_column": 49 }, { "span": "_log.debug(\" - services_supported: %r\", services_supported)", "start_line": 252, "start_column": 15, "end_line": 252, "end_column": 77 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Read", "Write", "File", ".", "py", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "applica", "tion", " ", "presen", "ts", " ", "a", " ", "'", "console", "'", " ", "prompt", " ", "to", " ", "the", " ", "user", " ", "ask", "ing", " ", "for", " ", "command", "s", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "'", "read", "record", "'", " ", "and", " ", "'", "writer", "ecor", "d", "'", " ", "command", "s", " ", "are", " ", "used", " ", "with", " ", "record", " ", "orient", "ed", " ", "files", ",", "\\", "10", ";", "and", " ", "the", " ", "'", "reads", "tream", "'", " ", "and", " ", "'", "writes", "tream", "'", " ", "command", "s", " ", "are", " ", "used", " ", "with", " ", "stream", " ", "orient", "ed", " ", "\\", "10", ";", "files", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "debugg", "ing_", "import_", "bac", "pype", "s", "\\u", "debugg", "ing_", ",_", "Modul", "e", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "logging_", "import_", "Config", "Arg", "ument", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "cmd_", "import_", "Cons", "ole", "Cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "core_", "import_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "pdu_", "import_", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "app_", "import_", "Local", "Dev", "ice", "Object_", ",_", "BI", "PS", "impl", "e", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "apd", "u_", "import_", "Error_", ",_", "Abo", "rt", "PD", "U_", ",_", "Atom", "ic", "Read", "File", "Request_", ",_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choice_", ",_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Record", "Access_", ",_", "Atom", "ic", "Read", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Stream", "Access_", ",_", "Atom", "ic", "Read", "File", "ACK_", ",_", "Atom", "ic", "Write", "File", "Request_", ",_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choice_", ",_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Record", "Access_", ",_", "Atom", "ic", "Write", "File", "Request", "Access", "Meth", "od", "Choi", "ce", "Stream", "Access_", ",_", "Atom", "ic", "Write", "File", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "basetype", "s_", "import_", "Service", "s", "Supported_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "debug_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "log_", "=_", "Modul", "e", "Logger_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", " ", "a", " ", "simple", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Test", "Application_", "\\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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Test", "Cons", "ole", "Cmd_", "\\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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\\u\\u", "main\\u\\u_", "\\u\\u\\uNL\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "the", " ", "command", " ", "line", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "Config", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\\u\\u", "doc\\u\\u_", ")_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", "initialization", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "args", ":", " ", "%", "r", "\"_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "device", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "=_", "Local", "Dev", "ice", "Object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Name_", "=_", "args_", "._", "ini_", "._", "object", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Identifier_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "objectid", "enti", "fier", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "Ap", "du", "Length", "Accept", "ed_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "maxa", "pdu", "length", "accepted_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "segmentation", "Supported_", "=_", "args_", "._", "ini_", "._", "segmentation", "supported_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vendor", "Identifier_", "=_", "int_", "(_", "args_", "._", "ini_", "._", "vendor", "identifier_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "simple", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "application_", "=_", "Test", "Application_", "(_", "this", "\\u", "device_", ",_", "args_", "._", "ini_", "._", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "service", "s", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "service", "s", "\\u", "supported_", "=_", "this", "\\u", "application_", "._", "get", "\\u", "service", "s", "\\u", "supported_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "service", "s", "\\u", "support", "ed", ":", " ", "%", "r", "\"_", ",_", "service", "s", "\\u", "supported_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", " ", "the", " ", "device", " ", "object", " ", "know", "_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "device_", "._", "protoc", "ol", "Service", "s", "Supported_", "=_", "service", "s", "\\u", "supported_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "console_", "\\u\\u\\uNL\\u\\u\\u_", "this", "\\u", "console_", "=_", "Test", "Cons", "ole", "Cmd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "log_", "._", "debug_", "(_", "\"", "runn", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log_", "._", "exception_", "(_", "\"", "an", " ", "error", " ", "has", " ", "occur", "red", ":", " ", "%", "s", "\"_", ",_", "e_", ")_", "\\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 ", " _", "\\u", "log_", "._", "debug_", "(_", "\"", "final", "ly", "\"_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ekzhu/datasketch/test/minhash_test.py
[ { "content": " def test_update(self):\n m1 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m1.update(12)\n for i in range(4):\n self.assertTrue(m1.hashvalues[i] < m2.hashvalues[i])", "metadata": "root.TestMinHash.test_update", "header": "['class', 'TestMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def test_jaccard(self):\n m1 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2 = minhash.MinHash(4, 1, hashobj=FakeHash)\n self.assertTrue(m1.jaccard(m2) == 1.0)\n m2.update(12)\n self.assertTrue(m1.jaccard(m2) == 0.0)\n m1.update(13)\n self.assertTrue(m1.jaccard(m2) < 1.0)", "metadata": "root.TestMinHash.test_jaccard", "header": "['class', 'TestMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_merge(self):\n m1 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2.update(12)\n m1.merge(m2)\n self.assertTrue(m1.jaccard(m2) == 1.0)", "metadata": "root.TestMinHash.test_merge", "header": "['class', 'TestMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_union(self):\n m1 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2.update(12)\n u = minhash.MinHash.union(m1, m2)\n self.assertTrue(u.jaccard(m2) == 1.0)", "metadata": "root.TestMinHash.test_union", "header": "['class', 'TestMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 }, { "content": " def test_bytesize(self):\n m1 = minhash.MinHash(4, 1, hashobj=FakeHash)\n self.assertTrue(m1.bytesize() == (4*4)+4+8)", "metadata": "root.TestMinHash.test_bytesize", "header": "['class', 'TestMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_jaccard(self):\n m1 = minhash.MinHash(4, 1, hashobj=FakeHash)\n m2 = minhash.MinHash(4, 1, hashobj=FakeHash)\n bm1 = bBitMinHash(m1)\n bm2 = bBitMinHash(m2)\n self.assertTrue(bm1.jaccard(bm2) == 1.0)\n\n m2.update(12)\n bm2 = bBitMinHash(m2)\n self.assertTrue(bm1.jaccard(bm2) < 1.0)\n\n m1.update(13)\n bm1 = bBitMinHash(m1)\n self.assertTrue(bm1.jaccard(bm2) < 1.0)", "metadata": "root.TestbBitMinHash.test_jaccard", "header": "['class', 'TestbBitMinHash', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 184 } ]
[ { "span": "self.assertTrue(m1.hashvalues[i] < m2.hashvalues[i])", "start_line": 43, "start_column": 12, "end_line": 43, "end_column": 64 }, { "span": "self.assertTrue(m1.jaccard(m2) == 1.0)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 46 }, { "span": "self.assertTrue(m1.jaccard(m2) == 0.0)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 46 }, { "span": "self.assertTrue(m1.jaccard(m2) < 1.0)", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 45 }, { "span": "self.assertTrue(m1.jaccard(m2) == 1.0)", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 46 }, { "span": "self.assertTrue(u.jaccard(m2) == 1.0)", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 45 }, { "span": "self.assertTrue(m1.bytesize() == (4*4)+4+8)", "start_line": 70, "start_column": 8, "end_line": 70, "end_column": 51 }, { "span": "self.assertTrue(bm1.jaccard(bm2) == 1.0)", "start_line": 189, "start_column": 8, "end_line": 189, "end_column": 48 }, { "span": "self.assertTrue(bm1.jaccard(bm2) < 1.0)", "start_line": 193, "start_column": 8, "end_line": 193, "end_column": 47 }, { "span": "self.assertTrue(bm1.jaccard(bm2) < 1.0)", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Min", "Hash_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1_", "._", "update_", "(_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "m1_", "._", "hash", "values_", "[_", "i_", "]_", "<_", "m2_", "._", "hash", "values_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Min", "Hash_", "(_", "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_", "def_", "test\\u", "jac", "card_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m1_", "._", "jac", "card_", "(_", "m2_", ")_", "==_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "._", "update_", "(_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m1_", "._", "jac", "card_", "(_", "m2_", ")_", "==_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1_", "._", "update_", "(_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m1_", "._", "jac", "card_", "(_", "m2_", ")_", "<_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Min", "Hash_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "merge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "._", "update_", "(_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m1_", "._", "merge_", "(_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m1_", "._", "jac", "card_", "(_", "m2_", ")_", "==_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Min", "Hash_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "union_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "._", "update_", "(_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "min", "hash_", "._", "Min", "Hash_", "._", "union_", "(_", "m1_", ",_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "u_", "._", "jac", "card_", "(_", "m2_", ")_", "==_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Min", "Hash_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bytes", "ize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "m1_", "._", "bytes", "ize_", "(_", ")_", "==_", "(_", "4_", "*_", "4_", ")_", "+_", "4_", "+_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "b", "Bit", "Min", "Hash_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "jac", "card_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m1_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "min", "hash_", "._", "Min", "Hash_", "(_", "4_", ",_", "1_", ",_", "hash", "obj_", "=_", "Fake", "Hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm", "1_", "=_", "b", "Bit", "Min", "Hash_", "(_", "m1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm", "2_", "=_", "b", "Bit", "Min", "Hash_", "(_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "bm", "1_", "._", "jac", "card_", "(_", "bm", "2_", ")_", "==_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m2_", "._", "update_", "(_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm", "2_", "=_", "b", "Bit", "Min", "Hash_", "(_", "m2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "bm", "1_", "._", "jac", "card_", "(_", "bm", "2_", ")_", "<_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m1_", "._", "update_", "(_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bm", "1_", "=_",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 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
refreshoxford/django-cbv-inspector/cbv/migrations/0011_auto__del_field_module_parent.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'cbv.function': {\n 'Meta': {'ordering': \"('name',)\", 'object_name': 'Function'},\n 'code': ('django.db.models.fields.TextField', [], {}),\n 'docstring': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'kwargs': ('django.db.models.fields.CharField', [], {'max_length': '200'}),\n 'line_number': ('django.db.models.fields.IntegerField', [], {}),\n 'module': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cbv.Module']\"}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n },\n 'cbv.inheritance': {\n 'Meta': {'ordering': \"('order',)\", 'unique_together': \"(('child', 'order'),)\", 'object_name': 'Inheritance'},\n 'child': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'ancestor_relationships'\", 'to': \"orm['cbv.Klass']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'order': ('django.db.models.fields.IntegerField', [], {}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cbv.Klass']\"})\n },\n 'cbv.klass': {\n 'Meta': {'unique_together': \"(('module', 'name'),)\", 'object_name': 'Klass'},\n 'docstring': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'import_path': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'line_number': ('django.db.models.fields.IntegerField', [], {}),\n 'module': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cbv.Module']\"}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n },\n 'cbv.klassattribute': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('klass', 'name'),)\", 'object_name': 'KlassAttribute'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'klass': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'attribute_set'\", 'to': \"orm['cbv.Klass']\"}),\n 'line_number': ('django.db.models.fields.IntegerField', [], {}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),\n 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n },\n 'cbv.method': {\n 'Meta': {'ordering': \"('name',)\", 'object_name': 'Method'},\n 'code': ('django.db.models.fields.TextField', [], {}),\n 'docstring': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'klass': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cbv.Klass']\"}),\n 'kwargs': ('django.db.models.fields.CharField', [], {'max_length': '200'}),\n 'line_number': ('django.db.models.fields.IntegerField', [], {}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n },\n 'cbv.module': {\n 'Meta': {'unique_together': \"(('project_version', 'name'),)\", 'object_name': 'Module'},\n 'docstring': ('django.db.models.fields.TextField', [], {'default': \"''\", 'blank': 'True'}),\n 'filename': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '511'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),\n 'project_version': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cbv.ProjectVersion']\"})\n },\n 'cbv.moduleattribute': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('module', 'name'),)\", 'object_name': 'ModuleAttribute'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'line_number': ('django.db.models.fields.IntegerField', [], {}),\n 'module': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'attribute_set'\", 'to': \"orm['cbv.Module']\"}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),\n 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n },\n 'cbv.project': {\n 'Meta': {'object_name': 'Project'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})\n },\n 'cbv.projectversion': {\n 'Meta': {'ordering': \"('-version_number',)\", 'unique_together': \"(('project', 'version_number'),)\", 'object_name': 'ProjectVersion'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['cbv.Project']\"}),\n 'version_number': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n }\n }\n\n complete_apps = ['cbv']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \n # Deleting field 'Module.parent'\n db.delete_column('cbv_module', 'parent_id')", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \n # Adding field 'Module.parent'\n db.add_column('cbv_module', 'parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cbv.Module'], null=True, blank=True), keep_default=False)", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\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_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "function", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Function", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "docstr", "ing", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kwarg", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "module", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Modul", "e", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "inherita", "nce", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "order", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "child", "',", " ", "'", "order", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Inherit", "anc", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "child", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "ancestor", "\\u", "relation", "ships", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Kl", "ass", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Kl", "ass", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "klass", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "module", "',", " ", "'", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Kl", "ass", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "docstr", "ing", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "import", "\\u", "path", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "module", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Modul", "e", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "klass", "attribute", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "klass", "',", " ", "'", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Kl", "ass", "Attribute", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "klass", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attribute", "\\u", "set", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Kl", "ass", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "method", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Meth", "od", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "docstr", "ing", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "klass", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Kl", "ass", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kwarg", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "module", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "project", "\\u", "version", "',", " ", "'", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Modul", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "docstr", "ing", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filename", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "511", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "version", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Project", "Version", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "module", "attribute", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "module", "',", " ", "'", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Modul", "e", "Attribute", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "module", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attribute", "\\u", "set", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Modul", "e", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "project", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Project", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cb", "v", ".", "project", "version", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'-", "version", "\\u", "number", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "project", "',", " ", "'", "version", "\\u", "number", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Project", "Version", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "cb", "v", ".", "Project", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "cb", "v", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Modul", "e", ".", "parent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "column_", "(_", "'", "cb", "v", "\\u", "module", "'_", ",_", "'", "parent", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Modul", "e", ".", "parent", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "'", "cb", "v", "\\u", "module", "'_", ",_", "'", "parent", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "cb", "v", ".", "Modul", "e", "'_", "]_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ",_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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, 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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, 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 ]
Unused import
open-cloud/xos/xos/tosca/resources/cdnservice.py
[ { "content": "import os\nimport pdb\nimport sys\nimport tempfile\nsys.path.append(\"/opt/tosca\")\nfrom translator.toscalib.tosca_template import ToscaTemplate\n\nfrom services.hpc.models import HpcService\n\nfrom service import XOSService\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class XOSCdnService(XOSService):\n provides = \"tosca.nodes.CDNService\"\n xos_model = HpcService\n copyin_props = [\"view_url\", \"icon_url\"]", "metadata": "root.XOSCdnService", "header": "['module', '___EOS___']", "index": 11 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "import pdb", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import tempfile", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 }, { "span": "from translator.toscalib.tosca_template import ToscaTemplate", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "\"/", "opt", "/", "tosc", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "translator_", "._", "tosc", "ali", "b_", "._", "tosc", "a", "\\u", "template_", "import_", "Tos", "ca", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "services_", "._", "hp", "c_", "._", "models_", "import_", "Hp", "c", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "service_", "import_", "XO", "SS", "ervice", "_", "\\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_", "class_", "XO", "SC", "dn", "Service_", "(_", "XO", "SS", "ervice", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provides_", "=_", "\"", "tosc", "a", ".", "nodes", ".", "CD", "NS", "ervice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xo", "s", "\\u", "model_", "=_", "Hp", "c", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "in", "\\u", "props_", "=_", "[_", "\"", "view", "\\u", "url", "\"_", ",_", "\"", "icon", "\\u", "url", "\"_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 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 ]
Unused import
ARTbio/tools-artbio/tools/msp_sr_size_histograms/size_histogram.py
[ { "content": "#!/usr/bin/python\n# python parser module for size distributions, guided by GFF3\n# version 0.9.1 (1-6-2014)\n# Usage readmap.py <1:index source> <2:extraction directive> <3:output pre-mir> <4: output mature miRs> <5:mirbase GFF3>\n# <6:pathToLatticeDataframe or \"dummy_dataframe_path\"> <7:Rcode or \"dummy_plotCode\"> <8:latticePDF or \"dummy_latticePDF\">\n# <9:10:11 filePath:FileExt:FileLabel> <.. ad lib>\n\nimport sys, subprocess, argparse\nfrom smRtools import *\nfrom collections import OrderedDict, defaultdict\nimport os\n\n\nargs=Parser()\nif args.reference_fasta:\n genomeRefFormat = \"fastaSource\"\n genomeRefFile = args.reference_fasta \nif args.reference_bowtie_index:\n genomeRefFormat = \"bowtieIndex\"\n genomeRefFile = args.reference_bowtie_index \nsize_distribution_file=args.output_size_distribution\nminquery=args.minquery\nmaxquery=args.maxquery\nRcode = args.rcode\nfilePath=args.input\nfileExt=args.ext\nfileLabel=args.label\nnormalization_factor=args.normalization_factor\nglobal_size=args.global_size\ncollapse=args.collapse\n\nif collapse:\n pol=[\"both\"]\nelse:\n pol=[\"F\", \"R\"]\n\nMasterListOfGenomes = OrderedDict()\n\n\n\n\n\nMasterListOfGenomes=process_samples(filePath)\n\nif args.gff:\n MasterListOfGenomes=gff_item_subinstances(MasterListOfGenomes, args.gff)\n\nif global_size:\n write_size_distribution_dataframe_global(MasterListOfGenomes, size_distribution_file, pol)\nelse:\n write_size_distribution_dataframe(MasterListOfGenomes, size_distribution_file, pol)\n\nR_command=\"Rscript \"+ Rcode\nprocess = subprocess.Popen(R_command.split())\nprocess.wait()\n\t\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def Parser():\n the_parser = argparse.ArgumentParser()\n the_parser.add_argument('--output_size_distribution', action=\"store\", type=str, help=\"size distribution dataframe\")\n the_parser.add_argument('--reference_fasta', action=\"store\", type=str, help=\"output file\")\n the_parser.add_argument('--reference_bowtie_index',action='store', help=\"paths to indexed or fasta references\")\n the_parser.add_argument('--input',nargs='+', help=\"paths to multiple input files\")\n the_parser.add_argument('--ext',nargs='+', help=\"input file type\")\n the_parser.add_argument('--label',nargs='+', help=\"labels of multiple input files\")\n the_parser.add_argument('--normalization_factor',nargs='+', type=float, help=\"Normalization factor for input file\")\n the_parser.add_argument('--gff', type=str, help=\"GFF containing regions of interest\")\n the_parser.add_argument('--minquery', type=int, help=\"Minimum readsize\")\n the_parser.add_argument('--maxquery', type=int, help=\"Maximum readsize\")\n the_parser.add_argument('--rcode', type=str, help=\"R script\")\n the_parser.add_argument('--global_size', action=\"store_true\", help=\"if specified, size distribution is calcilated for the sum of all items\")\n the_parser.add_argument('--collapse', action=\"store_true\", help=\"if specified, forward and reverse reads are collapsed\")\n args = the_parser.parse_args()\n return args", "metadata": "root.Parser", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def process_samples(filePath):\n for i, filePath in enumerate(filePath):\n norm=normalization_factor[i]\n print fileLabel[i]\n MasterListOfGenomes[fileLabel[i]] = HandleSmRNAwindows (alignmentFile=filePath, alignmentFileFormat=fileExt[i], genomeRefFile=genomeRefFile, genomeRefFormat=genomeRefFormat,\\\n biosample=fileLabel[i], size_inf=minquery, size_sup=maxquery, norm=norm)\n return MasterListOfGenomes", "metadata": "root.process_samples", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def write_size_distribution_dataframe(readDict, size_distribution_file, pol=[\"both\"] ):\n '''refactored on 7-9-2014'''\n with open(size_distribution_file, 'w') as size_distrib:\n print >>size_distrib, \"gene\\tpolarity\\tsize\\tcount\\tsample\"\n for sample in readDict.keys():\n if args.gff:\n dict=readDict[sample]\n else:\n dict=readDict[sample].instanceDict\n for gene in dict.keys():\n histogram = dict[gene].size_histogram()\n for polarity in pol:\n for size, count in histogram[polarity].iteritems():\n print >>size_distrib, \"%s\\t%s\\t%s\\t%s\\t%s\" % (gene, polarity, size, count, sample)", "metadata": "root.write_size_distribution_dataframe", "header": "['module', '___EOS___']", "index": 63 }, { "content": "def write_size_distribution_dataframe_global(readDict, size_distribution_file, pol=[\"both\"]):\n with open(size_distribution_file, 'w') as size_distrib:\n print >>size_distrib, \"gene\\tpolarity\\tsize\\tcount\\tsample\"\n for sample in readDict.keys():\n histogram = readDict[sample].size_histogram()\n gene=\"sample\"\n for polarity in pol:\n for size, count in histogram[polarity].iteritems():\n print >>size_distrib, \"%s\\t%s\\t%s\\t%s\\t%s\" % (gene, polarity, size, count, sample)", "metadata": "root.write_size_distribution_dataframe_global", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def gff_item_subinstances(readDict, gff3):\n GFFinstanceDict=OrderedDict()\n with open(gff3) as gff:\n for line in gff:\n if line[0] == \"#\": continue\n gff_fields = line[:-1].split(\"\\t\")\n chrom = gff_fields[0]\n gff_name = gff_fields[-1].split(\"Name=\")[-1].split(\";\")[0] # to isolate the GFF Name\n item_upstream_coordinate = int(gff_fields[3])\n item_downstream_coordinate = int(gff_fields[4])\n item_polarity = gff_fields[6]\n for sample in readDict.keys():\n\tif not GFFinstanceDict.has_key(sample):\n GFFinstanceDict[sample]={}\n subinstance=extractsubinstance(item_upstream_coordinate, item_downstream_coordinate, readDict[sample].instanceDict[chrom])\n if item_polarity == '-':\n subinstance.readDict={key*-1:value for key, value in subinstance.readDict.iteritems()}\n# subinstance.readDict.setdefault(key, [])\n subinstance.gene=gff_name\n GFFinstanceDict[sample][gff_name]=subinstance\n return GFFinstanceDict", "metadata": "root.gff_item_subinstances", "header": "['module', '___EOS___']", "index": 88 } ]
[ { "span": "import sys, subprocess, argparse", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 32 }, { "span": "from collections import OrderedDict, defaultdict", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 48 }, { "span": "import os", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "parser", " ", "module", " ", "for", " ", "size", " ", "distribu", "tion", "s", ",", " ", "guide", "d", " ", "by", " ", "GF", "F3", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", " ", "0.", "9.1", " ", "(", "1", "-", "6", "-", "2014", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "age", " ", "read", "map", ".", "py", " ", " ", "<", "1", ":", "index", " ", "source", ">", " ", "<", "2", ":", "extracti", "on", " ", "directive", ">", " ", "<", "3", ":", "output", " ", "pre", "-", "mir", ">", " ", "<", "4", ":", " ", "output", " ", "matur", "e", " ", "mi", "Rs", ">", " ", "<", "5", ":", "mir", "base", " ", "GF", "F3", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "<", "6", ":", "path", "To", "Lattice", "Dataf", "rame", " ", "or", " ", "\"", "dummy", "\\u", "dataframe", "\\u", "path", "\">", " ", "<", "7", ":", "Rc", "ode", " ", "or", " ", "\"", "dummy", "\\u", "plot", "Code", "\">", " ", "<", "8", ":", "latt", "ice", "PD", "F", " ", "or", " ", "\"", "dummy", "\\u", "latt", "ice", "PD", "F", "\">", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "<", "9", ":", "10", ":", "11", " ", "file", "Path", ":", "File", "Ext", ":", "File", "Label", ">", " ", "<", "..", " ", "ad", " ", " ", "lib", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "subprocess_", ",_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sm", "Rt", "ools_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", ",_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\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_", "args_", "=_", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "reference", "\\u", "fasta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geno", "me", "Ref", "Format_", "=_", "\"", "fasta", "Sou", "rce", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geno", "me", "Ref", "File_", "=_", "args_", "._", "reference", "\\u", "fasta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "reference", "\\u", "bowtie", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "geno", "me", "Ref", "Format_", "=_", "\"", "bowtie", "Index", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geno", "me", "Ref", "File_", "=_", "args_", "._", "reference", "\\u", "bowtie", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "size", "\\u", "distribu", "tion", "\\u", "file_", "=_", "args_", "._", "output", "\\u", "size", "\\u", "distribution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "query_", "=_", "args_", "._", "min", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "query_", "=_", "args_", "._", "max", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Rc", "ode_", "=_", "args_", "._", "rcode", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Path_", "=_", "args_", "._", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Ext_", "=_", "args_", "._", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Label_", "=_", "args_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normaliza", "tion", "\\u", "factor_", "=_", "args_", "._", "normaliza", "tion", "\\u", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "size_", "=_", "args_", "._", "global", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapse", "_", "=_", "args_", "._", "collapse", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "collapse", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pol_", "=_", "[_", "\"", "bot", "h", "\"_", "]_", "\\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 ", " _", "pol_", "=_", "[_", "\"", "F", "\"_", ",_", "\"", "R", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Master", "List", "Of", "Genome", "s_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\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_", "Master", "List", "Of", "Genome", "s_", "=_", "process", "\\u", "samples_", "(_", "file", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "gff", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Master", "List", "Of", "Genome", "s_", "=_", "gff", "\\u", "item", "\\u", "subin", "stance", "s_", "(_", "Master", "List", "Of", "Genome", "s_", ",_", "args_", "._", "gff", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "global", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "size", "\\u", "distribu", "tion", "\\u", "dataframe", "\\u", "global_", "(_", "Master", "List", "Of", "Genome", "s_", ",_", "size", "\\u", "distribu", "tion", "\\u", "file_", ",_", "pol_", ")_", "\\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 ", " _", "write", "\\u", "size", "\\u", "distribu", "tion", "\\u", "dataframe_", "(_", "Master", "List", "Of", "Genome", "s_", ",_", "size", "\\u", "distribu", "tion", "\\u", "file_", ",_", "pol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "R", "\\u", "command_", "=_", "\"", "Rs", "cript", " ", "\"_", "+_", "Rc", "ode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "R", "\\u", "command_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process_", "._", "wait_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Parser_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "\\u", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "output", "\\u", "size", "\\u", "distribu", "tion", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "str_", ",_", "help_", "=_", "\"", "size", " ", "distribu", "tion", " ", "dataframe", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "reference", "\\u", "fasta", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "str_", ",_", "help_", "=_", "\"", "output", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "reference", "\\u", "bowtie", "\\u", "index", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "help_", "=_", "\"", "path", "s", " ", "to", " ", "indexe", "d", " ", "or", " ", "fasta", " ", "reference", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "input", "'_", ",_", "nargs_", "=_", "'+'_", ",_", "help_", "=_", "\"", "path", "s", " ", "to", " ", "multiple", " ", "input", " ", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ext", "'_", ",_", "nargs_", "=_", "'+'_", ",_", "help_", "=_", "\"", "input", " ", "file", " ", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "label", "'_", ",_", "nargs_", "=_", "'+'_", ",_", "help_", "=_", "\"", "labels", " ", "of", " ", "multiple", " ", "input", " ", "files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "normaliza", "tion", "\\u", "factor", "'_", ",_", "nargs_", "=_", "'+'_", ",_", "type_", "=_", "float_", ",_", "help_", "=_", "\"", "Normal", "izatio", "n", " ", "factor", " ", "for", " ", "input", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "gff", "'_", ",_", "type_", "=_", "str_", ",_", "help_", "=_", "\"", "GF", "F", " ", "contain", "ing", " ", "regions", " ", "of", " ", "interest", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "min", "query", "'_", ",_", "type_", "=_", "int_", ",_", "help_", "=_", "\"", "Mini", "mum", " ", "reads", "ize", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "max", "query", "'_", ",_", "type_", "=_", "int_", ",_", "help_", "=_", "\"", "Maxim", "um", " ", "reads", "ize", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "rcode", "'_", ",_", "type_", "=_", "str_", ",_", "help_", "=_", "\"", "R", " ", "script", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "global", "\\u", "size", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "help_", "=_", "\"", "if", " ", "specified", ",", " ", "size", " ", "distribu", "tion", " ", "is", " ", "calc", "ilat", "ed", " ", "for", " ", "the", " ", "sum", " ", "of", " ", "all", " ", "items", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "\\u", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "collapse", "'_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "help_", "=_", "\"", "if", " ", "specified", ",", " ", "forward", " ", "and", " ", "reverse", " ", "reads", " ", "are", " ", "collapsed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "the", "\\u", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "samples_", "(_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "file", "Path_", "in_", "enumerate_", "(_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "norm_", "=_", "normaliza", "tion", "\\u", "factor_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "file", "Label_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Master", "List", "Of", "Genome", "s_", "[_", "file", "Label_", "[_", "i_", "]_", "]_", "=_", "Handle", "Sm", "RNA", "windows_", "(_", "alignme", "nt", "File_", "=_", "file", "Path_", ",_", "alignme", "nt", "File", "Format_", "=_", "file", "Ext_", "[_", "i_", "]_", ",_", "geno", "me", "Ref", "File_", "=_", "geno", "me", "Ref", "File_", ",_", "geno", "me", "Ref", "Format_", "=_", "geno", "me", "Ref", "Format_", ",_", "bios", "ample", "_", "=_", "file", "Label_", "[_", "i_", "]_", ",_", "size", "\\u", "inf_", "=_", "min", "query_", ",_", "size", "\\u", "sup_", "=_", "max", "query_", ",_", "norm_", "=_", "norm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Master", "List", "Of", "Genome", "s_", "\\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_", "write", "\\u", "size", "\\u", "distribu", "tion", "\\u", "dataframe_", "(_", "read", "Dict_", ",_", "size", "\\u", "distribu", "tion", "\\u", "file_", ",_", "pol_", "=_", "[_", "\"", "bot", "h", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "refactor", "ed", " ", "on", " ", "7", "-", "9", "-", "2014", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "size", "\\u", "distribu", "tion", "\\u", "file_", ",_", "'", "w", "'_", ")_", "as_", "size", "\\u", "distri", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "size", "\\u", "distri", "b_", ",_", "\"", "gene", "\\\\", "tpo", "lar", "it", "y", "\\\\", "tsi", "ze", "\\\\", "tco", "unt", "\\\\", "tsa", "mple", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sample_", "in_", "read", "Dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "gff", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dict_", "=_", "read", "Dict_", "[_", "sample_", "]_", "\\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 ", " _", "dict_", "=_", "read", "Dict_", "[_", "sample_", "]_", "._", "instance", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "gene_", "in_", "dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "histogram_", "=_", "dict_", "[_", "gene_", "]_", "._", "size", "\\u", "histogram_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "polarity", "_", "in_", "pol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "size_", ",_", "count_", "in_", "histogram_", "[_", "polarity", "_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "size", "\\u", "distri", "b_", ",_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\"_", "%_", "(_", "gene_", ",_", "polarity", "_", ",_", "size_", ",_", "count_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "size", "\\u", "distribu", "tion", "\\u", "dataframe", "\\u", "global_", "(_", "read", "Dict_", ",_", "size", "\\u", "distribu", "tion", "\\u", "file_", ",_", "pol_", "=_", "[_", "\"", "bot", "h", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "size", "\\u", "distribu", "tion", "\\u", "file_", ",_", "'", "w", "'_", ")_", "as_", "size", "\\u", "distri", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "size", "\\u", "distri", "b_", ",_", "\"", "gene", "\\\\", "tpo", "lar", "it", "y", "\\\\", "tsi", "ze", "\\\\", "tco", "unt", "\\\\", "tsa", "mple", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sample_", "in_", "read", "Dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "histogram_", "=_", "read", "Dict_", "[_", "sample_", "]_", "._", "size", "\\u", "histogram_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gene_", "=_", "\"", "sample", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "polarity", "_", "in_", "pol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "size_", ",_", "count_", "in_", "histogram_", "[_", "polarity", "_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "size", "\\u", "distri", "b_", ",_", "\"%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\\\\", "t", "%", "s", "\"_", "%_", "(_", "gene_", ",_", "polarity", "_", ",_", "size_", ",_", "count_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gff", "\\u", "item", "\\u", "subin", "stance", "s_", "(_", "read", "Dict_", ",_", "gff", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GF", "Fin", "stance", "Dict_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "gff", "3_", ")_", "as_", "gff", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "gff", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "[_", "0_", "]_", "==_", "\"#\"_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gff", "\\u", "fields_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "._", "split_", "(_", "\"\\\\", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chrom_", "=_", "gff", "\\u", "fields_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gff", "\\u", "name_", "=_", "gff", "\\u", "fields_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "\"", "Name", "=\"_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "\";\"_", ")_", "[_", "0_", "]_", "#", " ", "to", " ", "isolate", " ", "the", " ", "GF", "F", " ", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "ups", "tream", "\\u", "coordinate_", "=_", "int_", "(_", "gff", "\\u", "fields_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "downstream", "\\u", "coordinate_", "=_", "int_", "(_", "gff", "\\u", "fields_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "polarity", "_", "=_", "gff", "\\u", "fields_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sample_", "in_", "read", "Dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "not_", "GF", "Fin", "stance", "Dict_", "._", "has", "\\u", "key_", "(_", "sample_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GF", "Fin", "stance", "Dict_", "[_", "sample_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subin", "stance", "_", "=_", "extracts", "ubi", "nstance", "_", "(_", "item", "\\u", "ups", "tream", "\\u", "coordinate_", ",_", "item", "\\u", "downstream", "\\u", "coordinate_", ",_", "read", "Dict_", "[_", "sample_", "]_", "._", "instance", "Dict_", "[_", "chrom_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item", "\\u", "polarity", "_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subin", "stance", "_", "._", "read", "Dict_", "=_", "{_", "key_", "*_", "-_", "1_", ":_", "value_", "for_", "key_", ",_", "value_", "in_", "subin", "stance", "_", "._", "read", "Dict_", "._", "iteritems_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "subin", "stance", ".", "read", "Dict", ".", "setdefault", "(", "key", ",", " ", "[]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subin", "stance", "_", "._", "gene_", "=_", "gff", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GF", "Fin", "stance", "Dict_", "[_", "sample_", "]_", "[_", "gff", "\\u", "name_", "]_", "=_", "subin", "stance", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "GF", "Fin", "stance", "Dict_", "\\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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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 ]
Module is imported with 'import' and 'import from'
testing-cabal/mock/mock/mock.py
[ { "content": "# mock.py\n# Test tools for mocking and patching.\n# E-mail: fuzzyman AT voidspace DOT org DOT uk\n#\n# mock 1.0.1\n# http://www.voidspace.org.uk/python/mock/\n#\n# Copyright (c) 2007-2013, Michael Foord & the mock team\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided\n# with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nfrom __future__ import absolute_import\n\n__all__ = (\n '__version__',\n 'version_info',\n 'Mock',\n 'MagicMock',\n 'patch',\n 'sentinel',\n 'DEFAULT',\n 'ANY',\n 'call',\n 'create_autospec',\n 'FILTER_DIR',\n 'CallableMixin',\n 'NonCallableMock',\n 'NonCallableMagicMock',\n 'mock_open',\n 'PropertyMock',\n)\n\n\nfrom functools import partial\nimport inspect\nimport pprint\nimport sys\ntry:\n import builtins\nexcept ImportError:\n import __builtin__ as builtins\nfrom types import ModuleType\n\nimport six\nfrom six import wraps\nfrom pbr.version import VersionInfo\n\n_v = VersionInfo('mock').semantic_version()\n__version__ = _v.release_string()\nversion_info = _v.version_tuple()\n\nimport mock\n\ntry:\n inspectsignature = inspect.signature\nexcept AttributeError:\n import funcsigs\n inspectsignature = funcsigs.signature\n\n\n# TODO: use six.\ntry:\n unicode\nexcept NameError:\n # Python 3\n basestring = unicode = str\n\ntry:\n long\nexcept NameError:\n # Python 3\n long = int\n\ntry:\n BaseException\nexcept NameError:\n # Python 2.4 compatibility\n BaseException = Exception\n\nif six.PY2:\n # Python 2's next() can't handle a non-iterator with a __next__ method.\n _next = next\n\n del _next\n\n\n_builtins = set(name for name in dir(builtins) if not name.startswith('_'))\n\nBaseExceptions = (BaseException,)\nif 'java' in sys.platform:\n # jython\n import java\n BaseExceptions = (BaseException, java.lang.Throwable)\n\ntry:\n _isidentifier = str.isidentifier\nexcept AttributeError:\n # Python 2.X\n import keyword\n import re\n regex = re.compile(r'^[a-z_][a-z0-9_]*$', re.I)\n\nself = 'im_self'\nbuiltin = '__builtin__'\nif six.PY3:\n self = '__self__'\n builtin = 'builtins'\n\n# NOTE: This FILTER_DIR is not used. The binding in mock.FILTER_DIR is.\nFILTER_DIR = True\n\n# Workaround for Python issue #12370\n# Without this, the __class__ properties wouldn't be set correctly\n_safe_super = super\n\n\n\n\n\n\n\nDescriptorTypes = (\n type(_slotted.a),\n property,\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\nsentinel = _Sentinel()\n\nDEFAULT = sentinel.DEFAULT\n_missing = sentinel.MISSING\n_deleted = sentinel.DELETED\n\n\nClassType = type(OldStyleClass)\n\n\n\n\nClassTypes = (type,)\nif six.PY2:\n ClassTypes = (type, ClassType)\n\n_allowed_names = set((\n 'return_value', '_mock_return_value', 'side_effect',\n '_mock_side_effect', '_mock_parent', '_mock_new_parent',\n '_mock_name', '_mock_new_name'\n))\n\n\n\n\n\n\n\n\n# Internal class to identify if we wrapped an iterator object or not.\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\n\n\n\n\n\n\n\n\n\n\n\n\npatch.object = _patch_object\npatch.dict = _patch_dict\npatch.multiple = _patch_multiple\npatch.stopall = _patch_stopall\npatch.TEST_PREFIX = 'test'\n\nmagic_methods = (\n \"lt le gt ge eq ne \"\n \"getitem setitem delitem \"\n \"len contains iter \"\n \"hash str sizeof \"\n \"enter exit \"\n # we added divmod and rdivmod here instead of numerics\n # because there is no idivmod\n \"divmod rdivmod neg pos abs invert \"\n \"complex int float index \"\n \"trunc floor ceil \"\n)\n\nnumerics = (\n \"add sub mul matmul div floordiv mod lshift rshift and xor or pow\"\n)\nif six.PY3:\n numerics += ' truediv'\ninplace = ' '.join('i%s' % n for n in numerics.split())\nright = ' '.join('r%s' % n for n in numerics.split())\nextra = ''\nif six.PY3:\n extra = 'bool next '\nelse:\n extra = 'unicode long nonzero oct hex truediv rtruediv '\n\n# not including __prepare__, __instancecheck__, __subclasscheck__\n# (as they are metaclass methods)\n# __del__ is not supported at all as it causes problems if it exists\n\n_non_defaults = set((\n '__cmp__', '__getslice__', '__setslice__', '__coerce__', # <3.x\n '__get__', '__set__', '__delete__', '__reversed__', '__missing__',\n '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__',\n '__getstate__', '__setstate__', '__getformat__', '__setformat__',\n '__repr__', '__dir__', '__subclasses__', '__format__',\n))\n\n\n\n\n_magics = set(\n '__%s__' % method for method in\n ' '.join([magic_methods, numerics, inplace, right, extra]).split()\n)\n\n_all_magics = _magics | _non_defaults\n\n_unsupported_magics = set((\n '__getattr__', '__setattr__',\n '__init__', '__new__', '__prepare__'\n '__instancecheck__', '__subclasscheck__',\n '__del__'\n))\n\n_calculate_return_value = {\n '__hash__': lambda self: object.__hash__(self),\n '__str__': lambda self: object.__str__(self),\n '__sizeof__': lambda self: object.__sizeof__(self),\n '__unicode__': lambda self: unicode(object.__str__(self)),\n}\n\n_return_values = {\n '__lt__': NotImplemented,\n '__gt__': NotImplemented,\n '__le__': NotImplemented,\n '__ge__': NotImplemented,\n '__int__': 1,\n '__contains__': False,\n '__len__': 0,\n '__exit__': False,\n '__complex__': 1j,\n '__float__': 1.0,\n '__bool__': True,\n '__nonzero__': True,\n '__oct__': '1',\n '__hex__': '0x1',\n '__long__': long(1),\n '__index__': 1,\n}\n\n\n\n\n\n_side_effect_methods = {\n '__eq__': _get_eq,\n '__ne__': _get_ne,\n '__iter__': _get_iter,\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nANY = _ANY()\n\n\n\n\n\n\n\n\ncall = _Call(from_kall=False)\n\n\n\n\n\n\n\n\n\n\n\nFunctionTypes = (\n # python function\n type(create_autospec),\n # instance method\n type(ANY.__eq__),\n)\n\nMethodWrapperTypes = (\n type(ANY.__eq__.__get__),\n)\n\n\nfile_spec = None\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import six", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "mock", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tool", "s", " ", "for", " ", "mock", "ing", " ", "and", " ", "patch", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "E-", "mail", ":", " ", "fuzz", "yma", "n", " ", "AT", " ", "voi", "dsp", "ace", " ", "DOT", " ", "org", " ", "DOT", " ", "uk", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mock", " ", "1.0", ".1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "voi", "dsp", "ace", ".", "org", ".", "uk", "/", "python", "/", "mock", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2007", "-", "2013", ",", " ", "Mich", "ael", " ", "Foo", "rd", " ", "&", " ", "the", " ", "mock", " ", "team_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIGHT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\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_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "version", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "\\u", "info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mag", "ic", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "patch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sentinel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DEF", "AUL", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ANY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "call", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "\\u", "autos", "pec", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "FILTER", "\\u", "DIR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Call", "able", "Mix", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Non", "Call", "able", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Non", "Call", "able", "Mag", "ic", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mock", "\\u", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Proper", "ty", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "builtins_", "\\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_", "\\u\\u", "builtin\\u\\u_", "as_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "types_", "import_", "Modul", "e", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pb", "r_", "._", "version_", "import_", "Version", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "v_", "=_", "Version", "Info_", "(_", "'", "mock", "'_", ")_", "._", "sema", "ntic", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\\u", "v_", "._", "release", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "info_", "=_", "\\u", "v_", "._", "version", "\\u", "tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\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 ", " _", "inspect", "signature_", "=_", "inspect_", "._", "signature_", "\\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 ", " _", "import_", "funcs", "ig", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inspect", "signature_", "=_", "funcs", "ig", "s_", "._", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "use", " ", "si", "x", "._", "\\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 ", " _", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basestring_", "=_", "unicode_", "=_", "str_", "\\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 ", " _", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long_", "=_", "int_", "\\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 ", " _", "Base", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.4", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Exception_", "=_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", "'", "s", " ", "next", "()", " ", "can", "'", "t", " ", "handle", " ", "a", " ", "non", "-", "iter", "ator", " ", "with", " ", "a", " ", "\\u\\u", "next", "\\u\\u", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "next_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "next_", "\\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", "builtins_", "=_", "set_", "(_", "name_", "for_", "name_", "in_", "dir_", "(_", "builtins_", ")_", "if_", "not_", "name_", "._", "startswith_", "(_", "'\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Base", "Exceptions_", "=_", "(_", "Base", "Exception_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "java", "'_", "in_", "sys_", "._", "platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "jy", "tho", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "java_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Exceptions_", "=_", "(_", "Base", "Exception_", ",_", "java_", "._", "lang_", "._", "Throw", "able_", ")_", "\\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 ", " _", "\\u", "isi", "denti", "fier", "_", "=_", "str_", "._", "isi", "denti", "fier", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", ".", "X_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regex_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "[", "a", "-", "z", "\\u]", "[", "a", "-", "z", "0", "-", "9", "\\u]*", "$'_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\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_", "self_", "=_", "'", "im", "\\u", "self", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtin_", "=_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "'\\u", "\\u", "self", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtin_", "=_", "'", "bui", "lti", "ns", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Thi", "s", " ", "FILTER", "\\u", "DIR", " ", "is", " ", "not", " ", "used", ".", " ", "The", " ", "bindi", "ng", " ", "in", " ", "mock", ".", "FILTER", "\\u", "DIR", " ", "is", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "FILTER", "\\u", "DIR_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Work", "aro", "und", " ", "for", " ", "Pyth", "on", " ", "issue", " ", "#", "123", "70_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "With", "out", " ", "this", ",", " ", "the", " ", "\\u\\u", "class", "\\u\\u", " ", "proper", "ties", " ", "wou", "ld", "n", "'", "t", " ", "be", " ", "set", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "safe", "\\u", "super_", "=_", "super_", "\\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\\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_", "Descrip", "tor", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "\\u", "slot", "ted_", "._", "a_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "property_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sentinel_", "=_", "\\u", "Senti", "nel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEFAULT_", "=_", "sentinel_", "._", "DEFAULT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "missing_", "=_", "sentinel_", "._", "MISSING", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "deleted_", "=_", "sentinel_", "._", "DELETED", "_", "\\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\\uDEDENT\\u\\u\\u_", "Class", "Type_", "=_", "type_", "(_", "Old", "Style", "Class_", ")_", "\\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_", "Class", "Types_", "=_", "(_", "type_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Class", "Types_", "=_", "(_", "type_", ",_", "Class", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "allow", "ed", "\\u", "names_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "\\u", "value", "'_", ",_", "'\\u", "mock", "\\u", "return", "\\u", "value", "'_", ",_", "'", "side", "\\u", "effect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "mock", "\\u", "side", "\\u", "effect", "'_", ",_", "'\\u", "mock", "\\u", "parent", "'_", ",_", "'\\u", "mock", "\\u", "new", "\\u", "parent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "mock", "\\u", "name", "'_", ",_", "'\\u", "mock", "\\u", "new", "\\u", "name", "'_", "\\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\\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_", "#", " ", "Intern", "al", " ", "class", " ", "to", " ", "identify", " ", "if", " ", "we", " ", "wrapp", "ed", " ", "an", " ", "iter", "ator", " ", "object", " ", "or", " ", "not", "._", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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\\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_", "patch_", "._", "object_", "=_", "\\u", "patch", "\\u", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "dict_", "=_", "\\u", "patch", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "multiple_", "=_", "\\u", "patch", "\\u", "multiple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "stop", "all_", "=_", "\\u", "patch", "\\u", "stop", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "TEST", "\\u", "PREFIX_", "=_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "methods_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lt", " ", "le", " ", "gt", " ", "ge", " ", "eq", " ", "ne", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "getitem", " ", "setitem", " ", "deli", "tem", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "len", " ", "contain", "s", " ", "iter", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hash", " ", "str", " ", "size", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enter", " ", "exit", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "adde", "d", " ", "div", "mod", " ", "and", " ", "rdi", "vmo", "d", " ", "here", " ", "inst", "ead", " ", "of", " ", "numeri", "cs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "there", " ", "is", " ", "no", " ", "idi", "vmo", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "div", "mod", " ", "rdi", "vmo", "d", " ", "neg", " ", "pos", " ", "abs", " ", "invert", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "complex", " ", "int", " ", "float", " ", "index", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "trunc", " ", "floor", " ", "ceil", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numeri", "cs_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", " ", "sub", " ", "mul", " ", "mat", "mul", " ", "div", " ", "floor", "div", " ", "mod", " ", "lsh", "ift", " ", "rshi", "ft", " ", "and", " ", "xor", " ", "or", " ", "pow", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numeri", "cs_", "+=_", "'", " ", "true", "div", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inplace_", "=_", "'", " ", "'_", "._", "join_", "(_", "'", "i", "%", "s", "'_", "%_", "n_", "for_", "n_", "in_", "numeri", "cs_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "'", " ", "'_", "._", "join_", "(_", "'", "r", "%", "s", "'_", "%_", "n_", "for_", "n_", "in_", "numeri", "cs_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra_", "=_", "'", "bool", " ", "next", " ", "'_", "\\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 ", " _", "extra_", "=_", "'", "unicode", " ", "long", " ", "nonzero", " ", "oct", " ", "hex", " ", "true", "div", " ", "rtr", "ued", "iv", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "inclu", "ding", " ", "\\u\\u", "prepar", "e\\u", "\\u", ",", " ", "\\u\\u", "instance", "check", "\\u\\u", ",", " ", "\\u\\u", "subclass", "check", "\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "as", " ", "the", "y", " ", "are", " ", "metaclass", " ", "method", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "del", "\\u\\u", " ", "is", " ", "not", " ", "support", "ed", " ", "at", " ", "all", " ", "as", " ", "it", " ", "caus", "es", " ", "problem", "s", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "non", "\\u", "defaults_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "cmp", "\\u\\u'_", ",_", "'\\u", "\\u", "gets", "lice", "\\u\\u'_", ",_", "'\\u", "\\u", "sets", "lice", "\\u\\u'_", ",_", "'\\u", "\\u", "coerce", "\\u\\u'_", ",_", "#", " ", "<", "3", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "get", "\\u\\u'_", ",_", "'\\u", "\\u", "set\\u", "\\u'_", ",_", "'\\u", "\\u", "delete", "\\u\\u'_", ",_", "'\\u", "\\u", "reverse", "d\\u", "\\u'_", ",_", "'\\u", "\\u", "missi", "ng", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "reduce", "\\u\\u'_", ",_", "'\\u", "\\u", "reduce", "\\u", "ex", "\\u\\u'_", ",_", "'\\u", "\\u", "getin", "ita", "rg", "s", "\\u\\u'_", ",_", "'\\u", "\\u", "getne", "war", "gs", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "getstate", "\\u\\u'_", ",_", "'\\u", "\\u", "setstate", "\\u\\u'_", ",_", "'\\u", "\\u", "getf", "ormat", "\\u\\u'_", ",_", "'\\u", "\\u", "setf", "ormat", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "repr", "\\u\\u'_", ",_", "'\\u", "\\u", "dir\\u", "\\u'_", ",_", "'\\u", "\\u", "subclasses", "\\u\\u'_", ",_", "'\\u", "\\u", "format\\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", "magic", "s_", "=_", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "%", "s", "\\u\\u'_", "%_", "method_", "for_", "method_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "._", "join_", "(_", "[_", "magic", "\\u", "methods_", ",_", "numeri", "cs_", ",_", "inplace_", ",_", "right_", ",_", "extra_", "]_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "all", "\\u", "magic", "s_", "=_", "\\u", "magic", "s_", "|_", "\\u", "non", "\\u", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "unsup", "porte", "d\\u", "magic", "s_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "getattr", "\\u\\u'_", ",_", "'\\u", "\\u", "setattr", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "init", "\\u\\u'_", ",_", "'\\u", "\\u", "new", "\\u\\u'_", ",_", "'\\u", "\\u", "prepar", "e\\u", "\\u'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "instance", "check", "\\u\\u'_", ",_", "'\\u", "\\u", "subclass", "check", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "del", "\\u\\u'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "calcul", "ate", "\\u", "return", "\\u", "value_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "hash", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "str", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "size", "of", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "size", "of", "\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "unicode", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "unicode_", "(_", "object_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "return", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "lt", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "gt", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "le", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "ge", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "int\\u", "\\u'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "contain", "s", "\\u\\u'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "len", "\\u\\u'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "exit", "\\u\\u'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "complex", "\\u\\u'_", ":_", "1j_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "float", "\\u\\u'_", ":_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "bool\\u", "\\u'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "nonzero\\u", "\\u'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "oct", "\\u\\u'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "hex", "\\u\\u'_", ":_", "'", "0x1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "long", "\\u\\u'_", ":_", "long_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "index", "\\u\\u'_", ":_", "1_", ",_", "\\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\\uDEDENT\\u\\u\\u_", "\\u", "side", "\\u", "effect", "\\u", "methods_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "eq", "\\u\\u'_", ":_", "\\u", "get", "\\u", "eq_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "ne", "\\u\\u'_", ":_", "\\u", "get", "\\u", "ne_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "iter", "\\u\\u'_", ":_", "\\u", "get", "\\u", "iter_", ",_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ANY_", "=_", "\\u", "ANY_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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_", "call_", "=_", "\\u", "Call_", "(_", "from", "\\u", "kal", "l_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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_", "\\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_", "Function", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "create", "\\u", "autospec_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "ANY_", "._", "\\u\\u", "eq\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Meth", "od", "Wrapper", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "ANY_", "._", "\\u\\u", "eq\\u\\u_", "._", "\\u\\u", "get\\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_", "file", "\\u", "spec_", "=_", "None_", "\\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_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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 ]
Unused local variable
google/nogotofail/nogotofail/mitm/util/ssl2/types/handshake.py
[ { "content": " def __str__(self):\n ciphers = \"\\n\".join(map(lambda s: \"\\t\" + str(s), self.ciphers))\n session_id = \"\"\n return \"SSLv2 Client Hello\\n%s\\n%s\\n\"\\\n \"Session id:%s\\n\"\\\n \"Ciphers:\\n\"\\\n \"%s\\n\" % (self.version, self.random, self.session_id, ciphers)", "metadata": "root.ClientHello.__str__", "header": "['class', 'ClientHello', '(', 'object', ')', ':', '___EOS___']", "index": 31 } ]
[ { "span": "session_id ", "start_line": 33, "start_column": 8, "end_line": 33, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Client", "Hell", "o_", "(_", "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 ", " _", "ciphers", "_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "map_", "(_", "lambda_", "s_", ":_", "\"\\\\", "t", "\"_", "+_", "str_", "(_", "s_", ")_", ",_", "self_", "._", "ciphers", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "id_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "SS", "Lv", "2", " ", "Client", " ", "Hell", "o", "\\\\", "n", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "\"_", "\"", "Sess", "ion", " ", "id", ":", "%", "s", "\\\\", "n", "\"_", "\"", "Ci", "pher", "s", ":\\\\", "n", "\"_", "\"%", "s", "\\\\", "n", "\"_", "%_", "(_", "self_", "._", "version_", ",_", "self_", "._", "random_", ",_", "self_", "._", "session", "\\u", "id_", ",_", "ciphers", "_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
codeinn/vcs/vcs/tests/test_branches.py
[ { "content": " def test_new_branch(self):\n # This check must not be removed to ensure the 'branches' LazyProperty\n # gets hit *before* the new 'foobar' branch got created:\n self.assertFalse('foobar' in self.repo.branches)\n self.imc.add(vcs.nodes.FileNode('docs/index.txt',\n content='Documentation\\n'))\n foobar_tip = self.imc.commit(\n message=u'New branch: foobar',\n author=u'joe',\n branch='foobar',\n )\n self.assertTrue('foobar' in self.repo.branches)\n self.assertEqual(foobar_tip.branch, 'foobar')", "metadata": "root.BranchesTestCaseMixin.test_new_branch", "header": "['class', 'BranchesTestCaseMixin', '(', 'BackendTestMixin', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_branch_with_slash_in_name(self):\n self.imc.add(vcs.nodes.FileNode('extrafile', content='Some data\\n'))\n self.imc.commit(u'Branch with a slash!', author=u'joe',\n branch='issue/123')\n self.assertTrue('issue/123' in self.repo.branches)", "metadata": "root.BranchesTestCaseMixin.test_branch_with_slash_in_name", "header": "['class', 'BranchesTestCaseMixin', '(', 'BackendTestMixin', ')', ':', '___EOS___']", "index": 88 } ]
[ { "span": "self.assertFalse('foobar' in self.repo.branches)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 56 }, { "span": "self.assertTrue('foobar' in self.repo.branches)", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 55 }, { "span": "self.assertTrue('issue/123' in self.repo.branches)", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Branc", "hes", "Test", "Case", "Mixin_", "(_", "Back", "end", "Test", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "new", "\\u", "branch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "check", " ", "must", " ", "not", " ", "be", " ", "remove", "d", " ", "to", " ", "ensure", " ", "the", " ", "'", "branch", "es", "'", " ", "La", "zy", "Property_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gets", " ", "hit", " ", "*", "bef", "ore", "*", " ", "the", " ", "new", " ", "'", "fooba", "r", "'", " ", "branch", " ", "got", " ", "created", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "'", "fooba", "r", "'_", "in_", "self_", "._", "repo_", "._", "branches_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "im", "c_", "._", "add_", "(_", "vcs_", "._", "nodes_", "._", "File", "Node_", "(_", "'", "docs", "/", "index", ".", "txt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "'", "Document", "ation", "\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fooba", "r", "\\u", "tip_", "=_", "self_", "._", "im", "c_", "._", "commit_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "u", "'", "New", " ", "branch", ":", " ", "fooba", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "u", "'", "jo", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "=_", "'", "fooba", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fooba", "r", "'_", "in_", "self_", "._", "repo_", "._", "branches_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fooba", "r", "\\u", "tip_", "._", "branch_", ",_", "'", "fooba", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Branc", "hes", "Test", "Case", "Mixin_", "(_", "Back", "end", "Test", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "branch", "\\u", "with", "\\u", "slash", "\\u", "in", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "im", "c_", "._", "add_", "(_", "vcs_", "._", "nodes_", "._", "File", "Node_", "(_", "'", "extra", "file", "'_", ",_", "content_", "=_", "'", "Some", " ", "data", "\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "im", "c_", "._", "commit_", "(_", "u", "'", "Branc", "h", " ", "with", " ", "a", " ", "slash", "!'_", ",_", "author_", "=_", "u", "'", "jo", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", "=_", "'", "issue", "/", "123", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "issue", "/", "123", "'_", "in_", "self_", "._", "repo_", "._", "branches_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
dikien/Machine-Learning-Newspaper/nytimes/step4_analysis_supervised_4(RandomizedPCA).py
[ { "content": "# -*- coding: UTF-8 -*-\n\nfrom sklearn.metrics import accuracy_score\nfrom time import time\nimport numpy as np\nimport pickle\nfrom sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn import preprocessing\nfrom sklearn.feature_selection import SelectPercentile, f_classif, chi2\nfrom sklearn.feature_selection import SelectKBest, f_regression\nfrom sklearn.ensemble import AdaBoostClassifier\nfrom sklearn.naive_bayes import BernoulliNB\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.svm import SVC\nfrom sklearn import cross_validation\nfrom sklearn.decomposition import RandomizedPCA\nimport matplotlib.pyplot as plt\nfrom itertools import cycle\n\nnp.set_printoptions(4, suppress=True)\n\n\n\n\n# nFeatures = np.arange(50, 1000, 50)\nnPCA = np.arange(20, 200, 20)\n\ndata = {}\n\nfor k in nPCA:\n\n features, labels, vectorizer, selector, le, features_data = preprocess(\"pkl/article_2_people.pkl\", \"pkl/lable_2_people.pkl\")\n features_train, features_test, labels_train, labels_test = cross_validation.train_test_split(features, labels, test_size=0.1, random_state=42)\n\n t0 = time()\n pca = RandomizedPCA(n_components=k)\n pca.fit(features_train)\n print (\"PCA time:\", round(time()-t0, 3), \"s\")\n\n\n features_train = pca.transform(features_train)\n features_test = pca.transform(features_test)\n\n for name, clf in [\n ('AdaBoostClassifier', AdaBoostClassifier(algorithm='SAMME.R')),\n ('BernoulliNB', BernoulliNB(alpha=1)),\n ('GaussianNB', GaussianNB()),\n ('DecisionTreeClassifier', DecisionTreeClassifier(min_samples_split=100)),\n ('KNeighborsClassifier', KNeighborsClassifier(n_neighbors=50, algorithm='ball_tree')),\n ('RandomForestClassifier', RandomForestClassifier(min_samples_split=100)),\n ('SVC', SVC(kernel='linear', C=1))\n ]:\n\n if not data.has_key(name):\n data[name] = []\n\n print \"*\" * 100\n print('Method: {}'.format(name) + ' the number of feature is {}'.format(k))\n\n # Fit on the whole data:\n t0 = time()\n clf.fit(features_train, labels_train)\n print (\"training time:\", round(time()-t0, 3), \"s\")\n\n # Predict on the whole data:\n y_pred = clf.predict(features_test)\n print (\"predicting time:\", round(time()-t0, 3), \"s\")\n\n score_accuracy = accuracy_score(y_pred, labels_test, normalize=True)\n print('accuracy score on training: {}'.format(score_accuracy))\n print \"*\"* 100\n\n data[name].append(score_accuracy)\n\n\nplot(nPCA, data)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def plot(nFeatures, data):\n colors = cycle('rgbcmykw')\n algorithm = sorted(data)\n\n fig = plt.figure()\n ax = fig.add_subplot(111)\n\n for j, c in zip(algorithm, colors):\n ax.plot(nFeatures, data[j], label=j, color=c)\n ax.scatter(nFeatures, data[j], color=c)\n\n plt.xlabel(\"#-Features(RandomizedPCA)\")\n plt.ylabel(\"Accuracy\")\n plt.title(\"Accuracy vs #-Features for different classifiers\")\n box = ax.get_position()\n ax.set_position([box.x0, box.y0 + box.height * 0.3,\n box.width, box.height * 0.7])\n ax.legend(loc=\"upper center\", bbox_to_anchor=(0.5, -0.15), fancybox=True, shadow=True, ncol=3)\n\n plt.legend(loc=4)\n plt.show()", "metadata": "root.plot", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def preprocess(article_file, lable_file):\n\n features = pickle.load(open(article_file))\n features = np.array(features)\n\n # transform non-numerical labels (as long as they are hashable and comparable) to numerical labels\n lables = pickle.load(open(lable_file))\n le = preprocessing.LabelEncoder()\n le.fit(lables)\n lables = le.transform(lables)\n # print le.inverse_transform([0])\n\n ### text vectorization--go from strings to lists of numbers\n vectorizer = TfidfVectorizer(sublinear_tf=True, max_df=0.5, min_df=1,\n stop_words='english')\n features_train_transformed = vectorizer.fit_transform(features)\n\n # selector : SelectPercentile\n selector = SelectPercentile(f_classif, percentile=40)\n selector.fit(features_train_transformed, lables)\n\n # selector : SelectKBest\n # selector = SelectKBest(k=k)\n # selector.fit(features_train_transformed, lables)\n\n # selector : chi2\n # selector = SelectPercentile(score_func=chi2)\n # selector.fit(features_train_transformed, lables)\n\n features_train_transformed = selector.transform(features_train_transformed).toarray()\n\n return features_train_transformed, lables, vectorizer, selector, le, features", "metadata": "root.preprocess", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "from sklearn.feature_selection import SelectPercentile, f_classif, chi2", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 71 }, { "span": "from sklearn.feature_selection import SelectKBest, f_regression", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "UT", "F", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "accu", "rac", "y", "\\u", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "feature", "\\u", "extraction_", "._", "text_", "import_", "Tf", "idf", "Vectorizer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "preprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "feature", "\\u", "selection_", "import_", "Select", "Perce", "ntil", "e_", ",_", "f", "\\u", "classif", "_", ",_", "chi2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "feature", "\\u", "selection_", "import_", "Select", "KB", "est_", ",_", "f", "\\u", "regression_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "ensemble_", "import_", "Ada", "Boost", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "naive", "\\u", "bayes", "_", "import_", "Bern", "oulli", "NB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "naive", "\\u", "bayes", "_", "import_", "Gaussian", "NB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "tree_", "import_", "Deci", "sion", "Tree", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "neighbors_", "import_", "KN", "eig", "hbo", "rs", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "ensemble_", "import_", "Random", "Fore", "st", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "svm_", "import_", "SVC_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "cross", "\\u", "validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "decomposition", "_", "import_", "Random", "ize", "d", "PCA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "cycle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "set\\u", "printo", "ptions_", "(_", "4_", ",_", "suppress_", "=_", "True_", ")_", "\\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_", "#", " ", "n", "Feature", "s", " ", "=", " ", "np", ".", "aran", "ge", "(", "50", ",", " ", "1000", ",", " ", "50", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n", "PCA", "_", "=_", "np_", "._", "arange_", "(_", "20_", ",_", "200_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "n", "PCA", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", ",_", "labels_", ",_", "vectorizer", "_", ",_", "selector_", ",_", "le_", ",_", "features", "\\u", "data_", "=_", "preprocess_", "(_", "\"", "pkl", "/", "article", "\\u", "2", "\\u", "people", ".", "pkl", "\"_", ",_", "\"", "pkl", "/", "lable", "\\u", "2", "\\u", "people", ".", "pkl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features", "\\u", "train_", ",_", "features", "\\u", "test_", ",_", "labels", "\\u", "train_", ",_", "labels", "\\u", "test_", "=_", "cross", "\\u", "validation_", "._", "train", "\\u", "test\\u", "split_", "(_", "features_", ",_", "labels_", ",_", "test\\u", "size_", "=_", "0.1_", ",_", "random", "\\u", "state_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t0_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pca_", "=_", "Random", "ize", "d", "PCA", "_", "(_", "n", "\\u", "components_", "=_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pca_", "._", "fit_", "(_", "features", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "PCA", " ", "time", ":\"_", ",_", "round_", "(_", "time_", "(_", ")_", "-_", "t0_", ",_", "3_", ")_", ",_", "\"", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features", "\\u", "train_", "=_", "pca_", "._", "transform_", "(_", "features", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features", "\\u", "test_", "=_", "pca_", "._", "transform_", "(_", "features", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", ",_", "clf_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Ada", "Boost", "Classif", "ier", "'_", ",_", "Ada", "Boost", "Classifier_", "(_", "algorithm_", "=_", "'", "SAM", "ME", ".", "R", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Bern", "oulli", "NB", "'_", ",_", "Bern", "oulli", "NB_", "(_", "alpha_", "=_", "1_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Gaussian", "NB", "'_", ",_", "Gaussian", "NB_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Deci", "sion", "Tree", "Classif", "ier", "'_", ",_", "Deci", "sion", "Tree", "Classifier_", "(_", "min", "\\u", "samples", "\\u", "split_", "=_", "100_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "KN", "eig", "hbo", "rs", "Classif", "ier", "'_", ",_", "KN", "eig", "hbo", "rs", "Classifier_", "(_", "n", "\\u", "neighbors_", "=_", "50_", ",_", "algorithm_", "=_", "'", "bal", "l\\u", "tree", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Random", "Fore", "st", "Classif", "ier", "'_", ",_", "Random", "Fore", "st", "Classifier_", "(_", "min", "\\u", "samples", "\\u", "split_", "=_", "100_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "SVC", "'_", ",_", "SVC_", "(_", "kernel_", "=_", "'", "linear", "'_", ",_", "C_", "=_", "1_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "data_", "._", "has", "\\u", "key_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"*\"_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Meth", "od", ":", " ", "{}'_", "._", "format_", "(_", "name_", ")_", "+_", "'", " ", "the", " ", "number", " ", "of", " ", "feature", " ", "is", " ", "{}'_", "._", "format_", "(_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fit", " ", "on", " ", "the", " ", "whole", " ", "data", ":_", "\\u\\u\\uNL\\u\\u\\u_", "t0_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "features", "\\u", "train_", ",_", "labels", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "train", "ing", " ", "time", ":\"_", ",_", "round_", "(_", "time_", "(_", ")_", "-_", "t0_", ",_", "3_", ")_", ",_", "\"", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Predic", "t", " ", "on", " ", "the", " ", "whole", " ", "data", ":_", "\\u\\u\\uNL\\u\\u\\u_", "y", "\\u", "pred_", "=_", "clf_", "._", "predict_", "(_", "features", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "predicti", "ng", " ", "time", ":\"_", ",_", "round_", "(_", "time_", "(_", ")_", "-_", "t0_", ",_", "3_", ")_", ",_", "\"", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "score", "\\u", "accuracy_", "=_", "accu", "rac", "y", "\\u", "score_", "(_", "y", "\\u", "pred_", ",_", "labels", "\\u", "test_", ",_", "normalize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "accu", "rac", "y", " ", "score", " ", "on", " ", "train", "ing", ":", " ", "{}'_", "._", "format_", "(_", "score", "\\u", "accuracy_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"*\"_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "name_", "]_", "._", "append_", "(_", "score", "\\u", "accuracy_", ")_", "\\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_", "plot_", "(_", "n", "PCA", "_", ",_", "data_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "plot_", "(_", "n", "Features_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "cycle_", "(_", "'", "rgb", "cm", "yk", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algorithm_", "=_", "sorted_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "j_", ",_", "c_", "in_", "zip_", "(_", "algorithm_", ",_", "colors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "plot_", "(_", "n", "Features_", ",_", "data_", "[_", "j_", "]_", ",_", "label_", "=_", "j_", ",_", "color_", "=_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "scatter_", "(_", "n", "Features_", ",_", "data_", "[_", "j_", "]_", ",_", "color_", "=_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "xlabel_", "(_", "\"#", "-", "Feature", "s", "(", "Random", "ize", "d", "PCA", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylabel_", "(_", "\"", "Accu", "rac", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Accu", "rac", "y", " ", "vs", " ", "#-", "Feature", "s", " ", "for", " ", "different", " ", "classif", "iers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "=_", "ax_", "._", "get", "\\u", "position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "position_", "(_", "[_", "box_", "._", "x0_", ",_", "box_", "._", "y0_", "+_", "box_", "._", "height_", "*_", "0.3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "box_", "._", "width_", ",_", "box_", "._", "height_", "*_", "0.7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "legend_", "(_", "loc_", "=_", "\"", "upper", " ", "center", "\"_", ",_", "bbox", "\\u", "to", "\\u", "anchor_", "=_", "(_", "0.5_", ",_", "-_", "0.15_", ")_", ",_", "fancy", "box_", "=_", "True_", ",_", "shadow_", "=_", "True_", ",_", "ncol_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "legend_", "(_", "loc_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\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_", "preprocess_", "(_", "article", "\\u", "file_", ",_", "lable", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features_", "=_", "pickle_", "._", "load_", "(_", "open_", "(_", "article", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "=_", "np_", "._", "array_", "(_", "features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transform", " ", "non", "-", "numerical", " ", "labels", " ", "(", "as", " ", "long", " ", "as", " ", "the", "y", " ", "are", " ", "hashable", " ", "and", " ", "compara", "ble", ")", " ", "to", " ", "numerical", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "lable", "s_", "=_", "pickle_", "._", "load_", "(_", "open_", "(_", "lable", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "le_", "=_", "preprocessing_", "._", "Label", "Encoder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "le_", "._", "fit_", "(_", "lable", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lable", "s_", "=_", "le_", "._", "transform_", "(_", "lable", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "le", ".", "inv", "erse", "\\u", "transform", "([", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "text", " ", "vector", "izatio", "n", "--", "go", " ", "from", " ", "string", "s", " ", "to", " ", "lists", " ", "of", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "vectorizer", "_", "=_", "Tf", "idf", "Vectorizer_", "(_", "subli", "near", "\\u", "tf_", "=_", "True_", ",_", "max", "\\u", "df_", "=_", "0.5_", ",_", "min", "\\u", "df_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "words_", "=_", "'", "english", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features", "\\u", "train", "\\u", "transformed_", "=_", "vectorizer", "_", "._", "fit", "\\u", "transform_", "(_", "features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", " ", ":", " ", "Select", "Perce", "ntil", "e_", "\\u\\u\\uNL\\u\\u\\u_", "selector_", "=_", "Select", "Perce", "ntil", "e_", "(_", "f", "\\u", "classif", "_", ",_", "percentile_", "=_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selector_", "._", "fit_", "(_", "features", "\\u", "train", "\\u", "transformed_", ",_", "lable", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", " ", ":", " ", "Select", "KB", "est_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", " ", "=", " ", "Select", "KB", "est", "(", "k", "=", "k", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", ".", "fit", "(", "features", "\\u", "train", "\\u", "transforme", "d", ",", " ", "lable", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", " ", ":", " ", "chi2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", " ", "=", " ", "Select", "Perce", "ntil", "e", "(", "score", "\\u", "func", "=", "chi", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "select", "or", ".", "fit", "(", "features", "\\u", "train", "\\u", "transforme", "d", ",", " ", "lable", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features", "\\u", "train", "\\u", "transformed_", "=_", "selector_", "._", "transform_", "(_", "features", "\\u", "train", "\\u", "transformed_", ")_", "._", "toa", "rray_", "(_", ")_", "\\u\\u\\uNEWLINE\\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 ]
Testing equality to None
spranesh/Redhawk/redhawk/common/writers/xml_writer.py
[ { "content": " def __AddChildToElement(self, child, parent_element):\n \"\"\" Adds a Child (which could itself be a list) as a child to the\n parent_element.\"\"\"\n if type(child) is list:\n group_node = ET.SubElement(parent_element, \"ChildGroup\")\n for c in child:\n self.__AddChildToElement(c, group_node)\n else:\n assert(isinstance(child, N.Node) or child == None)\n if child == None:\n print(\"We have a none child?\")\n ET.SubElement(parent_element, \"None\")\n else:\n self.__ConvertToElement(child, parent_element)\n return", "metadata": "root.XMLWriter.__AddChildToElement", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "child == None)", "start_line": 36, "start_column": 42, "end_line": 36, "end_column": 55 }, { "span": "child == None:", "start_line": 37, "start_column": 9, "end_line": 37, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "Add", "Chil", "d", "To", "Element_", "(_", "self_", ",_", "child_", ",_", "parent", "\\u", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", "s", " ", "a", " ", "Chil", "d", " ", "(", "whi", "ch", " ", "coul", "d", " ", "its", "elf", " ", "be", " ", "a", " ", "list", ")", " ", "as", " ", "a", " ", "child", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "parent", "\\u", "element", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "child_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "\\u", "node_", "=_", "ET_", "._", "Sub", "Element_", "(_", "parent", "\\u", "element_", ",_", "\"", "Chil", "d", "Group", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "child_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "Add", "Chil", "d", "To", "Element_", "(_", "c_", ",_", "group", "\\u", "node_", ")_", "\\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 ", " _", "assert_", "(_", "isinstance_", "(_", "child_", ",_", "N_", "._", "Node_", ")_", "or_", "child_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "We", " ", "have", " ", "a", " ", "none", " ", "child", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ET_", "._", "Sub", "Element_", "(_", "parent", "\\u", "element_", ",_", "\"", "Non", "e", "\"_", ")_", "\\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\\u", "Convert", "To", "Element_", "(_", "child_", ",_", "parent", "\\u", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\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, 0, 1, 1, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__eq__` not overridden when adding attributes
uci-cbcl/tree-hmm/gmtkParam/__init__.py
[ { "content": "class FeatureDefinition(set):\n\n", "metadata": "root.FeatureDefinition", "header": "['module', '___EOS___']", "index": 1218 }, { "content": " def __init__(self, name, allowedValues):\n self.name = name\n self.update(allowedValues)", "metadata": "root.FeatureDefinition.__init__", "header": "['class', 'FeatureDefinition', '(', 'set', ')', ':', '___EOS___']", "index": 1219 }, { "content": " @classmethod\n def readFromFile(cls, io):\n name = io.readWord()\n empty,firstVal= io.readWord().split('(')\n if not empty == '':\n raise ValueError(\"Cannot have chars preceding '(' in the same word on line %d\"%io.line)\n self.add(firstVal)\n endSeen = False\n while not endSeen:\n val = io.readWord()\n try:\n lastVal, leftovers = val.split(')')\n except ValueError:\n self.add(val)\n else:\n endSeen = True\n if lastVal: #last char is )\n self.add(lastVal)\n if leftovers:\n raise ValueError(\"Was expecting a ')' by itself or at the end of a word on line %d\"%io.line)\n return cls(name, featureValues)", "metadata": "root.FeatureDefinition.readFromFile", "header": "['class', 'FeatureDefinition', '(', 'set', ')', ':', '___EOS___']", "index": 1223 }, { "content": " def writeToFile(self, io):\n io.writeWord(self.name)\n io.writeWord('(')\n for v in self:\n io.writeWord(v)\n io.writeWord(')')", "metadata": "root.FeatureDefinition.writeToFile", "header": "['class', 'FeatureDefinition', '(', 'set', ')', ':', '___EOS___']", "index": 1245 }, { "content": "class Question(set):\n\n", "metadata": "root.Question", "header": "['module', '___EOS___']", "index": 1271 }, { "content": " def __init__(self, name, feature, values=set()):\n self.name = name\n self.feature =feature\n self.update(values)", "metadata": "root.Question.__init__", "header": "['class', 'Question', '(', 'set', ')', ':', '___EOS___']", "index": 1272 }, { "content": " @classmethod\n def readFromFile(cls, io):\n name = io.readWord()\n feature = io.readWord()\n q =Question(name, feature)\n n = io.readInt()\n for i in range(n):\n q.add(io.readWord())\n return q", "metadata": "root.Question.readFromFile", "header": "['class', 'Question', '(', 'set', ')', ':', '___EOS___']", "index": 1277 }, { "content": " def writeToFile(self, io):\n io.writeWord(self.name)\n io.writeWord(self.feature)\n io.writeInt(len(self))\n for v in sorted(self):\n io.writeWord(v)", "metadata": "root.Question.writeToFile", "header": "['class', 'Question', '(', 'set', ')', ':', '___EOS___']", "index": 1287 }, { "content": "class NamedObjectCollection(dict):\n \"A generic named object collection\"\n\n", "metadata": "root.NamedObjectCollection", "header": "['module', '___EOS___']", "index": 1294 }, { "content": " def __init__(self, obj_type):\n self.obj_type = obj_type #The class of the named objects in this collection", "metadata": "root.NamedObjectCollection.__init__", "header": "['class', 'NamedObjectCollection', '(', 'dict', ')', ':', '___EOS___']", "index": 1296 }, { "content": " def readFromIO(self, io):\n nobj = io.readInt()\n for i in range(nobj):\n ri = io.readInt()\n if i != ri:\n raise ValueError('Invalid object index, read %d, expected %d' % (ri, i))\n obj = self.obj_type.readFromFile(io)\n self[obj.name]=obj", "metadata": "root.NamedObjectCollection.readFromIO", "header": "['class', 'NamedObjectCollection', '(', 'dict', ')', ':', '___EOS___']", "index": 1299 }, { "content": " def writeToFile(self, io):\n items = sorted(self.items())\n ostr=NumberedObjectOutStream(io, self.obj_type)\n for (name, obj) in items:\n ostr.writeObject(obj)\n ostr.finalize()", "metadata": "root.NamedObjectCollection.writeToFile", "header": "['class', 'NamedObjectCollection', '(', 'dict', ')', ':', '___EOS___']", "index": 1308 }, { "content": "class NamedObjectList(list):\n \"A generic named and ordered object list\"\n\n", "metadata": "root.NamedObjectList", "header": "['module', '___EOS___']", "index": 1369 }, { "content": " def __init__(self, obj_type):\n self.obj_type = obj_type #The class of the named objects in this collection", "metadata": "root.NamedObjectList.__init__", "header": "['class', 'NamedObjectList', '(', 'list', ')', ':', '___EOS___']", "index": 1371 }, { "content": " def readFromIO(self, io):\n \"\"\"This differs from readFromFile because readFromFile is a @classMethod\"\"\"\n nobj = io.readInt()\n for i in range(nobj):\n ri = io.readInt()\n if i != ri:\n raise ValueError('Invalid object index, read %d, expected %d' % (ri, i))\n obj = self.obj_type.readFromFile(io)\n self[i]=obj", "metadata": "root.NamedObjectList.readFromIO", "header": "['class', 'NamedObjectList', '(', 'list', ')', ':', '___EOS___']", "index": 1374 }, { "content": " def writeToFile(self, io):\n ostr=NumberedObjectOutStream(io, self.obj_type)\n for obj in self:\n ostr.writeObject(obj)\n ostr.finalize()", "metadata": "root.NamedObjectList.writeToFile", "header": "['class', 'NamedObjectList', '(', 'list', ')', ':', '___EOS___']", "index": 1384 } ]
[ { "span": "class FeatureDefinition(set):", "start_line": 1218, "start_column": 0, "end_line": 1218, "end_column": 29 }, { "span": "class Question(set):", "start_line": 1271, "start_column": 0, "end_line": 1271, "end_column": 20 }, { "span": "class NamedObjectCollection(dict):", "start_line": 1294, "start_column": 0, "end_line": 1294, "end_column": 34 }, { "span": "class NamedObjectList(list):", "start_line": 1369, "start_column": 0, "end_line": 1369, "end_column": 28 } ]
[ { "span": "self.name ", "start_line": 1220, "start_column": 8, "end_line": 1220, "end_column": 17 }, { "span": "self.name ", "start_line": 1273, "start_column": 8, "end_line": 1273, "end_column": 17 }, { "span": "self.feature ", "start_line": 1274, "start_column": 8, "end_line": 1274, "end_column": 20 }, { "span": "self.obj_type ", "start_line": 1297, "start_column": 8, "end_line": 1297, "end_column": 21 }, { "span": "self.obj_type ", "start_line": 1372, "start_column": 8, "end_line": 1372, "end_column": 21 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[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_", "Feature", "Definition_", "(_", "set_", ")_", ":_", "\\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_", "Feature", "Definition_", "(_", "set_", ")_", ":_", "\\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_", ",_", "name_", ",_", "allow", "ed", "Values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "allow", "ed", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Feature", "Definition_", "(_", "set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read", "Fro", "m", "File_", "(_", "cls_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "io_", "._", "read", "Word_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty_", ",_", "first", "Val_", "=_", "io_", "._", "read", "Word_", "(_", ")_", "._", "split_", "(_", "'('_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "empty_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cann", "ot", " ", "have", " ", "char", "s", " ", "preceding", " ", "'(", "'", " ", "in", " ", "the", " ", "same", " ", "word", " ", "on", " ", "line", " ", "%", "d", "\"_", "%_", "io_", "._", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add_", "(_", "first", "Val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Seen", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "end", "Seen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "io_", "._", "read", "Word_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "Val_", ",_", "lefto", "vers_", "=_", "val_", "._", "split_", "(_", "')'_", ")_", "\\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 ", " _", "self_", "._", "add_", "(_", "val_", ")_", "\\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 ", " _", "end", "Seen", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "Val_", ":_", "#", "last", " ", "char", " ", "is", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add_", "(_", "last", "Val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lefto", "vers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "Wa", "s", " ", "expect", "ing", " ", "a", " ", "')", "'", " ", "by", " ", "its", "elf", " ", "or", " ", "at", " ", "the", " ", "end", " ", "of", " ", "a", " ", "word", " ", "on", " ", "line", " ", "%", "d", "\"_", "%_", "io_", "._", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "name_", ",_", "feature", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Feature", "Definition_", "(_", "set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "To", "File_", "(_", "self_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "._", "write", "Word_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io_", "._", "write", "Word_", "(_", "'('_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "._", "write", "Word_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "io_", "._", "write", "Word_", "(_", "')'_", ")_", "\\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_", "Question_", "(_", "set_", ")_", ":_", "\\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_", "Question_", "(_", "set_", ")_", ":_", "\\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_", ",_", "name_", ",_", "feature_", ",_", "values_", "=_", "set_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "feature_", "=_", "feature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Question_", "(_", "set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read", "Fro", "m", "File_", "(_", "cls_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "io_", "._", "read", "Word_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature_", "=_", "io_", "._", "read", "Word_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "Question_", "(_", "name_", ",_", "feature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "io_", "._", "read", "Int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "._", "add_", "(_", "io_", "._", "read", "Word_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Question_", "(_", "set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "To", "File_", "(_", "self_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "._", "write", "Word_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io_", "._", "write", "Word_", "(_", "self_", "._", "feature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io_", "._", "write", "Int_", "(_", "len_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "sorted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "._", "write", "Word_", "(_", "v_", ")_", "\\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_", "Name", "d", "Object", "Collection_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "A", " ", "gener", "ic", " ", "named", " ", "object", " ", "collection", "\"_", "\\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_", "Name", "d", "Object", "Collection_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "obj", "\\u", "type_", "=_", "obj", "\\u", "type_", "#", "The", " ", "class", " ", "of", " ", "the", " ", "named", " ", "object", "s", " ", "in", " ", "this", " ", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Object", "Collection_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Fro", "m", "IO_", "(_", "self_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nob", "j_", "=_", "io_", "._", "read", "Int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nob", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ri_", "=_", "io_", "._", "read", "Int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "!=_", "ri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "object", " ", "index", ",", " ", "read", " ", "%", "d", ",", " ", "expected", " ", "%", "d", "'_", "%_", "(_", "ri_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "self_", "._", "obj", "\\u", "type_", "._", "read", "Fro", "m", "File_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "[_", "obj_", "._", "name_", "]_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Object", "Collection_", "(_", "dict_", ")_", ":_", "\\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", "To", "File_", "(_", "self_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "=_", "sorted_", "(_", "self_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ostr", "_", "=_", "Number", "ed", "Object", "Out", "Stream_", "(_", "io_", ",_", "self_", "._", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "name_", ",_", "obj_", ")_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ostr", "_", "._", "write", "Object_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ostr", "_", "._", "finalize_", "(_", ")_", "\\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_", "Name", "d", "Object", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "A", " ", "gener", "ic", " ", "named", " ", "and", " ", "order", "ed", " ", "object", " ", "list", "\"_", "\\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_", "Name", "d", "Object", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "obj", "\\u", "type_", "=_", "obj", "\\u", "type_", "#", "The", " ", "class", " ", "of", " ", "the", " ", "named", " ", "object", "s", " ", "in", " ", "this", " ", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Object", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "Fro", "m", "IO_", "(_", "self_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "differs", " ", "from", " ", "read", "Fro", "m", "File", " ", "bec", "aus", "e", " ", "read", "Fro", "m", "File", " ", "is", " ", "a", " ", "@", "class", "Meth", "od", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "j_", "=_", "io_", "._", "read", "Int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nob", "j_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ri_", "=_", "io_", "._", "read", "Int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "!=_", "ri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Inva", "lid", " ", "object", " ", "index", ",", " ", "read", " ", "%", "d", ",", " ", "expected", " ", "%", "d", "'_", "%_", "(_", "ri_", ",_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "self_", "._", "obj", "\\u", "type_", "._", "read", "Fro", "m", "File_", "(_", "io_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "[_", "i_", "]_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "d", "Object", "List_", "(_", "list_", ")_", ":_", "\\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", "To", "File_", "(_", "self_", ",_", "io_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ostr", "_", "=_", "Number", "ed", "Object", "Out", "Stream_", "(_", "io_", ",_", "self_", "._", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ostr", "_", "._", "write", "Object_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\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, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 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, 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 ]
Unused import
coderanger/pychef/chef/tests/test_client.py
[ { "content": "import unittest2\n\nfrom chef import Client\nfrom chef.tests import ChefTestCase\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ClientTestCase(ChefTestCase):\n\n\n", "metadata": "root.ClientTestCase", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def test_list(self):\n self.assertIn('test_1', Client.list())", "metadata": "root.ClientTestCase.test_list", "header": "['class', 'ClientTestCase', '(', 'ChefTestCase', ')', ':', '___EOS___']", "index": 6 }, { "content": " def test_get(self):\n client = Client('test_1')\n self.assertTrue(client.platform)\n self.assertEqual(client.orgname, 'pycheftest')\n self.assertTrue(client.public_key)\n self.assertTrue(client.certificate)\n self.assertEqual(client.private_key, None)", "metadata": "root.ClientTestCase.test_get", "header": "['class', 'ClientTestCase', '(', 'ChefTestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_create(self):\n name = self.random()\n client = Client.create(name)\n self.register(client)\n self.assertEqual(client.name, name)\n #self.assertEqual(client.orgname, 'pycheftest') # See CHEF-2019\n self.assertTrue(client.private_key)\n self.assertTrue(client.public_key)\n self.assertIn(name, Client.list())\n\n client2 = Client(name)\n client2.rekey()\n self.assertEqual(client.public_key, client2.public_key)\n self.assertNotEqual(client.private_key, client2.private_key)", "metadata": "root.ClientTestCase.test_create", "header": "['class', 'ClientTestCase', '(', 'ChefTestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_delete(self):\n name = self.random()\n client = Client.create(name)\n client.delete()\n self.assertNotIn(name, Client.list())", "metadata": "root.ClientTestCase.test_delete", "header": "['class', 'ClientTestCase', '(', 'ChefTestCase', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "import unittest2", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "chef", "_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chef", "_", "._", "tests_", "import_", "Che", "f", "Test", "Case_", "\\u\\u\\uNEWLINE\\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_", "Client", "Test", "Case_", "(_", "Che", "f", "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_", "Client", "Test", "Case_", "(_", "Che", "f", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "In_", "(_", "'", "test\\u", "1", "'_", ",_", "Client_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client", "Test", "Case_", "(_", "Che", "f", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "Client_", "(_", "'", "test\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "platform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "org", "name_", ",_", "'", "pyche", "fte", "st", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "public", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "certificate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "private", "\\u", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client", "Test", "Case_", "(_", "Che", "f", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "._", "create_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "register_", "(_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "name_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "client", ".", "org", "name", ",", " ", "'", "pyche", "fte", "st", "')", " ", "#", " ", "See", " ", "CHE", "F", "-", "2019", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "private", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "public", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "name_", ",_", "Client_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "2_", "=_", "Client_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "2_", "._", "rek", "ey_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "public", "\\u", "key_", ",_", "client", "2_", "._", "public", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "client_", "._", "private", "\\u", "key_", ",_", "client", "2_", "._", "private", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client", "Test", "Case_", "(_", "Che", "f", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Client_", "._", "create_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "name_", ",_", "Client_", "._", "list_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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right 2008-2012 Nokia Siemens Networks Oyj\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\"\"\"This package exposes the public APIs of Robot Framework.\n\nUnless stated otherwise, the APIs exposed in this module are considered stable,\nand thus safe to use when building external tools on top of Robot Framework.\n\nCurrently exposed APIs are:\n\n * :py:mod:`.logger` for test libraries' logging purposes.\n\n * :py:func:`~robot.result.resultbuilder.ExecutionResult` for reading\n execution results from XML output files.\n\n * :py:class:`~robot.parsing.model.TestCaseFile`,\n :py:class:`~robot.parsing.model.TestDataDirectory`, and\n :py:class:`~robot.parsing.model.ResourceFile` for parsing data files.\n In addition, a convenience factory function\n :py:func:`~robot.parsing.model.TestData` creates either\n :py:class:`~robot.parsing.model.TestCaseFile` or\n :py:class:`~robot.parsing.model.TestDataDirectory` based on the input.\n\n * :py:func:`~robot.running.model.TestSuite` for creating a\n test suite that can be executed. This API is going to change in\n Robot Framework 2.8.\n\nThese names can be imported like this:\n\n.. code-block:: python\n\n from robot.api import <name>\n\nSee documentations of the individual APIs for more details.\n\"\"\"\n\nfrom robot.parsing import TestCaseFile, TestDataDirectory, ResourceFile, TestData\nfrom robot.result import ExecutionResult\nfrom robot.running import TestSuite\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from robot.parsing import TestCaseFile, TestDataDirectory, ResourceFile, TestData", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 81 }, { "span": "from robot.result import ExecutionResult", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 40 }, { "span": "from robot.running import TestSuite", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "2008", "-", "2012", " ", "No", "kia", " ", "Sie", "mens", " ", "Network", "s", " ", "O", "yj", "_", "\\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_", "\"\"\"", "Thi", "s", " ", "package", " ", "expos", "es", " ", "the", " ", "public", " ", "API", "s", " ", "of", " ", "Robot", " ", "Frame", "work", ".", "\\", "10", ";", "\\", "10", ";", "Un", "less", " ", "state", "d", " ", "other", "wis", "e", ",", " ", "the", " ", "API", "s", " ", "exposed", " ", "in", " ", "this", " ", "module", " ", "are", " ", "consider", "ed", " ", "stable", ",", "\\", "10", ";", "and", " ", "thu", "s", " ", "safe", " ", "to", " ", "use", " ", "whe", "n", " ", "buildi", "ng", " ", "external", " ", "tool", "s", " ", "on", " ", "top", " ", "of", " ", "Robot", " ", "Frame", "work", ".", "\\", "10", ";", "\\", "10", ";", "Curr", "ent", "ly", " ", "exposed", " ", "API", "s", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", ":", "py", ":", "mod", ":`", ".", "logg", "er", "`", " ", "for", " ", "test", " ", "librar", "ies", "'", " ", "logg", "ing", " ", "purpose", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", ":", "py", ":", "func", ":`", "~", "robot", ".", "result", ".", "result", "builde", "r", ".", "Execut", "ion", "Result", "`", " ", "for", " ", "readi", "ng", "\\", "10", ";", " ", " ", " ", " ", "executi", "on", " ", "results", " ", "from", " ", "XML", " ", "output", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", ":", "py", ":", "class", ":`", "~", "robot", ".", "pars", "ing", ".", "model", ".", "Test", "Case", "File", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "class", ":`", "~", "robot", ".", "pars", "ing", ".", "model", ".", "Test", "Data", "Director", "y", "`", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "class", ":`", "~", "robot", ".", "pars", "ing", ".", "model", ".", "Reso", "urc", "e", "File", "`", " ", "for", " ", "pars", "ing", " ", "data", " ", "files", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "addition", ",", " ", "a", " ", "convenien", "ce", " ", "factor", "y", " ", "function", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "func", ":`", "~", "robot", ".", "pars", "ing", ".", "model", ".", "Test", "Data", "`", " ", "create", "s", " ", "eit", "her", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "class", ":`", "~", "robot", ".", "pars", "ing", ".", "model", ".", "Test", "Case", "File", "`", " ", "or", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "class", ":`", "~", "robot", ".", "pars", "ing", ".", "model", ".", "Test", "Data", "Director", "y", "`", " ", "based", " ", "on", " ", "the", " ", "input", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", ":", "py", ":", "func", ":`", "~", "robot", ".", "runn", "ing", ".", "model", ".", "Test", "Suit", "e", "`", " ", "for", " ", "creati", "ng", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "test", " ", "suit", "e", " ", "tha", "t", " ", "can", " ", "be", " ", "executed", ".", " ", "Thi", "s", " ", "API", " ", "is", " ", "goi", "ng", " ", "to", " ", "change", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "Robot", " ", "Frame", "work", " ", "2.8", ".", "\\", "10", ";", "\\", "10", ";", "The", "se", " ", "names", " ", "can", " ", "be", " ", "import", "ed", " ", "like", " ", "this", ":", "\\", "10", ";", "\\", "10", ";", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "robot", ".", "api", " ", "import", " ", "<", "name", ">", "\\", "10", ";", "\\", "10", ";", "See", " ", "documentation", "s", " ", "of", " ", "the", " ", "individual", " ", "API", "s", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "robot_", "._", "parsing_", "import_", "Test", "Case", "File_", ",_", "Test", "Data", "Directory_", ",_", "Reso", "urc", "e", "File_", ",_", "Test", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "result_", "import_", "Execut", "ion", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "running_", "import_", "Test", "Suite_" ]
[ 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,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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
azoft-dev-team/imagrium/env/Lib/test/test_java_list_delegate.py
[ { "content": " def check_list(self, control, results, list_type_names, initial, test_name):\n for result, type_name in zip(results, list_type_names):\n try:\n len(result)\n except:\n print result\n self.assertEquals(len(control), len(result), \"%s: length for %s does not match that of list\" % (test_name, type_name))\n for control_value, result_value in zip(control, result):\n self.assertEquals(control_value, result_value, \"%s: values from %s do not match those from list\" % (test_name, type_name))", "metadata": "root.CollectionProxyTest.check_list", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 } ]
[ { "span": "except:", "start_line": 35, "start_column": 12, "end_line": 35, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "list_", "(_", "self_", ",_", "control_", ",_", "results_", ",_", "list", "\\u", "type", "\\u", "names_", ",_", "initial_", ",_", "test\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "result_", ",_", "type", "\\u", "name_", "in_", "zip_", "(_", "results_", ",_", "list", "\\u", "type", "\\u", "names_", ")_", ":_", "\\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 ", " _", "len_", "(_", "result_", ")_", "\\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 ", " _", "print_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "control_", ")_", ",_", "len_", "(_", "result_", ")_", ",_", "\"%", "s", ":", " ", "length", " ", "for", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "match", " ", "tha", "t", " ", "of", " ", "list", "\"_", "%_", "(_", "test\\u", "name_", ",_", "type", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "control", "\\u", "value_", ",_", "result", "\\u", "value_", "in_", "zip_", "(_", "control_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "control", "\\u", "value_", ",_", "result", "\\u", "value_", ",_", "\"%", "s", ":", " ", "values", " ", "from", " ", "%", "s", " ", "do", " ", "not", " ", "match", " ", "tho", "se", " ", "from", " ", "list", "\"_", "%_", "(_", "test\\u", "name_", ",_", "type", "\\u", "name_", ")_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
istresearch/scrapy-cluster/utils/tests/tests_online.py
[ { "content": "'''\nOnline utils test\n'''\nimport unittest\nfrom unittest import TestCase\nfrom mock import MagicMock\nimport time\n\nimport redis\nimport argparse\n\nfrom scutils.redis_queue import RedisQueue, RedisPriorityQueue, RedisStack\n\nfrom scutils.stats_collector import (ThreadedCounter, TimeWindow,\n RollingTimeWindow, Counter, UniqueCounter,\n HyperLogLogCounter, BitMapCounter)\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\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description=\"Online deployment Test\"\n \" Script for Utils\")\n parser.add_argument('-r', '--redis-host', action='store',\n default='localhost', help=\"The Redis host ip\")\n parser.add_argument('-p', '--redis-port', action='store', default='6379',\n help=\"The Redis port\")\n\n args = vars(parser.parse_args())\n redis_conn = redis.Redis(host=args['redis_host'], port=args['redis_port'])\n\n # build testing suite\n suite = unittest.TestSuite()\n\n # moved to the top to help get better consistency\n suite.addTest(TestStatsHyperLogLogCounter('test_hll_counter', redis_conn))\n suite.addTest(TestStatsHyperLogLogCounter('test_roll_hll_counter',\n redis_conn))\n\n suite.addTest(TestRedisFifoQueue('test_fifo_queue', redis_conn))\n suite.addTest(TestRedisPriorityQueue('test_priority_queue', redis_conn))\n suite.addTest(TestRedisStack('test_stack', redis_conn))\n\n suite.addTest(TestStatsThreaded('test_set_key', redis_conn))\n suite.addTest(TestStatsThreaded('test_is_expired', redis_conn))\n suite.addTest(TestStatsThreaded('test_threading', redis_conn))\n suite.addTest(TestStatsThreaded('test_purge_old', redis_conn))\n\n suite.addTest(TestStatsTimeWindow('test_window', redis_conn))\n suite.addTest(TestStatsTimeWindow('test_roll_window', redis_conn))\n\n suite.addTest(TestStatsRollingTimeWindow('test_rolling_window',\n redis_conn))\n\n suite.addTest(TestStatsCounter('test_generic_counter', redis_conn))\n suite.addTest(TestStatsCounter('test_roll_generic_counter', redis_conn))\n\n suite.addTest(TestStatsUniqueCounter('test_uniques', redis_conn))\n suite.addTest(TestStatsUniqueCounter('test_roll_uniques', redis_conn))\n\n suite.addTest(TestStatsBitMapCounter('test_bitmap_counter', redis_conn))\n suite.addTest(TestStatsBitMapCounter('test_roll_bitmap_counter',\n redis_conn))\n\n unittest.TextTestRunner(verbosity=2).run(suite)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import unittest", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "On", "line", " ", "util", "s", " ", "test", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "redis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scu", "tils_", "._", "redis", "\\u", "queue_", "import_", "Red", "is", "Queue_", ",_", "Red", "is", "Prior", "it", "y", "Queue_", ",_", "Red", "is", "Stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scu", "tils_", "._", "stats", "\\u", "collector_", "import_", "(_", "Thread", "ed", "Counter_", ",_", "Time", "Window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Roll", "ing", "Time", "Window_", ",_", "Counter_", ",_", "Unique", "Counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hyper", "Log", "Log", "Counter_", ",_", "Bit", "Map", "Counter_", ")_", "\\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\\uNEWLINE\\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 ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "On", "line", " ", "deploy", "ment", " ", "Test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "Script", " ", "for", " ", "Ut", "il", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "r", "'_", ",_", "'--", "redis", "-", "host", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "local", "host", "'_", ",_", "help_", "=_", "\"", "The", " ", "Red", "is", " ", "host", " ", "ip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "'--", "redis", "-", "port", "'_", ",_", "action_", "=_", "'", "store", "'_", ",_", "default_", "=_", "'", "6379", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "The", " ", "Red", "is", " ", "port", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "vars_", "(_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redis", "\\u", "conn_", "=_", "redis_", "._", "Redis_", "(_", "host_", "=_", "args_", "[_", "'", "redis", "\\u", "host", "'_", "]_", ",_", "port_", "=_", "args_", "[_", "'", "redis", "\\u", "port", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "testi", "ng", " ", "suite_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "moved", " ", "to", " ", "the", " ", "top", " ", "to", " ", "help", " ", "get", " ", "bett", "er", " ", "consiste", "ncy_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Hyper", "Log", "Log", "Counter_", "(_", "'", "test\\u", "hl", "l\\u", "counter", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Hyper", "Log", "Log", "Counter_", "(_", "'", "test\\u", "roll", "\\u", "hl", "l\\u", "counter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Red", "is", "Fi", "fo", "Queue_", "(_", "'", "test\\u", "fifo", "\\u", "queue", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Red", "is", "Prior", "it", "y", "Queue_", "(_", "'", "test\\u", "priorit", "y", "\\u", "queue", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Red", "is", "Stack_", "(_", "'", "test\\u", "stack", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Thread", "ed_", "(_", "'", "test\\u", "set\\u", "key", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Thread", "ed_", "(_", "'", "test\\u", "is", "\\u", "expir", "ed", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Thread", "ed_", "(_", "'", "test\\u", "thread", "ing", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Thread", "ed_", "(_", "'", "test\\u", "pur", "ge", "\\u", "old", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Time", "Window_", "(_", "'", "test\\u", "window", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Time", "Window_", "(_", "'", "test\\u", "roll", "\\u", "window", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Roll", "ing", "Time", "Window_", "(_", "'", "test\\u", "rolling", "\\u", "window", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Counter_", "(_", "'", "test\\u", "gener", "ic", "\\u", "counter", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Counter_", "(_", "'", "test\\u", "roll", "\\u", "gener", "ic", "\\u", "counter", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Unique", "Counter_", "(_", "'", "test\\u", "unique", "s", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Unique", "Counter_", "(_", "'", "test\\u", "roll", "\\u", "unique", "s", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Bit", "Map", "Counter_", "(_", "'", "test\\u", "bitmap", "\\u", "counter", "'_", ",_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "add", "Test_", "(_", "Test", "Stat", "s", "Bit", "Map", "Counter_", "(_", "'", "test\\u", "roll", "\\u", "bitmap", "\\u", "counter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redis", "\\u", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "suite_", ")_", "\\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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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 ]
Unused import
ofri/Open-Knesset/video/migrations/0002_add_field_video_group.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'video.video': {\n 'Meta': {'object_name': 'Video'},\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'description': ('django.db.models.fields.CharField', [], {'max_length': '2000'}),\n 'embed_link': ('django.db.models.fields.URLField', [], {'max_length': '1000'}),\n 'group': ('django.db.models.fields.CharField', [], {'max_length': '20'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'image_link': ('django.db.models.fields.URLField', [], {'max_length': '1000'}),\n 'link': ('django.db.models.fields.URLField', [], {'max_length': '1000'}),\n 'object_pk': ('django.db.models.fields.TextField', [], {}),\n 'source_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'source_type': ('django.db.models.fields.CharField', [], {'max_length': '50'}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '500'})\n }\n }\n\n complete_apps = ['video']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \n # Adding field 'Video.group'\n db.add_column('video_video', 'group', self.gf('django.db.models.fields.CharField')(default='', max_length=20), keep_default=False)", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \n # Deleting field 'Video.group'\n db.delete_column('video_video', 'group')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\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_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "video", ".", "video", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Vid", "eo", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "2000", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "embed", "\\u", "link", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1000", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "20", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "\\u", "link", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1000", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "URL", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1000", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "pk", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "500", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "video", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Vid", "eo", ".", "group", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "'", "video", "\\u", "video", "'_", ",_", "'", "group", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "''_", ",_", "max", "\\u", "length_", "=_", "20_", ")_", ",_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Vid", "eo", ".", "group", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "column_", "(_", "'", "video", "\\u", "video", "'_", ",_", "'", "group", "'_", ")_", "\\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, 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, 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 ]
Unused local variable
tuturto/pyherc/src/pyherc/data/model.py
[ { "content": " @log_debug\n def raise_event(self, event):\n \"\"\"\n Relays event to creatures\n\n :param event: event to relay\n :type event: dict\n \"\"\"\n level = e_level(event)\n\n if self.player:\n self.player.receive_event(event)\n\n for listener in self.__event_listeners:\n listener.receive_event(event)", "metadata": "root.Model.raise_event", "header": "['class', 'Model', '(', ')', ':', '___EOS___']", "index": 69 } ]
[ { "span": "level ", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Model_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "log", "\\u", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "raise", "\\u", "event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rela", "ys", " ", "event", " ", "to", " ", "creature", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "event", ":", " ", "event", " ", "to", " ", "relay", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "event", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "e\\u", "level_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "player_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "player_", "._", "receive", "\\u", "event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "listener_", "in_", "self_", "._", "\\u\\u", "event", "\\u", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "receive", "\\u", "event_", "(_", "event_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
OpenMDAO/OpenMDAO-Framework/openmdao.units/openmdao/units/test/test_units.py
[ { "content": " def test_init(self):\n #__init__ should have the same result regardless of the \n #constructor calling pattern\n \n \n x=units.PhysicalQuantity('1m')\n y=units.PhysicalQuantity(1,'m')\n self.assertEqual(x.value,y.value)\n self.assertEqual(x.unit,y.unit)\n \n z=units.PhysicalQuantity('1dam') #check for two letter prefixes\n \n #error for improper init argument\n try:\n x=units.PhysicalQuantity('m')\n except TypeError,err:\n self.assertEqual(str(err),\"No number found in input argument: 'm'\")\n else:\n self.fail(\"Expecting TypeError\")\n \n try:\n x=units.PhysicalQuantity('1in')\n except ValueError,err:\n self.assertEqual(str(err),\"no unit named 'in' is defined\")\n else:\n self.fail(\"Expecting ValueError\")\n \n try:\n x=units.PhysicalQuantity(1,None)\n except TypeError,err:\n self.assertEqual(str(err),\"None is not a unit\")\n else:\n self.fail(\"Expecting TypeError\") ", "metadata": "root.test__PhysicalQuantity.test_init", "header": "['class', 'test__PhysicalQuantity', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_currency_unit(self):\n # probably don't need this test, since I changed $ to USD\n try:\n x = units.PhysicalQuantity('1USD')\n except ValueError:\n self.fail(\"Error: Currency Unit (USD) is not working\")", "metadata": "root.test__PhysicalQuantity.test_currency_unit", "header": "['class', 'test__PhysicalQuantity', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 211 }, { "content": " def test_prefix_plus_math(self):\n # From an issue: m**2 converts fine, but cm**2 does not.\n \n x1 = units.convert_units(1.0, 'm**2', 'cm**2')\n self.assertEqual(x1, 10000.0)\n \n \n # Let's make sure we can dclare some complicated units\n x = units.PhysicalQuantity('7200nm**3/kPa*dL')\n \n #from issue 825, make sure you can handle single characters before a /\n x = units.PhysicalQuantity('1 g/kW')", "metadata": "root.test__PhysicalQuantity.test_prefix_plus_math", "header": "['class', 'test__PhysicalQuantity', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test_in_units_of(self):\n #in_units_of should return a new PhysicalQuantity with the requested unit, leaving the old unit as it was\n\n x=units.PhysicalQuantity('5cm')\n y = x.in_units_of('m')\n self.assertEqual(y,units.PhysicalQuantity('0.05m'))\n self.assertEqual(x,units.PhysicalQuantity('5cm'))\n \n x=units.PhysicalQuantity('5cm')\n try:\n y = x.in_units_of('degC')\n except TypeError,err:\n self.assertEqual(str(err),'Incompatible units')\n else: \n self.fail(\"TypeError expected\") ", "metadata": "root.test__PhysicalQuantity.test_in_units_of", "header": "['class', 'test__PhysicalQuantity', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 555 }, { "content": " def test_conversion_tuple_to(self):\n #test_conversion_tuple_to shoudl error when units have different power lists\n\n w = units.PhysicalQuantity('1cm')\n x = units.PhysicalQuantity('1m')\n y = units.PhysicalQuantity('1degF')\n z1 = units.PhysicalQuantity('1degC')\n z2 = units.PhysicalQuantity('1degK')\n \n #check for non offset units\n self.assertEqual(w.unit.conversion_tuple_to(x.unit),(1/100.0,0))\n \n #check for offset units\n result = y.unit.conversion_tuple_to(z1.unit)\n self.assertAlmostEqual(result[0],0.556,3)\n self.assertAlmostEqual(result[1],-32.0,3)\n \n #check for incompatible units\n try:\n x.unit.conversion_tuple_to(z1.unit)\n except TypeError,err: \n self.assertEqual(str(err),\"Incompatible units\")\n else:\n self.fail(\"Expecting TypeError\")", "metadata": "root.test__PhysicalUnit.test_conversion_tuple_to", "header": "['class', 'test__PhysicalUnit', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 753 } ]
[ { "span": "z=", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 9 }, { "span": "x=", "start_line": 178, "start_column": 12, "end_line": 178, "end_column": 13 }, { "span": "x ", "start_line": 214, "start_column": 12, "end_line": 214, "end_column": 13 }, { "span": "x ", "start_line": 256, "start_column": 8, "end_line": 256, "end_column": 9 }, { "span": "y ", "start_line": 565, "start_column": 12, "end_line": 565, "end_column": 13 }, { "span": "z2 ", "start_line": 760, "start_column": 8, "end_line": 760, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "test\\u", "\\u", "Phys", "ical", "Quantity_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#\\u", "\\u", "init", "\\u\\u", " ", "shou", "ld", " ", "have", " ", "the", " ", "same", " ", "result", " ", "rega", "rd", "less", " ", "of", " ", "the", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "construct", "or", " ", "calling", " ", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "1_", ",_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", "._", "value_", ",_", "y_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", "._", "unit_", ",_", "y_", "._", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1d", "am", "'_", ")_", "#", "check", " ", "for", " ", "two", " ", "letter", " ", "prefixes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "error", " ", "for", " ", "impro", "per", " ", "init", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "\"", "No", " ", "number", " ", "found", " ", "in", " ", "input", " ", "argu", "ment", ":", " ", "'", "m", "'\"_", ")_", "\\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_", "._", "fail_", "(_", "\"", "Expecti", "ng", " ", "Type", "Error", "\"_", ")_", "\\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 ", " _", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1i", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "\"", "no", " ", "unit", " ", "named", " ", "'", "in", "'", " ", "is", " ", "defin", "ed", "\"_", ")_", "\\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_", "._", "fail_", "(_", "\"", "Expecti", "ng", " ", "Value", "Error", "\"_", ")_", "\\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 ", " _", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "1_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "\"", "Non", "e", " ", "is", " ", "not", " ", "a", " ", "unit", "\"_", ")_", "\\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_", "._", "fail_", "(_", "\"", "Expecti", "ng", " ", "Type", "Error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "test\\u", "\\u", "Phys", "ical", "Quantity_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "curr", "ency", "\\u", "unit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "probab", "ly", " ", "don", "'", "t", " ", "need", " ", "this", " ", "test", ",", " ", "sinc", "e", " ", "I", " ", "change", "d", " ", "$", " ", "to", " ", "US", "D_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1", "US", "D", "'_", ")_", "\\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 ", " _", "self_", "._", "fail_", "(_", "\"", "Error", ":", " ", "Currenc", "y", " ", "Unit", " ", "(", "US", "D", ")", " ", "is", " ", "not", " ", "working", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "test\\u", "\\u", "Phys", "ical", "Quantity_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "prefix", "\\u", "plus", "\\u", "math_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fro", "m", " ", "an", " ", "issue", ":", " ", "m", "**", "2", " ", "convert", "s", " ", "fine", ",", " ", "but", " ", "cm", "**", "2", " ", "doe", "s", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x1_", "=_", "units_", "._", "convert", "\\u", "units_", "(_", "1.0_", ",_", "'", "m", "**", "2", "'_", ",_", "'", "cm", "**", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x1_", ",_", "10000", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Let", "'", "s", " ", "make", " ", "sure", " ", "we", " ", "can", " ", "dcl", "are", " ", "some", " ", "compli", "cated", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "7200", "nm", "**", "3", "/", "k", "Pa", "*", "d", "L", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "issue", " ", "825", ",", " ", "make", " ", "sure", " ", "you", " ", "can", " ", "handle", " ", "single", " ", "character", "s", " ", "bef", "ore", " ", "a", " ", "/_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1", " ", "g", "/", "k", "W", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "test\\u", "\\u", "Phys", "ical", "Quantity_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "in", "\\u", "unit", "s", "\\u", "of_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "in", "\\u", "unit", "s", "\\u", "of", " ", "shou", "ld", " ", "return", " ", "a", " ", "new", " ", "Phys", "ical", "Quanti", "ty", " ", "with", " ", "the", " ", "request", "ed", " ", "unit", ",", " ", "leaving", " ", "the", " ", "old", " ", "unit", " ", "as", " ", "it", " ", "was", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "5c", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "x_", "._", "in", "\\u", "unit", "s", "\\u", "of_", "(_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "y_", ",_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "0.05", "m", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "x_", ",_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "5c", "m", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "5c", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "x_", "._", "in", "\\u", "unit", "s", "\\u", "of_", "(_", "'", "deg", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "'", "Incomp", "atible", " ", "unit", "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 ", " _", "self_", "._", "fail_", "(_", "\"", "Type", "Error", " ", "expected", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "test\\u", "\\u", "Phys", "ical", "Unit_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "conve", "rsi", "on", "\\u", "tuple", "\\u", "to_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "test\\u", "conve", "rsi", "on", "\\u", "tuple", "\\u", "to", " ", "shou", "dl", " ", "error", " ", "whe", "n", " ", "unit", "s", " ", "have", " ", "different", " ", "power", " ", "lists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1c", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1d", "eg", "F", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z1_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1d", "eg", "C", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z2_", "=_", "units_", "._", "Phys", "ical", "Quantity_", "(_", "'", "1d", "eg", "K", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "non", " ", "offset", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "w_", "._", "unit_", "._", "conve", "rsi", "on", "\\u", "tuple", "\\u", "to_", "(_", "x_", "._", "unit_", ")_", ",_", "(_", "1_", "/_", "100.0_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "offset", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "y_", "._", "unit_", "._", "conve", "rsi", "on", "\\u", "tuple", "\\u", "to_", "(_", "z1_", "._", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "result_", "[_", "0_", "]_", ",_", "0.55", "6_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "result_", "[_", "1_", "]_", ",_", "-_", "32.", "0_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "incomp", "atible", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "._", "unit_", "._", "conve", "rsi", "on", "\\u", "tuple", "\\u", "to_", "(_", "z1_", "._", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "str_", "(_", "err_", ")_", ",_", "\"", "Incomp", "atible", " ", "unit", "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 ", " _", "self_", "._", "fail_", "(_", "\"", "Expecti", "ng", " ", "Type", "Error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4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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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
geopy/geopy/geopy/__init__.py
[ { "content": "\"\"\"\ngeopy is a Python 2 and 3 client for several popular geocoding web services.\n\ngeopy makes it easy for Python developers to locate the coordinates of\naddresses, cities, countries, and landmarks across the globe using third-party\ngeocoders and other data sources.\n\ngeopy is tested against CPython 2.7, CPython 3.2, CPython 3.4, PyPy, and PyPy3.\n\"\"\"\n\nfrom geopy.point import Point\nfrom geopy.location import Location\nfrom geopy.geocoders import * # pylint: disable=W0401\nfrom geopy.util import __version__\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from geopy.point import Point", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 29 }, { "span": "from geopy.location import Location", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "geop", "y", " ", "is", " ", "a", " ", "Pyth", "on", " ", "2", " ", "and", " ", "3", " ", "client", " ", "for", " ", "sever", "al", " ", "popular", " ", "geoc", "odi", "ng", " ", "web", " ", "service", "s", ".", "\\", "10", ";", "\\", "10", ";", "geop", "y", " ", "make", "s", " ", "it", " ", "easy", " ", "for", " ", "Pyth", "on", " ", "developer", "s", " ", "to", " ", "locat", "e", " ", "the", " ", "coordinate", "s", " ", "of", "\\", "10", ";", "addresse", "s", ",", " ", "citi", "es", ",", " ", "countr", "ies", ",", " ", "and", " ", "landmarks", " ", "acro", "ss", " ", "the", " ", "glob", "e", " ", "usi", "ng", " ", "third", "-", "part", "y", "\\", "10", ";", "geocode", "rs", " ", "and", " ", "other", " ", "data", " ", "source", "s", ".", "\\", "10", ";", "\\", "10", ";", "geop", "y", " ", "is", " ", "tested", " ", "against", " ", "CP", "yth", "on", " ", "2.7", ",", " ", "CP", "yth", "on", " ", "3.2", ",", " ", "CP", "yth", "on", " ", "3.4", ",", " ", "Py", "Py", ",", " ", "and", " ", "Py", "Py", "3", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "geop", "y_", "._", "point_", "import_", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "geop", "y_", "._", "location_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "geop", "y_", "._", "geocode", "rs_", "import_", "*_", "#", " ", "pylint", ":", " ", "disable", "=", "W", "040", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "geop", "y_", "._", "util_", "import_", "\\u\\u", "version\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 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
HewlettPackard/python-hpOneView/examples/scripts/del-san-manager.py
[ { "content": "#!/usr/bin/env python\n#\n# (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import division\nfrom __future__ import absolute_import\nfrom builtins import range\nfrom future import standard_library\nstandard_library.install_aliases()\nimport sys\nimport argparse\nfrom pprint import pprint\n\n\nPYTHON_VERSION = sys.version_info[:3]\nPY2 = (PYTHON_VERSION[0] == 2)\nif PY2:\n if PYTHON_VERSION < (2, 7, 9):\n raise Exception('Must use Python 2.7.9 or later')\nelif PYTHON_VERSION < (3, 4):\n raise Exception('Must use Python 3.4 or later')\n\nimport hpOneView as hpov\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n sys.exit(main())\n\n# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def acceptEULA(con):\n # See if we need to accept the EULA before we try to log in\n con.get_eula_status()\n try:\n if con.get_eula_status() is True:\n print('EULA display needed')\n con.set_eula('no')\n except Exception as e:\n print('EXCEPTION:')\n print(e)", "metadata": "root.acceptEULA", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def login(con, credential):\n # Login with givin credentials\n try:\n con.login(credential)\n except:\n print('Login failed')", "metadata": "root.login", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def del_all_san_managers(fcs):\n managers = fcs.get_device_managers()\n if not managers['members']:\n print('Error, can not locate device managers')\n sys.exit()\n members = managers['members']\n for mbr in members:\n if mbr['name'] != 'Local Direct Attach Manager':\n print('Removing: ', mbr['name'])\n fcs.remove_device_manager(mbr)", "metadata": "root.del_all_san_managers", "header": "['module', '___EOS___']", "index": 65 }, { "content": "def del_san_manager_by_name(fcs, name):\n managers = fcs.get_device_managers()\n if not managers['members']:\n print('Error, can not locate device managers')\n sys.exit()\n members = managers['members']\n for mbr in members:\n if mbr['name'] == name:\n print('Removing: ', mbr['name'])\n fcs.remove_device_manager(mbr)", "metadata": "root.del_san_manager_by_name", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def main():\n parser = argparse.ArgumentParser(add_help=True,\n formatter_class=argparse.RawTextHelpFormatter,\n description='''\n Delete individual or ALL SAN Managers\n\n Usage: ''')\n parser.add_argument('-a', dest='host', required=True,\n help='''\n HP OneView Appliance hostname or IP address''')\n parser.add_argument('-u', dest='user', required=False,\n default='Administrator',\n help='''\n HP OneView Username''')\n parser.add_argument('-p', dest='passwd', required=True,\n help='''\n HP OneView Password''')\n parser.add_argument('-c', dest='cert', required=False,\n help='''\n Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format''')\n parser.add_argument('-y', dest='proxy', required=False,\n help='''\n Proxy (host:port format''')\n parser.add_argument('-j', dest='domain', required=False,\n default='Local',\n help='''\n HP OneView Authorized Login Domain''')\n group = parser.add_mutually_exclusive_group(required=True)\n group.add_argument('-d', dest='delete_all', action='store_true',\n help='''\n Delete ALL SAN Managers''')\n group.add_argument('-n', dest='name',\n help='''\n Name of the SAN Manager to delete''')\n\n args = parser.parse_args()\n credential = {'authLoginDomain': args.domain.upper(), 'userName': args.user, 'password': args.passwd}\n\n con = hpov.connection(args.host)\n fcs = hpov.fcsans(con)\n\n if args.proxy:\n con.set_proxy(args.proxy.split(':')[0], args.proxy.split(':')[1])\n if args.cert:\n con.set_trusted_ssl_bundle(args.cert)\n\n login(con, credential)\n acceptEULA(con)\n\n if args.delete_all:\n del_all_san_managers(fcs)\n sys.exit()\n\n del_san_manager_by_name(fcs, args.name)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 89 } ]
[ { "span": "from builtins import range", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 26 }, { "span": "from pprint import pprint", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 25 } ]
[]
1
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_", "#", " ", "(", "C", ")", " ", "Copy", "right", " ", "(", "2012", "-", "201", "5", ")", " ", "He", "wle", "tt", " ", "Packa", "rd", " ", "Enter", "pris", "e", " ", "Dev", "elo", "pme", "nt", " ", "LP", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "builtins_", "import_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "import_", "standard", "\\u", "library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "standard", "\\u", "library_", "._", "install", "\\u", "aliases_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PYTHON", "\\u", "VERSION_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "2_", "=_", "(_", "PYTHON", "\\u", "VERSION_", "[_", "0_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "PYTHON", "\\u", "VERSION_", "<_", "(_", "2_", ",_", "7_", ",_", "9_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Mus", "t", " ", "use", " ", "Pyth", "on", " ", "2.7", ".9", " ", "or", " ", "late", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "PYTHON", "\\u", "VERSION_", "<_", "(_", "3_", ",_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Mus", "t", " ", "use", " ", "Pyth", "on", " ", "3.4", " ", "or", " ", "late", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "hp", "One", "View_", "as_", "hp", "ov_", "\\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\\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_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\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_", "accept", "EU", "LA_", "(_", "con_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "we", " ", "need", " ", "to", " ", "accept", " ", "the", " ", "EU", "LA", " ", "bef", "ore", " ", "we", " ", "try", " ", "to", " ", "log", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "._", "get", "\\u", "eu", "la", "\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "con_", "._", "get", "\\u", "eu", "la", "\\u", "status_", "(_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "EU", "LA", " ", "display", " ", "need", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "con_", "._", "set\\u", "eu", "la_", "(_", "'", "no", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "(_", "'", "EXCEPTION", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "e_", ")_", "\\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_", "login_", "(_", "con_", ",_", "credential_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Logi", "n", " ", "with", " ", "gi", "vin", " ", "credentials_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "._", "login_", "(_", "credential_", ")_", "\\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 ", " _", "print_", "(_", "'", "Logi", "n", " ", "fail", "ed", "'_", ")_", "\\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_", "del", "\\u", "all", "\\u", "san", "\\u", "managers_", "(_", "fcs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "managers_", "=_", "fcs", "_", "._", "get", "\\u", "device", "\\u", "managers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "managers_", "[_", "'", "member", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Error", ",", " ", "can", " ", "not", " ", "locat", "e", " ", "device", " ", "manage", "rs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "members_", "=_", "managers_", "[_", "'", "member", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mbr", "_", "in_", "members_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mbr", "_", "[_", "'", "name", "'_", "]_", "!=_", "'", "Local", " ", "Direct", " ", "Attach", " ", "Manager", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Remo", "ving", ":", " ", "'_", ",_", "mbr", "_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fcs", "_", "._", "remove", "\\u", "device", "\\u", "manager_", "(_", "mbr", "_", ")_", "\\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_", "def_", "del", "\\u", "san", "\\u", "manage", "r", "\\u", "by", "\\u", "name_", "(_", "fcs", "_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "managers_", "=_", "fcs", "_", "._", "get", "\\u", "device", "\\u", "managers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "managers_", "[_", "'", "member", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Error", ",", " ", "can", " ", "not", " ", "locat", "e", " ", "device", " ", "manage", "rs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "members_", "=_", "managers_", "[_", "'", "member", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mbr", "_", "in_", "members_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mbr", "_", "[_", "'", "name", "'_", "]_", "==_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Remo", "ving", ":", " ", "'_", ",_", "mbr", "_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fcs", "_", "._", "remove", "\\u", "device", "\\u", "manager_", "(_", "mbr", "_", ")_", "\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "add", "\\u", "help_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatter", "\\u", "class_", "=_", "argparse_", "._", "Ra", "w", "Text", "Help", "Formatter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "individual", " ", "or", " ", "ALL", " ", "SAN", " ", "Manager", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", ":", " ", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "a", "'_", ",_", "dest_", "=_", "'", "host", "'_", ",_", "required_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", "HP", " ", "One", "View", " ", "Appliance", " ", "host", "name", " ", "or", " ", "IP", " ", "address", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "u", "'_", ",_", "dest_", "=_", "'", "user", "'_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "Administra", "tor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", "HP", " ", "One", "View", " ", "User", "name", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "p", "'_", ",_", "dest_", "=_", "'", "passw", "d", "'_", ",_", "required_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", "HP", " ", "One", "View", " ", "Passw", "ord", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "dest_", "=_", "'", "cert", "'_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", "Trust", "ed", " ", "SS", "L", " ", "Certificat", "e", " ", "Bun", "dle", " ", "in", " ", "PEM", " ", "(", "Base", "64", " ", "Encode", "d", " ", "DER", ")", " ", "Format", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "y", "'_", ",_", "dest_", "=_", "'", "proxy", "'_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", "Pro", "xy", " ", "(", "host", ":", "port", " ", "format", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "j", "'_", ",_", "dest_", "=_", "'", "domain", "'_", ",_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "Local", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", "HP", " ", "One", "View", " ", "Authorized", " ", "Logi", "n", " ", "Doma", "in", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "dest_", "=_", "'", "delete", "\\u", "all", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", " ", "Delete", " ", "ALL", " ", "SAN", " ", "Manager", "s", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "._", "add", "\\u", "argument_", "(_", "'-", "n", "'_", ",_", "dest_", "=_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "\\", "10", ";", " ", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "SAN", " ", "Manager", " ", "to", " ", "delete", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "credential_", "=_", "{_", "'", "auth", "Logi", "n", "Doma", "in", "'_", ":_", "args_", "._", "domain_", "._", "upper_", "(_", ")_", ",_", "'", "user", "Name", "'_", ":_", "args_", "._", "user_", ",_", "'", "password", "'_", ":_", "args_", "._", "passwd_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "con_", "=_", "hp", "ov_", "._", "connection_", "(_", "args_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fcs", "_", "=_", "hp", "ov_", "._", "fcs", "ans_", "(_", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "._", "set\\u", "proxy_", "(_", "args_", "._", "proxy_", "._", "split_", "(_", "':'_", ")_", "[_", "0_", "]_", ",_", "args_", "._", "proxy_", "._", "split_", "(_", "':'_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "cert_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "._", "set\\u", "trusted", "\\u", "ssl", "\\u", "bundle_", "(_", "args_", "._", "cert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "login_", "(_", "con_", ",_", "credential_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accept", "EU", "LA_", "(_", "con_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "delete", "\\u", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del", "\\u", "all", "\\u", "san", "\\u", "managers_", "(_", "fcs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del", "\\u", "san", "\\u", "manage", "r", "\\u", "by", "\\u", "name_", "(_", "fcs", "_", ",_", "args_", "._", "name_", ")_", "\\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, 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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 ]
Unused local variable
saghul/uvwsgi/uvwsgi.py
[ { "content": " def run_wsgi(self):\n headers_set = []\n headers_sent = []\n\n def write(data):\n if not headers_set:\n raise AssertionError(\"write() before start_response()\")\n elif not headers_sent:\n # Before the first output, send the stored headers\n buf = []\n status, response_headers = headers_sent[:] = headers_set\n code, _, msg = status.partition(' ')\n buf.append(wsgi_to_bytes('%s %d %s\\r\\n' % (self.protocol_version, int(code), msg)))\n header_keys = set()\n for key, value in response_headers:\n buf.append(wsgi_to_bytes('%s: %s\\r\\n' % (key, value)))\n header_keys.add(key.lower())\n if 'content-length' not in header_keys:\n self.close_connection = True\n if 'server' not in header_keys:\n buf.append(wsgi_to_bytes('Server: uvwsgi/%s\\r\\n' % __version__))\n if 'date' not in header_keys:\n buf.append(wsgi_to_bytes('Date: %s\\r\\n' % date_time_string()))\n buf.append(b'\\r\\n')\n self.connection.write(b''.join(buf))\n\n assert type(data) is bytes, 'applications must write bytes'\n self.connection.write(data)\n\n def start_response(status, response_headers, exc_info=None):\n if exc_info:\n try:\n if headers_sent:\n reraise(*exc_info)\n finally:\n exc_info = None\n elif headers_set:\n raise AssertionError(\"Headers already set!\")\n\n headers_set[:] = [status, response_headers]\n # TODO: check hop by hop headers here?\n return write\n\n # Prepare WSGI environment\n env = self.connection.parser.get_wsgi_environ()\n env['wsgi.version'] = (1, 0)\n env['wsgi.url_scheme'] = 'http'\n env['wsgi.input'] = self.body\n env['wsgi.errors'] = ErrorStream(logger)\n env['wsgi.multithread'] = False\n env['wsgi.multiprocess'] = False\n env['wsgi.run_once'] = False\n\n # Run WSGI application\n app = self.connection.server.app\n try:\n app_response = app(env, start_response)\n except Exception:\n logger.exception('Running WSGI application')\n if DEBUG:\n response_body = traceback.format_exc()\n response_headers = [('Content-Type', 'text/plain'),\n ('Content-Length', str(len(response_body)))]\n start_response('500 Internal Server Error', response_headers, exc_info=sys.exc_info())\n app_response = [response_body]\n else:\n self.connection.finish()\n return\n try:\n for data in app_response:\n write(data)\n if not headers_sent:\n write(b'')\n except Exception:\n logger.exception('Running WSGI application')\n finally:\n if hasattr(app_response, 'close'):\n app_response.close()\n self.end()\n if DEBUG:\n status = headers_set[0]\n self._log(int(status.split()[0]))", "metadata": "root.HTTPRequest.run_wsgi", "header": "['class', 'HTTPRequest', '(', 'object', ')', ':', '___EOS___']", "index": 113 } ]
[ { "span": "exc_info ", "start_line": 148, "start_column": 20, "end_line": 148, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "HTTP", "Request_", "(_", "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_", "def_", "run", "\\u", "wsgi_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header", "s", "\\u", "set_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "s", "\\u", "sent_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "write_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "header", "s", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "write", "()", " ", "bef", "ore", " ", "start", "\\u", "response", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "header", "s", "\\u", "sent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Be", "fore", " ", "the", " ", "first", " ", "output", ",", " ", "send", " ", "the", " ", "store", "d", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "response", "\\u", "headers_", "=_", "header", "s", "\\u", "sent_", "[_", ":_", "]_", "=_", "header", "s", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", ",_", "\\u_", ",_", "msg_", "=_", "status_", "._", "partition_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "._", "append_", "(_", "wsgi", "\\u", "to", "\\u", "bytes_", "(_", "'%", "s", " ", "%", "d", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "(_", "self_", "._", "protoc", "ol", "\\u", "version_", ",_", "int_", "(_", "code_", ")_", ",_", "msg_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "keys_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "response", "\\u", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "buf_", "._", "append_", "(_", "wsgi", "\\u", "to", "\\u", "bytes_", "(_", "'%", "s", ":", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "(_", "key_", ",_", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "keys_", "._", "add_", "(_", "key_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "content", "-", "length", "'_", "not_", "in_", "header", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "close", "\\u", "connection_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "server", "'_", "not_", "in_", "header", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "buf_", "._", "append_", "(_", "wsgi", "\\u", "to", "\\u", "bytes_", "(_", "'", "Server", ":", " ", "uv", "wsgi", "/", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "\\u\\u", "version\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "date", "'_", "not_", "in_", "header", "\\u", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "buf_", "._", "append_", "(_", "wsgi", "\\u", "to", "\\u", "bytes_", "(_", "'", "Date", ":", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "date", "\\u", "time", "\\u", "string_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "append_", "(_", "b", "'\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connection_", "._", "write_", "(_", "b", "''_", "._", "join_", "(_", "buf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "type_", "(_", "data_", ")_", "is_", "bytes_", ",_", "'", "applica", "tion", "s", " ", "must", " ", "write", " ", "bytes", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connection_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "response_", "(_", "status_", ",_", "response", "\\u", "headers_", ",_", "exc", "\\u", "info_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "info_", ":_", "\\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_", "header", "s", "\\u", "sent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "reraise", "_", "(_", "*_", "exc", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exc", "\\u", "info_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "header", "s", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Head", "ers", " ", "alr", "ead", "y", " ", "set", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header", "s", "\\u", "set_", "[_", ":_", "]_", "=_", "[_", "status_", ",_", "response", "\\u", "headers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "check", " ", "hop", " ", "by", " ", "hop", " ", "header", "s", " ", "here", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "WS", "GI", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "=_", "self_", "._", "connection_", "._", "parser_", "._", "get", "\\u", "wsgi", "\\u", "environ_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "version", "'_", "]_", "=_", "(_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "url", "\\u", "sche", "me", "'_", "]_", "=_", "'", "http", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "input", "'_", "]_", "=_", "self_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "error", "s", "'_", "]_", "=_", "Error", "Stream_", "(_", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "multit", "hread", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "multipro", "cess", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "[_", "'", "wsgi", ".", "run", "\\u", "onc", "e", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "WS", "GI", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "self_", "._", "connection_", "._", "server_", "._", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "response_", "=_", "app_", "(_", "env_", ",_", "start", "\\u", "response_", ")_", "\\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_", "._", "exception_", "(_", "'", "Run", "ning", " ", "WS", "GI", " ", "applica", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "body_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "headers_", "=_", "[_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "text", "/", "plain", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "str_", "(_", "len_", "(_", "response", "\\u", "body_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "response_", "(_", "'", "500", " ", "Intern", "al", " ", "Server", " ", "Error", "'_", ",_", "response", "\\u", "headers_", ",_", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "response_", "=_", "[_", "response", "\\u", "body_", "]_", "\\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_", "._", "connection_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data_", "in_", "app", "\\u", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "header", "s", "\\u", "sent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "(_", "b", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "'", "Run", "ning", " ", "WS", "GI", " ", "applica", "tion", "'_", ")_", "\\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 ", " _", "if_", "hasattr_", "(_", "app", "\\u", "response_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "response_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "end_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "header", "s", "\\u", "set_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "int_", "(_", "status_", "._", "split_", "(_", ")_", "[_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
lisa-lab/pylearn2/pylearn2/sandbox/cuda_convnet/tests/test_rop_pool.py
[ { "content": "from __future__ import print_function\n\nimport copy\n\nimport numpy\nimport theano\nfrom theano.tensor import grad\nfrom theano.tests import unittest_tools\nimport theano.sandbox.cuda as tcn\nimport warnings\n\nif not tcn.cuda_available:\n from nose.plugins.skip import SkipTest\n raise SkipTest('Optional package cuda disabled.')\n\nfrom pylearn2.sandbox.cuda_convnet.pool import MaxPool, MaxPoolGrad\nfrom pylearn2.models.mlp import max_pool_c01b as gold_max_pool_c01b\n\n\nif theano.config.mode == 'FAST_COMPILE':\n mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')\n mode_without_gpu = theano.compile.mode.get_mode(\n 'FAST_RUN').excluding('gpu')\nelse:\n mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')\n mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')\n\n#The CPU tests already compare C/Py, so we only check C/GPU\nmode_with_gpu = copy.copy(mode_with_gpu)\nmode_without_gpu = copy.copy(mode_without_gpu)\nmode_with_gpu.check_py_code = False\nmode_without_gpu.check_py_code = False\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def my_rand(*shape):\n return theano._asarray(numpy.random.rand(*shape), dtype='float32')", "metadata": "root.my_rand", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def test_pool():\n #(batch, channel, x, y)\n shps = [(1, 1, 2, 2),\n ]\n shps = [(channel, x, y, batch) for (batch, channel, x, y) in shps]\n\n #numpy.random.RandomState(unittest_tools.fetch_seed()).shuffle(shps)\n warnings.warn(\"TODO: Razvan needs to finish this\")\n for shp in shps:\n for ds in range(1, min(4, shp[2] + 1)):\n for start in [0]:\n for stride in range(1, min(shp[2], ds, 4) + 1):\n #print 'test_pool shape=%s, ds=%d, stride=%d start=%d' % (\n # str(shp), ds, stride, start)\n\n va = my_rand(*shp)\n tva = va.flatten()\n #print 'va', tva, tva.max(), tva.argmax()\n\n vb = my_rand(*shp)\n tvb = vb.flatten()\n #print 'vb', tvb, tvb.max(), tvb.argmax(),\\\n # tvb[tva.argmax()]\n a = tcn.shared_constructor(va, 'a')\n b = tcn.shared_constructor(vb, 'b')\n op = MaxPool(ds=ds, stride=stride)\n v = op(a)\n rval = theano.tensor.Rop(v, a, b)\n f = theano.function([], rval,\n mode=mode_with_gpu)\n print(f.maker.fgraph.toposort())\n #ssert any([isinstance(node.op, MaxPool)\n # for node in f.maker.fgraph.toposort()])\n out = numpy.asarray(f())\n #print out\n #print\n #print", "metadata": "root.test_pool", "header": "['module', '___EOS___']", "index": 38 } ]
[ { "span": "from theano.tensor import grad", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 30 }, { "span": "from theano.tests import unittest_tools", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 39 }, { "span": "from pylearn2.sandbox.cuda_convnet.pool import MaxPool, MaxPoolGrad", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 67 }, { "span": "from pylearn2.models.mlp import max_pool_c01b as gold_max_pool_c01b", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 67 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\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_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tensor_", "import_", "grad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tests_", "import_", "unittest", "\\u", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "sandbox_", "._", "cuda_", "as_", "tc", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "tc", "n_", "._", "cud", "a", "\\u", "available_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "nose_", "._", "plugins_", "._", "skip_", "import_", "Ski", "p", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Ski", "p", "Test_", "(_", "'", "Optio", "nal", " ", "package", " ", "cud", "a", " ", "disable", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "sandbox_", "._", "cud", "a", "\\u", "conv", "net_", "._", "pool_", "import_", "Max", "Pool_", ",_", "Max", "Poo", "l", "Grad", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "models_", "._", "mlp", "_", "import_", "max", "\\u", "pool", "\\u", "c0", "1b", "_", "as_", "gold", "\\u", "max", "\\u", "pool", "\\u", "c0", "1b", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "theano_", "._", "config_", "._", "mode_", "==_", "'", "FAST", "\\u", "COMPIL", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode", "\\u", "with", "\\u", "gpu_", "=_", "theano_", "._", "compile_", "._", "mode_", "._", "get", "\\u", "mode_", "(_", "'", "FAST", "\\u", "RUN", "'_", ")_", "._", "inclu", "ding_", "(_", "'", "gpu", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "\\u", "with", "out", "\\u", "gpu_", "=_", "theano_", "._", "compile_", "._", "mode_", "._", "get", "\\u", "mode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "FAST", "\\u", "RUN", "'_", ")_", "._", "excluding", "_", "(_", "'", "gpu", "'_", ")_", "\\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 ", " _", "mode", "\\u", "with", "\\u", "gpu_", "=_", "theano_", "._", "compile_", "._", "mode_", "._", "get", "\\u", "default", "\\u", "mode_", "(_", ")_", "._", "inclu", "ding_", "(_", "'", "gpu", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "\\u", "with", "out", "\\u", "gpu_", "=_", "theano_", "._", "compile_", "._", "mode_", "._", "get", "\\u", "default", "\\u", "mode_", "(_", ")_", "._", "excluding", "_", "(_", "'", "gpu", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "The", " ", "CPU", " ", "tests", " ", "alr", "ead", "y", " ", "compare", " ", "C", "/", "Py", ",", " ", "so", " ", "we", " ", "only", " ", "check", " ", "C", "/", "GPU", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mode", "\\u", "with", "\\u", "gpu_", "=_", "copy_", "._", "copy_", "(_", "mode", "\\u", "with", "\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "\\u", "with", "out", "\\u", "gpu_", "=_", "copy_", "._", "copy_", "(_", "mode", "\\u", "with", "out", "\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "\\u", "with", "\\u", "gpu_", "._", "check", "\\u", "py", "\\u", "code_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode", "\\u", "with", "out", "\\u", "gpu_", "._", "check", "\\u", "py", "\\u", "code_", "=_", "False_", "\\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\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "my", "\\u", "rand_", "(_", "*_", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "theano_", "._", "\\u", "asarray_", "(_", "numpy_", "._", "random_", "._", "rand_", "(_", "*_", "shape_", ")_", ",_", "dtype_", "=_", "'", "float", "32", "'_", ")_", "\\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_", "test\\u", "pool_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#(", "batch", ",", " ", "channel", ",", " ", "x", ",", " ", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shp", "s_", "=_", "[_", "(_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shp", "s_", "=_", "[_", "(_", "channel_", ",_", "x_", ",_", "y_", ",_", "batch_", ")_", "for_", "(_", "batch_", ",_", "channel_", ",_", "x_", ",_", "y_", ")_", "in_", "shp", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "nump", "y", ".", "random", ".", "Random", "State", "(", "unittest", "\\u", "tool", "s", ".", "fetch", "\\u", "seed", "())", ".", "shu", "ffle", "(", "shp", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "TOD", "O", ":", " ", "Ra", "zv", "an", " ", "need", "s", " ", "to", " ", "finish", " ", "this", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "shp_", "in_", "shp", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ds_", "in_", "range_", "(_", "1_", ",_", "min_", "(_", "4_", ",_", "shp_", "[_", "2_", "]_", "+_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "start_", "in_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "stride_", "in_", "range_", "(_", "1_", ",_", "min_", "(_", "shp_", "[_", "2_", "]_", ",_", "ds_", ",_", "4_", ")_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "test\\u", "pool", " ", "shape", "=", "%", "s", ",", " ", "ds", "=", "%", "d", ",", " ", "stride", "=", "%", "d", " ", "start", "=", "%", "d", "'", " ", "%", " ", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "str", "(", "shp", "),", " ", "ds", ",", " ", "stride", ",", " ", "start", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "va_", "=_", "my", "\\u", "rand_", "(_", "*_", "shp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tva", "_", "=_", "va_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "va", "',", " ", "tva", ",", " ", "tva", ".", "max", "()", ",", " ", "tva", ".", "argm", "ax", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vb_", "=_", "my", "\\u", "rand_", "(_", "*_", "shp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tv", "b_", "=_", "vb_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "vb", "',", " ", "tv", "b", ",", " ", "tv", "b", ".", "max", "()", ",", " ", "tv", "b", ".", "argm", "ax", "()", ",\\\\", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tv", "b", "[", "tva", ".", "argm", "ax", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "tc", "n_", "._", "shared", "\\u", "constructor_", "(_", "va_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "tc", "n_", "._", "shared", "\\u", "constructor_", "(_", "vb_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op_", "=_", "Max", "Pool_", "(_", "ds_", "=_", "ds_", ",_", "stride_", "=_", "stride_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "op_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "theano_", "._", "tensor_", "._", "Ro", "p_", "(_", "v_", ",_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "theano_", "._", "function_", "(_", "[_", "]_", ",_", "rval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "mode", "\\u", "with", "\\u", "gpu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "f_", "._", "maker_", "._", "fg", "raph_", "._", "topo", "sort_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sse", "rt", " ", "any", "([", "isin", "stance", "(", "node", ".", "op", ",", " ", "Max", "Poo", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "for", " ", "node", " ", "in", " ", "f", ".", "maker", ".", "fg", "raph", ".", "topo", "sort", "()]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "numpy_", "._", "asarray_", "(_", "f_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print_", "\\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, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
vvangelovski/django-lamson/setup.py
[ { "content": "import os, sys\nfrom setuptools import setup, find_packages\n\nimport django_lamson\nfrom django_lamson import VERSION, __version__\n\nif VERSION[-1] == 'final':\n STATUS = ['Development Status :: 5 - Production/Stable']\nelif 'beta' in VERSION[-1]:\n STATUS = ['Development Status :: 4 - Beta']\nelse:\n STATUS = ['Development Status :: 3 - Alpha']\n\n\nsetup(\n name = 'django-lamson',\n version = __version__,\n packages = find_packages(exclude = ['testproject']),\n author = 'Vasil Vangelovski',\n author_email = 'vvangelovski@gmail.com',\n license = 'New BSD License (http://www.opensource.org/licenses/bsd-license.php)',\n description = 'Easy integration of lamson in django projects',\n long_description = get_readme(),\n url = 'https://github.com/vvangelovski/django-lamson',\n download_url = 'https://github.com/vvangelovski/django-lamson',\n include_package_data = True,\n zip_safe = False,\n install_requires=[\"lamson==1.1\"],\n classifiers = STATUS + [\n 'Environment :: Plugins',\n 'Framework :: Django',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Topic :: Software Development :: Libraries :: Python Modules',\n ],\n)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_readme():\n try:\n return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()\n except IOError:\n return ''", "metadata": "root.get_readme", "header": "['module', '___EOS___']", "index": 13 } ]
[ { "span": "import os, sys", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 14 }, { "span": "import django_lamson", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "django", "\\u", "lam", "son_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "lam", "son_", "import_", "VERSION_", ",_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "VERSION_", "[_", "-_", "1_", "]_", "==_", "'", "final", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "STATUS_", "=_", "[_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "beta", "'_", "in_", "VERSION_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "STATUS_", "=_", "[_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "'_", "]_", "\\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 ", " _", "STATUS_", "=_", "[_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "3", " ", "-", " ", "Al", "pha", "'_", "]_", "\\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_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "django", "-", "lam", "son", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "exclude_", "=_", "[_", "'", "testpro", "ject", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Va", "sil", " ", "Van", "gel", "ovs", "ki", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "vv", "ange", "lo", "vs", "ki", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "New", " ", "BS", "D", " ", "License", " ", "(", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "bsd", "-", "license", ".", "php", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Eas", "y", " ", "integrati", "on", " ", "of", " ", "lam", "son", " ", "in", " ", "django", " ", "project", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "get", "\\u", "readme_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "vv", "ange", "lo", "vs", "ki", "/", "django", "-", "lam", "son", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "vv", "ange", "lo", "vs", "ki", "/", "django", "-", "lam", "son", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\"", "lam", "son", "==", "1.1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "STATUS_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Plug", "ins", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "'_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "readme_", "(_", ")_", ":_", "\\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 ", " _", "return_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "READ", "ME", ".", "rst", "'_", ")_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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overriding method
jonathanslenders/pymux/pymux/options.py
[ { "content": "class Option(six.with_metaclass(ABCMeta, object)):\n \"\"\"\n Base class for all options.\n \"\"\"\n", "metadata": "root.Option", "header": "['module', '___EOS___']", "index": 20 }, { "content": " @abstractmethod\n def get_all_values(self):\n \"\"\"\n Return a list of strings, with all possible values. (For\n autocompletion.)\n \"\"\"", "metadata": "root.Option.get_all_values", "header": "['class', 'Option', '(', 'six', '.', 'with_metaclass', '(', 'ABCMeta', ',', 'object', ')', ')', ':', '___EOS___']", "index": 24 }, { "content": " @abstractmethod\n def set_value(self, pymux, cli, value):\n \" Set option. This can raise SetOptionError. \"", "metadata": "root.Option.set_value", "header": "['class', 'Option', '(', 'six', '.', 'with_metaclass', '(', 'ABCMeta', ',', 'object', ')', ')', ':', '___EOS___']", "index": 31 }, { "content": "class OnOffOption(Option):\n \"\"\"\n Boolean on/off option.\n \"\"\"\n\n", "metadata": "root.OnOffOption", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def __init__(self, attribute_name, window_option=False):\n self.attribute_name = attribute_name\n self.window_option = window_option", "metadata": "root.OnOffOption.__init__", "header": "['class', 'OnOffOption', '(', 'Option', ')', ':', '___EOS___']", "index": 48 }, { "content": " def get_all_values(self, pymux):\n return ['on', 'off']", "metadata": "root.OnOffOption.get_all_values", "header": "['class', 'OnOffOption', '(', 'Option', ')', ':', '___EOS___']", "index": 52 }, { "content": " def set_value(self, pymux, cli, value):\n value = value.lower()\n\n if value in ('on', 'off'):\n if self.window_option:\n w = pymux.arrangement.get_active_window(cli)\n setattr(w, self.attribute_name, (value == 'on'))\n else:\n setattr(pymux, self.attribute_name, (value == 'on'))\n else:\n raise SetOptionError('Expecting \"yes\" or \"no\".')", "metadata": "root.OnOffOption.set_value", "header": "['class', 'OnOffOption', '(', 'Option', ')', ':', '___EOS___']", "index": 55 }, { "content": "class StringOption(Option):\n \"\"\"\n String option, the attribute is set as a Pymux attribute.\n \"\"\"\n\n", "metadata": "root.StringOption", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def __init__(self, attribute_name, possible_values=None):\n self.attribute_name = attribute_name\n self.possible_values = possible_values or []", "metadata": "root.StringOption.__init__", "header": "['class', 'StringOption', '(', 'Option', ')', ':', '___EOS___']", "index": 72 }, { "content": " def get_all_values(self, pymux):\n return sorted(set(\n self.possible_values + [getattr(pymux, self.attribute_name)]\n ))", "metadata": "root.StringOption.get_all_values", "header": "['class', 'StringOption', '(', 'Option', ')', ':', '___EOS___']", "index": 76 }, { "content": " def set_value(self, pymux, cli, value):\n setattr(pymux, self.attribute_name, value)", "metadata": "root.StringOption.set_value", "header": "['class', 'StringOption', '(', 'Option', ')', ':', '___EOS___']", "index": 81 }, { "content": "class PositiveIntOption(Option):\n \"\"\"\n Positive integer option, the attribute is set as a Pymux attribute.\n \"\"\"\n\n", "metadata": "root.PositiveIntOption", "header": "['module', '___EOS___']", "index": 85 }, { "content": " def __init__(self, attribute_name, possible_values=None):\n self.attribute_name = attribute_name\n self.possible_values = ['%s' % i for i in (possible_values or [])]", "metadata": "root.PositiveIntOption.__init__", "header": "['class', 'PositiveIntOption', '(', 'Option', ')', ':', '___EOS___']", "index": 89 }, { "content": " def get_all_values(self, pymux):\n return sorted(set(\n self.possible_values +\n ['%s' % getattr(pymux, self.attribute_name)]\n ))", "metadata": "root.PositiveIntOption.get_all_values", "header": "['class', 'PositiveIntOption', '(', 'Option', ')', ':', '___EOS___']", "index": 93 }, { "content": " def set_value(self, pymux, cli, value):\n \"\"\"\n Take a string, and return an integer. Raise SetOptionError when the\n given text does not parse to a positive integer.\n \"\"\"\n try:\n value = int(value)\n if value < 0:\n raise ValueError\n except ValueError:\n raise SetOptionError('Expecting an integer.')\n else:\n setattr(pymux, self.attribute_name, value)", "metadata": "root.PositiveIntOption.set_value", "header": "['class', 'PositiveIntOption', '(', 'Option', ')', ':', '___EOS___']", "index": 99 }, { "content": "class KeyPrefixOption(Option):\n", "metadata": "root.KeyPrefixOption", "header": "['module', '___EOS___']", "index": 114 }, { "content": " def get_all_values(self, pymux):\n return PYMUX_TO_PROMPT_TOOLKIT_KEYS.keys()", "metadata": "root.KeyPrefixOption.get_all_values", "header": "['class', 'KeyPrefixOption', '(', 'Option', ')', ':', '___EOS___']", "index": 115 }, { "content": " def set_value(self, pymux, cli, value):\n # Translate prefix to prompt_toolkit\n try:\n keys = pymux_key_to_prompt_toolkit_key_sequence(value)\n except ValueError:\n raise SetOptionError('Invalid key: %r' % (value, ))\n else:\n pymux.key_bindings_manager.prefix = keys", "metadata": "root.KeyPrefixOption.set_value", "header": "['class', 'KeyPrefixOption', '(', 'Option', ')', ':', '___EOS___']", "index": 118 }, { "content": "class BaseIndexOption(Option):\n \" Base index for window numbering. \"\n", "metadata": "root.BaseIndexOption", "header": "['module', '___EOS___']", "index": 128 }, { "content": " def get_all_values(self, pymux):\n return ['0', '1']", "metadata": "root.BaseIndexOption.get_all_values", "header": "['class', 'BaseIndexOption', '(', 'Option', ')', ':', '___EOS___']", "index": 130 }, { "content": " def set_value(self, pymux, cli, value):\n try:\n value = int(value)\n except ValueError:\n raise SetOptionError('Expecting an integer.')\n else:\n pymux.arrangement.base_index = value", "metadata": "root.BaseIndexOption.set_value", "header": "['class', 'BaseIndexOption', '(', 'Option', ')', ':', '___EOS___']", "index": 133 }, { "content": "class KeysOption(Option):\n \" Emacs or Vi mode. \"\n\n", "metadata": "root.KeysOption", "header": "['module', '___EOS___']", "index": 142 }, { "content": " def __init__(self, attribute_name):\n self.attribute_name = attribute_name", "metadata": "root.KeysOption.__init__", "header": "['class', 'KeysOption', '(', 'Option', ')', ':', '___EOS___']", "index": 144 }, { "content": " def get_all_values(self, pymux):\n return ['emacs', 'vi']", "metadata": "root.KeysOption.get_all_values", "header": "['class', 'KeysOption', '(', 'Option', ')', ':', '___EOS___']", "index": 147 }, { "content": " def set_value(self, pymux, cli, value):\n if value in ('emacs', 'vi'):\n setattr(pymux, self.attribute_name, value == 'vi')\n else:\n raise SetOptionError('Expecting \"vi\" or \"emacs\".')", "metadata": "root.KeysOption.set_value", "header": "['class', 'KeysOption', '(', 'Option', ')', ':', '___EOS___']", "index": 150 }, { "content": "class JustifyOption(Option):\n\n", "metadata": "root.JustifyOption", "header": "['module', '___EOS___']", "index": 156 }, { "content": " def __init__(self, attribute_name):\n self.attribute_name = attribute_name", "metadata": "root.JustifyOption.__init__", "header": "['class', 'JustifyOption', '(', 'Option', ')', ':', '___EOS___']", "index": 157 }, { "content": " def get_all_values(self, pymux):\n return Justify._ALL", "metadata": "root.JustifyOption.get_all_values", "header": "['class', 'JustifyOption', '(', 'Option', ')', ':', '___EOS___']", "index": 160 }, { "content": " def set_value(self, pymux, cli, value):\n if value in Justify._ALL:\n setattr(pymux, self.attribute_name, value)\n else:\n raise SetOptionError('Invalid justify option.')", "metadata": "root.JustifyOption.set_value", "header": "['class', 'JustifyOption', '(', 'Option', ')', ':', '___EOS___']", "index": 163 } ]
[ { "span": "def get_all_values(self, pymux):", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 36 }, { "span": "def get_all_values(self, pymux):", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 36 }, { "span": "def get_all_values(self, pymux):", "start_line": 93, "start_column": 4, "end_line": 93, "end_column": 36 }, { "span": "def get_all_values(self, pymux):", "start_line": 115, "start_column": 4, "end_line": 115, "end_column": 36 }, { "span": "def get_all_values(self, pymux):", "start_line": 130, "start_column": 4, "end_line": 130, "end_column": 36 }, { "span": "def get_all_values(self, pymux):", "start_line": 147, "start_column": 4, "end_line": 147, "end_column": 36 }, { "span": "def get_all_values(self, pymux):", "start_line": 160, "start_column": 4, "end_line": 160, "end_column": 36 } ]
[ { "span": "def get_all_values(self):", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 29 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Option_", "(_", "six_", "._", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ",_", "object_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "for", " ", "all", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Option_", "(_", "six_", "._", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ",_", "object_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "string", "s", ",", " ", "with", " ", "all", " ", "possib", "le", " ", "values", ".", " ", "(", "For", "\\", "10", ";", " ", " ", " ", " ", "autoc", "omp", "let", "ion", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Option_", "(_", "six_", "._", "with", "\\u", "metaclass_", "(_", "ABC", "Meta_", ",_", "object_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", " ", "Set", " ", "option", ".", " ", "Thi", "s", " ", "can", " ", "raise", " ", "Set", "Optio", "n", "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_", "class_", "On", "Off", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Boo", "lean", " ", "on", "/", "off", " ", "option", ".", "\\", "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_", "On", "Off", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "attribute", "\\u", "name_", ",_", "window", "\\u", "option_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attribute", "\\u", "name_", "=_", "attribute", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window", "\\u", "option_", "=_", "window", "\\u", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "On", "Off", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'", "on", "'_", ",_", "'", "off", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "On", "Off", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "in_", "(_", "'", "on", "'_", ",_", "'", "off", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "window", "\\u", "option_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "pym", "ux_", "._", "arrange", "ment_", "._", "get", "\\u", "active", "\\u", "window_", "(_", "cli_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "w_", ",_", "self_", "._", "attribute", "\\u", "name_", ",_", "(_", "value_", "==_", "'", "on", "'_", ")_", ")_", "\\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 ", " _", "setattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ",_", "(_", "value_", "==_", "'", "on", "'_", ")_", ")_", "\\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 ", " _", "raise_", "Set", "Optio", "n", "Error_", "(_", "'", "Expecti", "ng", " ", "\"", "ye", "s", "\"", " ", "or", " ", "\"", "no", "\".'_", ")_", "\\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_", "String", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "String", " ", "option", ",", " ", "the", " ", "attribute", " ", "is", " ", "set", " ", "as", " ", "a", " ", "Py", "mux", " ", "attribute", ".", "\\", "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_", "String", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "attribute", "\\u", "name_", ",_", "possib", "le", "\\u", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attribute", "\\u", "name_", "=_", "attribute", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "possib", "le", "\\u", "values_", "=_", "possib", "le", "\\u", "values_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sorted_", "(_", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "possib", "le", "\\u", "values_", "+_", "[_", "getattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ",_", "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_", "Posi", "tiv", "e", "Int", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Posi", "tiv", "e", " ", "integ", "er", " ", "option", ",", " ", "the", " ", "attribute", " ", "is", " ", "set", " ", "as", " ", "a", " ", "Py", "mux", " ", "attribute", ".", "\\", "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_", "Posi", "tiv", "e", "Int", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "attribute", "\\u", "name_", ",_", "possib", "le", "\\u", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attribute", "\\u", "name_", "=_", "attribute", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "possib", "le", "\\u", "values_", "=_", "[_", "'%", "s", "'_", "%_", "i_", "for_", "i_", "in_", "(_", "possib", "le", "\\u", "values_", "or_", "[_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "tiv", "e", "Int", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sorted_", "(_", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "possib", "le", "\\u", "values_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'%", "s", "'_", "%_", "getattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Posi", "tiv", "e", "Int", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tak", "e", " ", "a", " ", "string", ",", " ", "and", " ", "return", " ", "an", " ", "integ", "er", ".", " ", "Rai", "se", " ", "Set", "Optio", "n", "Error", " ", "whe", "n", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "text", " ", "doe", "s", " ", "not", " ", "parse", " ", "to", " ", "a", " ", "posit", "ive", " ", "integ", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "<_", "0_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Set", "Optio", "n", "Error_", "(_", "'", "Expecti", "ng", " ", "an", " ", "integ", "er", ".'_", ")_", "\\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 ", " _", "setattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Key", "Pref", "ix", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pref", "ix", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "PY", "MU", "X", "\\u", "TO", "\\u", "PROMPT", "\\u", "TOOL", "KI", "T", "\\u", "KEYS_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Pref", "ix", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Translate", " ", "prefix", " ", "to", " ", "prompt", "\\u", "toolkit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "pym", "ux", "\\u", "key", "\\u", "to", "\\u", "prompt", "\\u", "tool", "kit", "\\u", "key", "\\u", "sequence_", "(_", "value_", ")_", "\\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_", "Set", "Optio", "n", "Error_", "(_", "'", "Inva", "lid", " ", "key", ":", " ", "%", "r", "'_", "%_", "(_", "value_", ",_", ")_", ")_", "\\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 ", " _", "pym", "ux_", "._", "key", "\\u", "bindi", "ngs", "\\u", "manager_", "._", "prefix_", "=_", "keys_", "\\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_", "Base", "Index", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", " ", "Base", " ", "index", " ", "for", " ", "window", " ", "numbering", ".", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Index", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'", "0", "'_", ",_", "'", "1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Index", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\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_", "Set", "Optio", "n", "Error_", "(_", "'", "Expecti", "ng", " ", "an", " ", "integ", "er", ".'_", ")_", "\\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 ", " _", "pym", "ux_", "._", "arrange", "ment_", "._", "base", "\\u", "index_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Keys", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", " ", "Ema", "cs", " ", "or", " ", "Vi", " ", "mode", ".", " ", "\"_", "\\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_", "Keys", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "attribute", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attribute", "\\u", "name_", "=_", "attribute", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Keys", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'", "ema", "cs", "'_", ",_", "'", "vi", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Keys", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "(_", "'", "ema", "cs", "'_", ",_", "'", "vi", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ",_", "value_", "==_", "'", "vi", "'_", ")_", "\\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_", "Set", "Optio", "n", "Error_", "(_", "'", "Expecti", "ng", " ", "\"", "vi", "\"", " ", "or", " ", "\"", "ema", "cs", "\".'_", ")_", "\\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_", "Justi", "fy", "Option_", "(_", "Option_", ")_", ":_", "\\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_", "Justi", "fy", "Option_", "(_", "Option_", ")_", ":_", "\\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_", ",_", "attribute", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attribute", "\\u", "name_", "=_", "attribute", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Justi", "fy", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "values_", "(_", "self_", ",_", "pym", "ux_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Justi", "fy_", "._", "\\u", "ALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Justi", "fy", "Option_", "(_", "Option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "value_", "(_", "self_", ",_", "pym", "ux_", ",_", "cli_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "Justi", "fy_", "._", "\\u", "ALL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "pym", "ux_", ",_", "self_", "._", "attribute", "\\u", "name_", ",_", "value_", ")_", "\\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_", "Set", "Optio", "n", "Error_", "(_", "'", "Inva", "lid", " ", "justif", "y", " ", "option", ".'_", ")_", "\\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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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 ]
Unused import
mtth/azkaban/test/test_job.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"Test Azkaban job module.\"\"\"\n\nfrom azkaban.job import *\nfrom azkaban.project import Project\nfrom azkaban.util import AzkabanError, temppath\nfrom nose.tools import eq_, ok_, raises, nottest\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestJob(object):\n\n\n\n\n\n\n", "metadata": "root.TestJob", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def test_generate_simple(self):\n job = Job({'a': 1, 'b': {'c': 2, 'd': 3}})\n with temppath() as path:\n job.build(path)\n with open(path) as reader:\n eq_(reader.read(), 'a=1\\nb.c=2\\nb.d=3\\n')", "metadata": "root.TestJob.test_generate_simple", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_generate_with_defaults(self):\n defaults = {'b': {'d': 4}, 'e': 5}\n job = Job(defaults, {'a': 1, 'b': {'c': 2, 'd': 3}})\n with temppath() as path:\n job.build(path)\n with open(path) as reader:\n eq_(reader.read(), 'a=1\\nb.c=2\\nb.d=3\\ne=5\\n')", "metadata": "root.TestJob.test_generate_with_defaults", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_generate_with_dependencies(self):\n foo = Job()\n bar = Job({'a': 3})\n job = Job({'a': 2, 'dependencies': 'bar,foo'})\n with temppath() as path:\n job.build(path)\n with open(path) as reader:\n eq_(reader.read(), 'a=2\\ndependencies=bar,foo\\n')", "metadata": "root.TestJob.test_generate_with_dependencies", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": " def test_join_options(self):\n job = Job({'bar': range(3)})\n job.join_option('bar', ',')\n eq_(job.options['bar'], '0,1,2')", "metadata": "root.TestJob.test_join_options", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_join_options_with_custom_formatter(self):\n job = Job({'bar': range(3)})\n job.join_option('bar', ' ', '(%s)')\n eq_(job.options['bar'], '(0) (1) (2)')", "metadata": "root.TestJob.test_join_options_with_custom_formatter", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_join_missing_option(self):\n job = Job({'bar': '1'})\n job.join_option('baz', ' ', '(%s)')\n eq_(job.options['bar'], '1')\n ok_(not 'baz' in job.options)", "metadata": "root.TestJob.test_join_missing_option", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_join_prefix(self):\n job = Job({'bar': {'a': 1, 'b.c': 'foo'}})\n job.join_prefix('bar', ',', '%s-%s')\n eq_(job.options['bar'], 'a-1,b.c-foo')", "metadata": "root.TestJob.test_join_prefix", "header": "['class', 'TestJob', '(', 'object', ')', ':', '___EOS___']", "index": 53 } ]
[ { "span": "from azkaban.project import Project", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 35 }, { "span": "from azkaban.util import AzkabanError, temppath", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 47 }, { "span": "from nose.tools import eq_, ok_, raises, nottest", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", " ", "Az", "kab", "an", " ", "job", " ", "module", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "az", "kab", "an_", "._", "job_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "az", "kab", "an_", "._", "project_", "import_", "Project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "az", "kab", "an_", "._", "util_", "import_", "Az", "kab", "an", "Error_", ",_", "temp", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "eq\\u_", ",_", "ok\\u_", ",_", "raises_", ",_", "not", "test_", "\\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", "Job_", "(_", "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\\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", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "generat", "e\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "Job_", "(_", "{_", "'", "a", "'_", ":_", "1_", ",_", "'", "b", "'_", ":_", "{_", "'", "c", "'_", ":_", "2_", ",_", "'", "d", "'_", ":_", "3_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "temp", "path_", "(_", ")_", "as_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "._", "build_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ")_", "as_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eq\\u_", "(_", "reader_", "._", "read_", "(_", ")_", ",_", "'", "a", "=", "1", "\\\\", "nb", ".", "c", "=", "2", "\\\\", "nb", ".", "d", "=", "3", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Job_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "e\\u", "with", "\\u", "defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "=_", "{_", "'", "b", "'_", ":_", "{_", "'", "d", "'_", ":_", "4_", "}_", ",_", "'", "e", "'_", ":_", "5_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "Job_", "(_", "defaults_", ",_", "{_", "'", "a", "'_", ":_", "1_", ",_", "'", "b", "'_", ":_", "{_", "'", "c", "'_", ":_", "2_", ",_", "'", "d", "'_", ":_", "3_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "temp", "path_", "(_", ")_", "as_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "._", "build_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ")_", "as_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eq\\u_", "(_", "reader_", "._", "read_", "(_", ")_", ",_", "'", "a", "=", "1", "\\\\", "nb", ".", "c", "=", "2", "\\\\", "nb", ".", "d", "=", "3", "\\\\", "ne", "=", "5", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Job_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "generat", "e\\u", "with", "\\u", "dependencies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Job_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "Job_", "(_", "{_", "'", "a", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "Job_", "(_", "{_", "'", "a", "'_", ":_", "2_", ",_", "'", "dependen", "cies", "'_", ":_", "'", "bar", ",", "foo", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "temp", "path_", "(_", ")_", "as_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "._", "build_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ")_", "as_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eq\\u_", "(_", "reader_", "._", "read_", "(_", ")_", ",_", "'", "a", "=", "2", "\\\\", "nde", "pend", "enci", "es", "=", "bar", ",", "foo", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Job_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "join", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "Job_", "(_", "{_", "'", "bar", "'_", ":_", "range_", "(_", "3_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "join", "\\u", "option_", "(_", "'", "bar", "'_", ",_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "job_", "._", "options_", "[_", "'", "bar", "'_", "]_", ",_", "'", "0", ",", "1", ",", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "join", "\\u", "options", "\\u", "with", "\\u", "custom", "\\u", "formatter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "Job_", "(_", "{_", "'", "bar", "'_", ":_", "range_", "(_", "3_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "join", "\\u", "option_", "(_", "'", "bar", "'_", ",_", "'", " ", "'_", ",_", "'(", "%", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "job_", "._", "options_", "[_", "'", "bar", "'_", "]_", ",_", "'(", "0", ")", " ", "(", "1", ")", " ", "(", "2", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "join", "\\u", "missi", "ng", "\\u", "option_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "Job_", "(_", "{_", "'", "bar", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "join", "\\u", "option_", "(_", "'", "ba", "z", "'_", ",_", "'", " ", "'_", ",_", "'(", "%", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "job_", "._", "options_", "[_", "'", "bar", "'_", "]_", ",_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "not_", "'", "ba", "z", "'_", "in_", "job_", "._", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "join", "\\u", "prefix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "Job_", "(_", "{_", "'", "bar", "'_", ":_", "{_", "'", "a", "'_", ":_", "1_", ",_", "'", "b", ".", "c", "'_", ":_", "'", "foo", "'_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "join", "\\u", "prefix_", "(_", "'", "bar", "'_", ",_", "','_", ",_", "'%", "s", "-%", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "job_", "._", "options_", "[_", "'", "bar", "'_", "]_", ",_", "'", "a", "-1", ",", "b", ".", "c", "-", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 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, 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 ]
Unused local variable
TheSriram/MLT4Trading/Project 1/testlearner.py
[ { "content": "def get_graph_two_plots(x_series,y_series,y1_series,xlabel,ylabel,name_file):\n plt.clf()\n plt.xlabel(xlabel)\n plt.ylabel(ylabel)\n first = plt.plot(x_series,y_series)\n second = plt.plot(x_series,y1_series)\n plt.legend([\"insample\",\"outsample\"])\n plt.savefig(name_file)", "metadata": "root.get_graph_two_plots", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def linreglearner_test(filenames):\n for filename in filenames:\n linreglearner = LinRegLearner()\n get_set = linreglearner.getflatcsv(filename)\n get_set_60pr,get_set_40pr = numpy.split(get_set,[600])\n (X,Y) = numpy.split(get_set,[2],axis=1)\n (XTrain,XTest) = numpy.split(X,[600])\n (Ytrain,YTest) = numpy.split(Y,[600])\n with Timer() as t:\n linreglearner.addEvidence(XTrain,Ytrain)\n print 'LinRegLearner Training Time {0} sec for {1}'.format(t.interval,filename)\n with Timer() as t:\n Y_return = linreglearner.query(XTest)\n print 'LinRegLearner Query Time {0} sec for {1}'.format(t.interval,filename)", "metadata": "root.linreglearner_test", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def knnlearner_test(filenames):\n for filename in filenames:\n train_time =[]\n query_time =[]\n rmse_series=[]\n rmse_series_insample=[]\n covariance_series=[]\n for i in xrange(1,51):\n knnlearner=KNNLearner(k=i)\n get_set = knnlearner.getflatcsv(filename)\n get_set_60pr,get_set_40pr = numpy.split(get_set,[600])\n (X,Y) = numpy.split(get_set,[2],axis=1)\n (XTrain,XTest) = numpy.split(X,[600])\n (Ytrain,YTest) = numpy.split(Y,[600])\n knnlearner.build_hash(get_set_60pr)\n with Timer() as t:\n knnlearner.addEvidence(XTrain,Ytrain)\n train_time.append(t.interval)\n query_X = numpy.array(XTest)\n with Timer() as t:\n (XY_return,Y_return) = knnlearner.query(XTest)\n query_time.append(t.interval)\n Y_Test = np.squeeze(np.asarray(YTest))\n Y_Return = numpy.array(Y_return)\n rmse_series.append(get_rmse(Y_Test,Y_Return))\n (XY_return_insample,Y_return_insample) = knnlearner.query(XTrain)\n Y_Train = np.squeeze(np.asarray(Ytrain))\n Y_return_insample = numpy.array(Y_return_insample)\n rmse_series_insample.append(get_rmse(Y_Train,Y_return_insample))\n covariance_series.append(get_correlation(Y_Test,Y_Return))\n min_rmse = min(float(i) for i in rmse_series)\n k_index = rmse_series.index(min_rmse)\n print \"best k = \",k_index+1,\" for \",filename\n knnlearner_scatter = KNNLearner(k=k_index+1)\n get_set = knnlearner_scatter.getflatcsv(filename)\n get_set_60pr,get_set_40pr = numpy.split(get_set,[600])\n (X,Y) = numpy.split(get_set,[2],axis=1)\n (XTrain,XTest) = numpy.split(X,[600])\n (Ytrain,YTest) = numpy.split(Y,[600])\n knnlearner_scatter.build_hash(get_set_60pr)\n knnlearner_scatter.addEvidence(XTrain,Ytrain)\n (XY_return,Y_return) = knnlearner_scatter.query(XTest)\n Y_Test = np.squeeze(np.asarray(YTest))\n Y_Return = numpy.array(Y_return)\n scatter(Y_Return,Y_Test,\"scatterplot(\"+filename+\")(for bestk).pdf\")\n get_graph(numpy.arange(1,51),train_time,\"K\",\"Train time in seconds\",\"KNN_Train_time(\"+filename+\").pdf\",4)\n get_graph(numpy.arange(1,51),query_time,\"K\",\"Query time in seconds\",\"KNN_Query_time(\"+filename+\").pdf\",4)\n get_graph(numpy.arange(1,51),rmse_series,\"K\",\"RMSE Error\",\"RMSEvsk(\"+filename+\").pdf\")\n get_graph(numpy.arange(1,51),covariance_series,\"K\",\"Covariance Coefficeint\",\"Covariance Coeff vs K(\"+filename+\").pdf\")\n get_graph_two_plots(numpy.arange(1,51),rmse_series_insample,rmse_series,\"K\",\"RMSE\",\"insample_error_vs_outsample_error(\"+filename+\").pdf\")", "metadata": "root.knnlearner_test", "header": "['module', '___EOS___']", "index": 67 } ]
[ { "span": "first ", "start_line": 30, "start_column": 4, "end_line": 30, "end_column": 9 }, { "span": "second ", "start_line": 31, "start_column": 4, "end_line": 31, "end_column": 10 }, { "span": "get_set_60pr,", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 20 }, { "span": "get_set_40pr ", "start_line": 56, "start_column": 21, "end_line": 56, "end_column": 33 }, { "span": "Y_return ", "start_line": 64, "start_column": 12, "end_line": 64, "end_column": 20 }, { "span": "query_X ", "start_line": 85, "start_column": 12, "end_line": 85, "end_column": 19 } ]
[]
1
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_", "def_", "get", "\\u", "graph", "\\u", "two", "\\u", "plots_", "(_", "x", "\\u", "series_", ",_", "y", "\\u", "series_", ",_", "y1", "\\u", "series_", ",_", "xlabel_", ",_", "ylabel_", ",_", "name", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "clf_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlabel_", "(_", "xlabel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylabel_", "(_", "ylabel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "plt_", "._", "plot_", "(_", "x", "\\u", "series_", ",_", "y", "\\u", "series_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second_", "=_", "plt_", "._", "plot_", "(_", "x", "\\u", "series_", ",_", "y1", "\\u", "series_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "legend_", "(_", "[_", "\"", "ins", "ample", "\"_", ",_", "\"", "outs", "ample", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "name", "\\u", "file_", ")_", "\\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_", "lin", "reg", "learner", "\\u", "test_", "(_", "filenames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lin", "reg", "learner_", "=_", "Lin", "Reg", "Learner", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "set_", "=_", "lin", "reg", "learner_", "._", "getf", "lat", "csv_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "set\\u", "60", "pr_", ",_", "get", "\\u", "set\\u", "40", "pr_", "=_", "numpy_", "._", "split_", "(_", "get", "\\u", "set_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "X_", ",_", "Y_", ")_", "=_", "numpy_", "._", "split_", "(_", "get", "\\u", "set_", ",_", "[_", "2_", "]_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "XT", "rain_", ",_", "XT", "est_", ")_", "=_", "numpy_", "._", "split_", "(_", "X_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Yt", "rain_", ",_", "YT", "est_", ")_", "=_", "numpy_", "._", "split_", "(_", "Y_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Timer_", "(_", ")_", "as_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lin", "reg", "learner_", "._", "add", "Evi", "denc", "e_", "(_", "XT", "rain_", ",_", "Yt", "rain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Lin", "Reg", "Learner", " ", "Train", "ing", " ", "Time", " ", "{", "0", "}", " ", "sec", " ", "for", " ", "{", "1", "}'_", "._", "format_", "(_", "t_", "._", "interval_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Timer_", "(_", ")_", "as_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Y", "\\u", "return_", "=_", "lin", "reg", "learner_", "._", "query_", "(_", "XT", "est_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Lin", "Reg", "Learner", " ", "Query", " ", "Time", " ", "{", "0", "}", " ", "sec", " ", "for", " ", "{", "1", "}'_", "._", "format_", "(_", "t_", "._", "interval_", ",_", "filename_", ")_", "\\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_", "knn", "learner", "\\u", "test_", "(_", "filenames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "\\u", "time_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "time_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "\\u", "series_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "\\u", "series", "\\u", "ins", "ample", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covariance", "\\u", "series_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "1_", ",_", "51_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "knn", "learner_", "=_", "KN", "NL", "earn", "er_", "(_", "k_", "=_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "set_", "=_", "knn", "learner_", "._", "getf", "lat", "csv_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "set\\u", "60", "pr_", ",_", "get", "\\u", "set\\u", "40", "pr_", "=_", "numpy_", "._", "split_", "(_", "get", "\\u", "set_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "X_", ",_", "Y_", ")_", "=_", "numpy_", "._", "split_", "(_", "get", "\\u", "set_", ",_", "[_", "2_", "]_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "XT", "rain_", ",_", "XT", "est_", ")_", "=_", "numpy_", "._", "split_", "(_", "X_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Yt", "rain_", ",_", "YT", "est_", ")_", "=_", "numpy_", "._", "split_", "(_", "Y_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "knn", "learner_", "._", "build", "\\u", "hash_", "(_", "get", "\\u", "set\\u", "60", "pr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Timer_", "(_", ")_", "as_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "knn", "learner_", "._", "add", "Evi", "denc", "e_", "(_", "XT", "rain_", ",_", "Yt", "rain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "time_", "._", "append_", "(_", "t_", "._", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "X_", "=_", "numpy_", "._", "array_", "(_", "XT", "est_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Timer_", "(_", ")_", "as_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "XY", "\\u", "return_", ",_", "Y", "\\u", "return_", ")_", "=_", "knn", "learner_", "._", "query_", "(_", "XT", "est_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "\\u", "time_", "._", "append_", "(_", "t_", "._", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "Test_", "=_", "np_", "._", "squeeze_", "(_", "np_", "._", "asarray_", "(_", "YT", "est_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "Return_", "=_", "numpy_", "._", "array_", "(_", "Y", "\\u", "return_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "\\u", "series_", "._", "append_", "(_", "get", "\\u", "rmse", "_", "(_", "Y", "\\u", "Test_", ",_", "Y", "\\u", "Return_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "XY", "\\u", "return", "\\u", "ins", "ample", "_", ",_", "Y", "\\u", "return", "\\u", "ins", "ample", "_", ")_", "=_", "knn", "learner_", "._", "query_", "(_", "XT", "rain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "Train_", "=_", "np_", "._", "squeeze_", "(_", "np_", "._", "asarray_", "(_", "Yt", "rain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "return", "\\u", "ins", "ample", "_", "=_", "numpy_", "._", "array_", "(_", "Y", "\\u", "return", "\\u", "ins", "ample", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "\\u", "series", "\\u", "ins", "ample", "_", "._", "append_", "(_", "get", "\\u", "rmse", "_", "(_", "Y", "\\u", "Train_", ",_", "Y", "\\u", "return", "\\u", "ins", "ample", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covariance", "\\u", "series_", "._", "append_", "(_", "get", "\\u", "correlation_", "(_", "Y", "\\u", "Test_", ",_", "Y", "\\u", "Return_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "min", "\\u", "rmse", "_", "=_", "min_", "(_", "float_", "(_", "i_", ")_", "for_", "i_", "in_", "rmse", "\\u", "series_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "index_", "=_", "rmse", "\\u", "series_", "._", "index_", "(_", "min", "\\u", "rmse", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "best", " ", "k", " ", "=", " ", "\"_", ",_", "k", "\\u", "index_", "+_", "1_", ",_", "\"", " ", "for", " ", "\"_", ",_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "knn", "learner", "\\u", "scatter_", "=_", "KN", "NL", "earn", "er_", "(_", "k_", "=_", "k", "\\u", "index_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "set_", "=_", "knn", "learner", "\\u", "scatter_", "._", "getf", "lat", "csv_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "set\\u", "60", "pr_", ",_", "get", "\\u", "set\\u", "40", "pr_", "=_", "numpy_", "._", "split_", "(_", "get", "\\u", "set_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "X_", ",_", "Y_", ")_", "=_", "numpy_", "._", "split_", "(_", "get", "\\u", "set_", ",_", "[_", "2_", "]_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "XT", "rain_", ",_", "XT", "est_", ")_", "=_", "numpy_", "._", "split_", "(_", "X_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Yt", "rain_", ",_", "YT", "est_", ")_", "=_", "numpy_", "._", "split_", "(_", "Y_", ",_", "[_", "600_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "knn", "learner", "\\u", "scatter_", "._", "build", "\\u", "hash_", "(_", "get", "\\u", "set\\u", "60", "pr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "knn", "learner", "\\u", "scatter_", "._", "add", "Evi", "denc", "e_", "(_", "XT", "rain_", ",_", "Yt", "rain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "XY", "\\u", "return_", ",_", "Y", "\\u", "return_", ")_", "=_", "knn", "learner", "\\u", "scatter_", "._", "query_", "(_", "XT", "est_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "Test_", "=_", "np_", "._", "squeeze_", "(_", "np_", "._", "asarray_", "(_", "YT", "est_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y", "\\u", "Return_", "=_", "numpy_", "._", "array_", "(_", "Y", "\\u", "return_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scatter_", "(_", "Y", "\\u", "Return_", ",_", "Y", "\\u", "Test_", ",_", "\"", "scatter", "plot", "(\"_", "+_", "filename_", "+_", "\")", "(", "for", " ", "best", "k", ").", "pdf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "graph_", "(_", "numpy_", "._", "arange_", "(_", "1_", ",_", "51_", ")_", ",_", "train", "\\u", "time_", ",_", "\"", "K", "\"_", ",_", "\"", "Train", " ", "time", " ", "in", " ", "second", "s", "\"_", ",_", "\"", "KN", "N", "\\u", "Train", "\\u", "time", "(\"_", "+_", "filename_", "+_", "\")", ".", "pdf", "\"_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "graph_", "(_", "numpy_", "._", "arange_", "(_", "1_", ",_", "51_", ")_", ",_", "query", "\\u", "time_", ",_", "\"", "K", "\"_", ",_", "\"", "Query", " ", "time", " ", "in", " ", "second", "s", "\"_", ",_", "\"", "KN", "N", "\\u", "Query", "\\u", "time", "(\"_", "+_", "filename_", "+_", "\")", ".", "pdf", "\"_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "graph_", "(_", "numpy_", "._", "arange_", "(_", "1_", ",_", "51_", ")_", ",_", "rmse", "\\u", "series_", ",_", "\"", "K", "\"_", ",_", "\"", "RMS", "E", " ", "Error", "\"_", ",_", "\"", "RMS", "Ev", "sk", "(\"_", "+_", "filename_", "+_", "\")", ".", "pdf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "graph_", "(_", "numpy_", "._", "arange_", "(_", "1_", ",_", "51_", ")_", ",_", "covariance", "\\u", "series_", ",_", "\"", "K", "\"_", ",_", "\"", "Covar", "iance", " ", "Coeff", "ice", "int", "\"_", ",_", "\"", "Covar", "iance", " ", "Coeff", " ", "vs", " ", "K", "(\"_", "+_", "filename_", "+_", "\")", ".", "pdf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "graph", "\\u", "two", "\\u", "plots_", "(_", "numpy_", "._", "arange_", "(_", "1_", ",_", "51_", ")_", ",_", "rmse", "\\u", "series", "\\u", "ins", "ample", "_", ",_", "rmse", "\\u", "series_", ",_", "\"", "K", "\"_", ",_", "\"", "RMS", "E", "\"_", ",_", "\"", "ins", "ample", "\\u", "error", "\\u", "vs", "\\u", "outs", "ample", "\\u", "error", "(\"_", "+_", "filename_", "+_", "\")", ".", "pdf", "\"_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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 ]
Except block handles 'BaseException'
nitipit/appkit/appkit/api/v0_2_4/app.py
[ { "content": " def _url_map_to_function(self, url):\n match_list = list()\n for pattern in self.url_pattern:\n m = re.match(pattern, url)\n if m:\n match_list.append(m)\n\n if len(match_list) > 1:\n raise Exception('Found more than one matched urls')\n return None\n\n try:\n m = match_list[0]\n except:\n return None\n\n args = list(m.groups())\n kw = m.groupdict()\n for value in kw.values():\n args.remove(value)\n\n return self.url_pattern[m.re.pattern](*args, **kw)", "metadata": "root.App._url_map_to_function", "header": "['class', 'App', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def _init_ui(self):\n \"\"\"Initial the first UI page.\n - load html from '/' endpoint\n - if <title> is defined, use as windows title\n \"\"\"\n (content, mimetype) = make_response(self._url_map_to_function('/'))\n try:\n beautifulsoup = BeautifulSoup(content)\n self.window.set_title(beautifulsoup.find('title').string)\n except:\n pass\n\n if self.debug is True:\n print self.app_dir\n\n # Use load_string instead of load_uri because it shows warning.\n self.webkit_web_view.load_string(\n content,\n mime_type=mimetype,\n encoding='utf-8',\n base_uri='/',\n )", "metadata": "root.App._init_ui", "header": "['class', 'App', '(', 'object', ')', ':', '___EOS___']", "index": 221 } ]
[ { "span": "except:", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 15 }, { "span": "except:", "start_line": 230, "start_column": 8, "end_line": 230, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "App_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "url", "\\u", "map", "\\u", "to", "\\u", "function_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match", "\\u", "list_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pattern_", "in_", "self_", "._", "url", "\\u", "pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "pattern_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match", "\\u", "list_", "._", "append_", "(_", "m_", ")_", "\\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_", "len_", "(_", "match", "\\u", "list_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Foun", "d", " ", "more", " ", "than", " ", "one", " ", "matche", "d", " ", "urls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\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 ", " _", "m_", "=_", "match", "\\u", "list_", "[_", "0_", "]_", "\\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_", "args_", "=_", "list_", "(_", "m_", "._", "groups_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "=_", "m_", "._", "groupdict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", "in_", "kw_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "remove_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "url", "\\u", "pattern_", "[_", "m_", "._", "re_", "._", "pattern_", "]_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App_", "(_", "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_", "def_", "\\u", "init", "\\u", "ui_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initial", " ", "the", " ", "first", " ", "UI", " ", "page", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "load", " ", "html", " ", "from", " ", "'/'", " ", "endpoint", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "if", " ", "<", "title", ">", " ", "is", " ", "defin", "ed", ",", " ", "use", " ", "as", " ", "windows", " ", "title", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "content_", ",_", "mimetype_", ")_", "=_", "make", "\\u", "response_", "(_", "self_", "._", "\\u", "url", "\\u", "map", "\\u", "to", "\\u", "function_", "(_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "beautif", "uls", "oup_", "=_", "Bea", "uti", "ful", "Soup_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "._", "set\\u", "title_", "(_", "beautif", "uls", "oup_", "._", "find_", "(_", "'", "title", "'_", ")_", "._", "string_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "debug_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "self_", "._", "app", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "load", "\\u", "string", " ", "inst", "ead", " ", "of", " ", "load", "\\u", "uri", " ", "bec", "aus", "e", " ", "it", " ", "show", "s", " ", "warn", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "webkit", "\\u", "web", "\\u", "view_", "._", "load", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mime", "\\u", "type_", "=_", "mimetype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "uri_", "=_", "'/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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, 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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 ]
Unused import
blockstack/pybitcoin/pybitcoin/formatcheck.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n pybitcoin\n ~~~~~\n\n :copyright: (c) 2014 by Halfmoon Labs\n :license: MIT, see LICENSE for more details.\n\"\"\"\n\nimport os\nimport re\nimport random\nimport binascii\nfrom utilitybelt import is_int, is_hex\n\nfrom .b58check import is_b58check\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def is_secret_exponent(val, curve_order):\n return (isinstance(val, (int, long)) and val >= 1 and val < curve_order)", "metadata": "root.is_secret_exponent", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def is_256bit_hex_string(val):\n return (isinstance(val, str) and len(val) == 64 and is_hex(val))", "metadata": "root.is_256bit_hex_string", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def is_wif_pk(val):\n return (len(val) >= 51 and len(val) <= 52 and is_b58check(val))", "metadata": "root.is_wif_pk", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def is_b58check_address(val):\n return is_b58check(val)\n # return (len(val) >= 27 and len(val) <= 34 and is_b58check(val))", "metadata": "root.is_b58check_address", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def is_hex_ecdsa_pubkey(val):\n return (is_hex(val) and len(val) == 128)", "metadata": "root.is_hex_ecdsa_pubkey", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def is_binary_ecdsa_pubkey(val):\n return (isinstance(val, str) and len(val) == 64)", "metadata": "root.is_binary_ecdsa_pubkey", "header": "['module', '___EOS___']", "index": 39 } ]
[ { "span": "import os", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 9 }, { "span": "import re", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 9 }, { "span": "import random", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 13 }, { "span": "import binascii", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 15 }, { "span": "from utilitybelt import is_int, is_hex", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "pyb", "itc", "oin", "\\", "10", ";", " ", " ", " ", " ", "~~~~~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2014", " ", "by", " ", "Hal", "fmo", "on", " ", "Lab", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "MIT", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "binascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utility", "bel", "t_", "import_", "is", "\\u", "int_", ",_", "is", "\\u", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "b5", "8c", "heck_", "import_", "is", "\\u", "b5", "8c", "heck_", "\\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\\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_", "\\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_", "is", "\\u", "secret", "\\u", "exponent_", "(_", "val_", ",_", "curve", "\\u", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "isinstance_", "(_", "val_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", "and_", "val_", ">=_", "1_", "and_", "val_", "<_", "curve", "\\u", "order_", ")_", "\\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_", "is", "\\u", "256", "bit", "\\u", "hex", "\\u", "string_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "isinstance_", "(_", "val_", ",_", "str_", ")_", "and_", "len_", "(_", "val_", ")_", "==_", "64_", "and_", "is", "\\u", "hex_", "(_", "val_", ")_", ")_", "\\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_", "is", "\\u", "wif", "\\u", "pk_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "len_", "(_", "val_", ")_", ">=_", "51_", "and_", "len_", "(_", "val_", ")_", "<=_", "52_", "and_", "is", "\\u", "b5", "8c", "heck_", "(_", "val_", ")_", ")_", "\\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_", "is", "\\u", "b5", "8c", "heck", "\\u", "address_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "is", "\\u", "b5", "8c", "heck_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "(", "len", "(", "val", ")", " ", ">=", " ", "2", "7", " ", "and", " ", "len", "(", "val", ")", " ", "<=", " ", "3", "4", " ", "and", " ", "is", "\\u", "b5", "8c", "heck", "(", "val", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "hex", "\\u", "ecd", "sa", "\\u", "pubkey_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "is", "\\u", "hex_", "(_", "val_", ")_", "and_", "len_", "(_", "val_", ")_", "==_", "128_", ")_", "\\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_", "is", "\\u", "binar", "y", "\\u", "ecd", "sa", "\\u", "pubkey_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\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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, 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, 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 ]
Unused import
alexcepoi/pyscale/pyscale/zmq/socket.py
[ { "content": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport logging\nimport re\nimport glob\nimport os.path as osp\nfrom contextlib import contextmanager\n\nfrom gevent_zeromq import zmq\nfrom .common import patterns, format_method\nfrom ..lib import ReqError\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ProxySocket(object):\n\treserved = ['_obj', '_parsed', '_key', '_value', '_attr', '_str']\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ProxySocket", "header": "['module', '___EOS___']", "index": 14 }, { "content": "\tdef __init__(self, obj, parsed=[]):\n\t\tself._obj = obj\n\t\tself._parsed = []\n\n\t\tself._str = None", "metadata": "root.ProxySocket.__init__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 17 }, { "content": "\tdef __getattr__(self, key):\n\t\tself._key = key\n\t\tself._attr = 'get'\n\t\treturn self._rpc()", "metadata": "root.ProxySocket.__getattr__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": "\tdef __setattr__(self, key, value):\n\t\tif key in self.reserved:\n\t\t\treturn super(ProxySocket, self).__setattr__(key, value)\n\n\t\tself._key = key\n\t\tself._value = value\n\t\tself._attr = 'set'\n\t\treturn self._rpc()", "metadata": "root.ProxySocket.__setattr__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": "\tdef __delattr__(self, key):\n\t\tif key in self.reserved:\n\t\t\treturn super(ProxySocket, self).__delattr__(key)\n\n\t\tself._key = key\n\t\tself._attr = 'del'\n\t\treturn self._rpc()", "metadata": "root.ProxySocket.__delattr__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 37 }, { "content": "\tdef __call__(self, *args, **kwargs):\n\t\tself._attr = 'call'\n\t\treturn self._rpc(*args, **kwargs)", "metadata": "root.ProxySocket.__call__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": "\tdef _rpc(self, *args, **kwargs):\n\t\t# prepare request\n\t\tif self._attr is 'call':\n\t\t\tblob = ('__call__', args, kwargs)\n\t\telif self._attr is 'get':\n\t\t\tblob = ('__getattribute__', [self._key], {})\n\t\telif self._attr is 'set':\n\t\t\tblob = ('__set', [self._key, self._value], {})\n\t\telif self._attr is 'del':\n\t\t\tblob = ('__del', [self._key], {})\n\t\telif self._attr is 'dir':\n\t\t\tblob = ('__dir', [], {})\n\t\telif self._attr is 'len':\n\t\t\tblob = ('__len', [], {})\n\t\telse:\n\t\t\traise ValueError('Unknown value for attr: %s' % self.attr)\n\n\t\tself._parsed.append(blob)\n\n\t\t# make request\n\t\tif self._obj._sock is not None:\n\t\t\treply = self._obj._send(self._parsed)\n\t\telse:\n\t\t\twith self._obj:\n\t\t\t\treply = self._obj._send(self._parsed)\n\n\t\t# parse response\n\t\tif 'error' in reply:\n\t\t\treturn ReqError(reply['error'])\n\t\telif 'proxy' in reply:\n\t\t\tself._str = '(proxy: %s)' % reply['proxy']\n\t\t\treturn self\n\t\telif 'result' in reply:\n\t\t\treturn reply['result']\n\t\telse:\n\t\t\traise ValueError('reply must be result, proxy or error')\n\n\t\treturn result", "metadata": "root.ProxySocket._rpc", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": "\tdef __str__(self):\n\t\tif self._str is None:\n\t\t\treturn super(ProxySocket, self).__str__()\n\n\t\treturn str(self._str)", "metadata": "root.ProxySocket.__str__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": "\tdef __repr__(self):\n\t\tif self._str is None:\n\t\t\treturn super(ProxySocket, self).__repr__()\n\n\t\treturn str(self._str)", "metadata": "root.ProxySocket.__repr__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 94 }, { "content": "\tdef __dir__(self):\n\t\tself._attr = 'dir'\n\t\treturn self._rpc()", "metadata": "root.ProxySocket.__dir__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 100 }, { "content": "\tdef __len__(self):\n\t\tself._attr = 'len'\n\t\treturn self._rpc()", "metadata": "root.ProxySocket.__len__", "header": "['class', 'ProxySocket', '(', 'object', ')', ':', '___EOS___']", "index": 104 }, { "content": "class Socket(object):\n\t\"\"\" ZMQ client for all messaging patterns \"\"\"\n\treserved = ['_name', '_type', '_pattern', '_subscription', '_context', '_sock_file', '_sock']\n\n\n\n\n\n\n\n\t# pass to proxy\n\n\n\n", "metadata": "root.Socket", "header": "['module', '___EOS___']", "index": 109 }, { "content": "\tdef __init__(self, name, _type='REQ', subscription='', context=None):\n\t\tself._name = name\n\t\tself._type = _type.upper()\n\t\tself._pattern = patterns[self._type]\n\t\tself._subscription = subscription\n\t\tself._context = context or zmq.Context.instance()\n\n\t\tself._sock_file = \"ipc://tmp/sockets/%s/%s.sock\" % (self._pattern, self._name)\n\t\tself._sock = None", "metadata": "root.Socket.__init__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 113 }, { "content": "\tdef _open(self):\n\t\tif self._sock is not None:\n\t\t\treturn\n\n\t\tself._sock = self._context.socket(getattr(zmq, self._type))\n\t\tself._sock.connect(self._sock_file)\n\n\t\tif self._pattern == 'pub':\n\t\t\tself._sock.setsockopt(zmq.SUBSCRIBE, self._subscription)\n\n\t\treturn self", "metadata": "root.Socket._open", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": "\tdef _close(self):\n\t\tif self._sock is not None:\n\t\t\tself._sock.close()\n\t\t\tself._sock = None\n\n\t\treturn self", "metadata": "root.Socket._close", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 135 }, { "content": "\tdef __enter__(self):\n\t\treturn self._open()", "metadata": "root.Socket.__enter__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": "\tdef __exit__(self, type, value, trace):\n\t\tself._close()", "metadata": "root.Socket.__exit__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 145 }, { "content": "\tdef _send(self, blob):\n\t\tself._sock.send_json(blob)\n\t\tlogging.debug(\"[zmq] ~> %s%s\" % (self._name, ''.join([format_method(*req) for req in blob])))\n\t\treturn self._sock.recv_json()", "metadata": "root.Socket._send", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": "\tdef __getattr__(self, key):\n\t\treturn getattr(ProxySocket(self), key)", "metadata": "root.Socket.__getattr__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 154 }, { "content": "\tdef __setattr__(self, key, value):\n\t\tif key in self.reserved:\n\t\t\treturn super(Socket, self).__setattr__(key, value)\n\t\telse:\n\t\t\treturn setattr(ProxySocket(self), key, value)", "metadata": "root.Socket.__setattr__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 157 }, { "content": "\tdef __delattr__(self, key):\n\t\tif key in self.reserved:\n\t\t\treturn super(Socket, self).__delattr__(key)\n\t\telse:\n\t\t\treturn delattr(ProxySocket(self), key)", "metadata": "root.Socket.__delattr__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 163 }, { "content": "\tdef __call__(self, *args, **kwargs):\n\t\treturn ProxySocket(self).__call__(*args, **kwargs)", "metadata": "root.Socket.__call__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 169 }, { "content": "\tdef __dir__(self):\n\t\treturn dir(ProxySocket(self))", "metadata": "root.Socket.__dir__", "header": "['class', 'Socket', '(', 'object', ')', ':', '___EOS___']", "index": 172 } ]
[ { "span": "import re", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import glob", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 11 }, { "span": "import os.path as osp", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 21 }, { "span": "from contextlib import contextmanager", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 37 } ]
[]
1
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_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "as_", "osp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gev", "ent", "\\u", "zero", "mq", "_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "common_", "import_", "patterns_", ",_", "format\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "lib_", "import_", "Re", "q", "Error_", "\\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_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "reserved_", "=_", "[_", "'\\u", "obj", "'_", ",_", "'\\u", "parsed", "'_", ",_", "'\\u", "key", "'_", ",_", "'\\u", "value", "'_", ",_", "'\\u", "attr", "'_", ",_", "'\\u", "str", "'_", "]_", "\\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_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "obj_", ",_", "parsed_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "obj_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parsed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "str_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "attr_", "=_", "'", "get", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rpc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "key_", "in_", "self_", "._", "reserved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "super_", "(_", "Pro", "xy", "Socket_", ",_", "self_", ")_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "attr_", "=_", "'", "set", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rpc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delattr", "\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "key_", "in_", "self_", "._", "reserved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "super_", "(_", "Pro", "xy", "Socket_", ",_", "self_", ")_", "._", "\\u\\u", "delattr", "\\u\\u_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "attr_", "=_", "'", "del", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rpc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "attr_", "=_", "'", "call", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rpc_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rpc_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prepar", "e", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "self_", "._", "\\u", "attr_", "is_", "'", "call", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "blob_", "=_", "(_", "'\\u", "\\u", "call", "\\u\\u'_", ",_", "args_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "attr_", "is_", "'", "get", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "blob_", "=_", "(_", "'\\u", "\\u", "getattr", "ibut", "e\\u", "\\u'_", ",_", "[_", "self_", "._", "\\u", "key_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "attr_", "is_", "'", "set", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "blob_", "=_", "(_", "'\\u", "\\u", "set", "'_", ",_", "[_", "self_", "._", "\\u", "key_", ",_", "self_", "._", "\\u", "value_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "attr_", "is_", "'", "del", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "blob_", "=_", "(_", "'\\u", "\\u", "del", "'_", ",_", "[_", "self_", "._", "\\u", "key_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "attr_", "is_", "'", "dir", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "blob_", "=_", "(_", "'\\u", "\\u", "dir", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "attr_", "is_", "'", "len", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "blob_", "=_", "(_", "'\\u", "\\u", "len", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\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", "\t\t_", "raise_", "Value", "Error_", "(_", "'", "Un", "know", "n", " ", "value", " ", "for", " ", "attr", ":", " ", "%", "s", "'_", "%_", "self_", "._", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "parsed_", "._", "append_", "(_", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "obj_", "._", "\\u", "sock_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "reply_", "=_", "self_", "._", "\\u", "obj_", "._", "\\u", "send_", "(_", "self_", "._", "\\u", "parsed_", ")_", "\\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", "\t\t_", "with_", "self_", "._", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "reply_", "=_", "self_", "._", "\\u", "obj_", "._", "\\u", "send_", "(_", "self_", "._", "\\u", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "error", "'_", "in_", "reply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "Re", "q", "Error_", "(_", "reply_", "[_", "'", "error", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "proxy", "'_", "in_", "reply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "str_", "=_", "'(", "proxy", ":", " ", "%", "s", ")'_", "%_", "reply_", "[_", "'", "proxy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "result", "'_", "in_", "reply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "reply_", "[_", "'", "result", "'_", "]_", "\\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", "\t\t_", "raise_", "Value", "Error_", "(_", "'", "repl", "y", " ", "must", " ", "be", " ", "result", ",", " ", "proxy", " ", "or", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "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\t", "\t_", "if_", "self_", "._", "\\u", "str_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "super_", "(_", "Pro", "xy", "Socket_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "self_", "._", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\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\t", "\t_", "if_", "self_", "._", "\\u", "str_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "super_", "(_", "Pro", "xy", "Socket_", ",_", "self_", ")_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "self_", "._", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "dir\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "attr_", "=_", "'", "dir", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rpc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pro", "xy", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "attr_", "=_", "'", "len", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rpc_", "(_", ")_", "\\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_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", " ", "ZM", "Q", " ", "client", " ", "for", " ", "all", " ", "mess", "agin", "g", " ", "pattern", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reserved_", "=_", "[_", "'\\u", "name", "'_", ",_", "'\\u", "type", "'_", ",_", "'\\u", "pattern", "'_", ",_", "'\\u", "subscript", "ion", "'_", ",_", "'\\u", "context", "'_", ",_", "'\\u", "sock", "\\u", "file", "'_", ",_", "'\\u", "sock", "'_", "]_", "\\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_", "#", " ", "pass", " ", "to", " ", "proxy_", "\\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_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "\\u", "type_", "=_", "'", "REQ", "'_", ",_", "subscription_", "=_", "''_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "type_", "=_", "\\u", "type_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pattern_", "=_", "patterns_", "[_", "self_", "._", "\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "subscription_", "=_", "subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "context_", "=_", "context_", "or_", "zmq_", "._", "Context_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "sock", "\\u", "file_", "=_", "\"", "ipc", "://", "tmp", "/", "socket", "s", "/", "%", "s", "/", "%", "s", ".", "sock", "\"_", "%_", "(_", "self_", "._", "\\u", "pattern_", ",_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "self_", "._", "\\u", "sock_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "sock_", "=_", "self_", "._", "\\u", "context_", "._", "socket_", "(_", "getattr_", "(_", "zmq_", ",_", "self_", "._", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sock_", "._", "connect_", "(_", "self_", "._", "\\u", "sock", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "pattern_", "==_", "'", "pub", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "sock_", "._", "setsockopt_", "(_", "zmq_", "._", "SUBSCRI", "BE_", ",_", "self_", "._", "\\u", "subscription_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "self_", "._", "\\u", "sock_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "self_", "._", "\\u", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "type_", ",_", "value_", ",_", "trace_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send_", "(_", "self_", ",_", "blob_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "sock_", "._", "send", "\\u", "json_", "(_", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"[", "zmq", "]", " ", "~", ">", " ", "%", "s", "%", "s", "\"_", "%_", "(_", "self_", "._", "\\u", "name_", ",_", "''_", "._", "join_", "(_", "[_", "format\\u", "method_", "(_", "*_", "req_", ")_", "for_", "req_", "in_", "blob_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "sock_", "._", "recv", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "getattr_", "(_", "Pro", "xy", "Socket_", "(_", "self_", ")_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "key_", "in_", "self_", "._", "reserved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "super_", "(_", "Socket_", ",_", "self_", ")_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "key_", ",_", "value_", ")_", "\\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", "\t\t_", "return_", "setattr_", "(_", "Pro", "xy", "Socket_", "(_", "self_", ")_", ",_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "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_", "def_", "\\u\\u", "delattr", "\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "key_", "in_", "self_", "._", "reserved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "super_", "(_", "Socket_", ",_", "self_", ")_", "._", "\\u\\u", "delattr", "\\u\\u_", "(_", "key_", ")_", "\\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", "\t\t_", "return_", "delattr", "_", "(_", "Pro", "xy", "Socket_", "(_", "self_", ")_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "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_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "Pro", "xy", "Socket_", "(_", "self_", ")_", "._", "\\u\\u", "call\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "dir\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "dir_", "(_", "Pro", "xy", "Socket_", "(_", "self_", ")_", ")_" ]
[ 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, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 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, 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 ]
Unused import
natduca/quickopen/src/db_indexer.py
[ { "content": "# Copyright 2011 Google 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.\nimport collections\nimport os\nimport time\nimport json\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DBIndexer(object):\n", "metadata": "root.DBIndexer", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, dirs):\n self.dirs = dirs\n self.complete = False\n self.files_by_basename = dict()", "metadata": "root.DBIndexer.__init__", "header": "['class', 'DBIndexer', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def progress(self):\n raise NotImplementedException()", "metadata": "root.DBIndexer.progress", "header": "['class', 'DBIndexer', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": "def Create(dirs, dir_cache):\n import find_based_db_indexer\n if find_based_db_indexer.Supported():\n return find_based_db_indexer.FindBasedDBIndexer(\n dirs, dir_cache.ignores)\n\n import listdir_based_db_indexer\n return listdir_based_db_indexer.ListdirBasedDBIndexer(dirs, dir_cache)", "metadata": "root.Create", "header": "['module', '___EOS___']", "index": 27 } ]
[ { "span": "import collections", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 18 }, { "span": "import os", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 9 }, { "span": "import time", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 11 }, { "span": "import json", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Goo", "gle", " ", "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_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\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_", "class_", "DB", "Indexer", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DB", "Indexer", "_", "(_", "object_", ")_", ":_", "\\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_", ",_", "dirs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dirs_", "=_", "dirs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "complete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "files", "\\u", "by", "\\u", "basename_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "Indexer", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "progress_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Exception_", "(_", ")_", "\\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_", "(_", "dirs_", ",_", "dir\\u", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "find", "\\u", "based", "\\u", "db", "\\u", "indexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "find", "\\u", "based", "\\u", "db", "\\u", "indexer_", "._", "Supported_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "find", "\\u", "based", "\\u", "db", "\\u", "indexer_", "._", "Fin", "d", "Base", "d", "DB", "Indexer", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dirs_", ",_", "dir\\u", "cache_", "._", "ignores", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "listd", "ir", "\\u", "based", "\\u", "db", "\\u", "indexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "listd", "ir", "\\u", "based", "\\u", "db",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 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, 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 ]
Unused import
cloudera/hue/desktop/core/ext-py/lxml-3.3.6/src/lxml/html/tests/test_frames.py
[ { "content": "import unittest, sys\nfrom lxml.tests.common_imports import make_doctest, doctest\nimport lxml.html\nfrom lxml.html import html_parser, XHTML_NAMESPACE\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FrameTest(unittest.TestCase):\n\n", "metadata": "root.FrameTest", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def test_parse_fragments_fromstring(self):\n parser = lxml.html.HTMLParser(encoding='utf-8', remove_comments=True)\n html = \"\"\"<frameset>\n <frame src=\"main.php\" name=\"srcpg\" id=\"srcpg\" frameborder=\"0\" rolling=\"Auto\" marginwidth=\"\" marginheight=\"0\">\n </frameset>\"\"\"\n etree_document = lxml.html.fragments_fromstring(html, parser=parser)\n self.assertEqual(len(etree_document), 1)\n root = etree_document[0]\n self.assertEqual(root.tag, \"frameset\")\n frame_element = root[0]\n self.assertEqual(frame_element.tag, 'frame')", "metadata": "root.FrameTest.test_parse_fragments_fromstring", "header": "['class', 'FrameTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 7 }, { "content": " def test_parse_fromstring(self):\n parser = lxml.html.HTMLParser(encoding='utf-8', remove_comments=True)\n html = \"\"\"<html><frameset>\n <frame src=\"main.php\" name=\"srcpg\" id=\"srcpg\" frameborder=\"0\" rolling=\"Auto\" marginwidth=\"\" marginheight=\"0\">\n </frameset></html>\"\"\"\n etree_document = lxml.html.fromstring(html, parser=parser)\n self.assertEqual(etree_document.tag, 'html')\n self.assertEqual(len(etree_document), 1)\n frameset_element = etree_document[0]\n self.assertEqual(len(frameset_element), 1)\n frame_element = frameset_element[0]\n self.assertEqual(frame_element.tag, 'frame')", "metadata": "root.FrameTest.test_parse_fromstring", "header": "['class', 'FrameTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": "def test_suite():\n loader = unittest.TestLoader()\n return loader.loadTestsFromModule(sys.modules[__name__])", "metadata": "root.test_suite", "header": "['module', '___EOS___']", "index": 33 } ]
[ { "span": "from lxml.tests.common_imports import make_doctest, doctest", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 59 }, { "span": "from lxml.html import html_parser, XHTML_NAMESPACE", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "._", "tests_", "._", "common", "\\u", "imports_", "import_", "make", "\\u", "doctest_", ",_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lxml_", "._", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "._", "html_", "import_", "html", "\\u", "parser_", ",_", "XH", "TML", "\\u", "NAMESPACE_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Frame", "Test_", "(_", "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_", "[SEP]_", "class_", "Frame", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "parse", "\\u", "fragment", "s", "\\u", "fromstring_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "lxml_", "._", "html_", "._", "HTM", "LP", "arser", "_", "(_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "remove", "\\u", "comments_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "\"\"\"", "<", "frames", "et", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "frame", " ", "src", "=\"", "main", ".", "php", "\"", " ", "name", "=\"", "srcp", "g", "\"", " ", "id", "=\"", "srcp", "g", "\"", " ", "frame", "border", "=\"", "0", "\"", " ", "rolling", "=\"", "Auto", "\"", " ", "marg", "in", "widt", "h", "=\"\"", " ", "marg", "inh", "eight", "=\"", "0", "\">", "\\", "10", ";", " ", " ", " ", " ", "</", "frames", "et", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree", "\\u", "document_", "=_", "lxml_", "._", "html_", "._", "fragment", "s", "\\u", "fromstring_", "(_", "html_", ",_", "parser_", "=_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "etree", "\\u", "document_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "etree", "\\u", "document_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "tag_", ",_", "\"", "frames", "et", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "\\u", "element_", "=_", "root_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "frame", "\\u", "element_", "._", "tag_", ",_", "'", "frame", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Frame", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "parse", "\\u", "fromstring_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "lxml_", "._", "html_", "._", "HTM", "LP", "arser", "_", "(_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "remove", "\\u", "comments_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "=_", "\"\"\"", "<", "html", "><", "frames", "et", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "frame", " ", "src", "=\"", "main", ".", "php", "\"", " ", "name", "=\"", "srcp", "g", "\"", " ", "id", "=\"", "srcp", "g", "\"", " ", "frame", "border", "=\"", "0", "\"", " ", "rolling", "=\"", "Auto", "\"", " ", "marg", "in", "widt", "h", "=\"\"", " ", "marg", "inh", "eight", "=\"", "0", "\">", "\\", "10", ";", " ", " ", " ", " ", "</", "frames", "et", "><", "/", "html", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etree", "\\u", "document_", "=_", "lxml_", "._", "html_", "._", "fromstring_", "(_", "html_", ",_", "parser_", "=_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "etree", "\\u", "document_", "._", "tag_", ",_", "'", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "etree", "\\u", "document_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frames", "et", "\\u", "element_", "=_", "etree", "\\u", "document_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "frames", "et", "\\u", "element_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "\\u", "element_", "=_", "frames", "et", "\\u", "element_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "frame", "\\u", "element_", "._", "tag_", ",_", "'", "frame", "'_", ")_", "\\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_", "test\\u", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "=_", "unittest_", "._", "Test", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "loader_", "._", "load", "Test", "s", "Fro", "m", "Module_", "(_", "sys_", "._", "modules_", "[_", "\\u\\u", "name\\u\\u_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1,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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, 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 ]
Unused import
godaddy/Thespian/thespian/test/testWakeup.py
[ { "content": "\"\"\"Verify wakeupAfter behavior.\n\nThe wakeupAfter call can be used by an Actor to request a\nWakeupMessage after a specified time period. Multiple wakeupAfter\ncalls can be pending; they cannot be cancelled (although they are\naborted if the Actor is killed).\n\"\"\"\n\nimport unittest\nfrom datetime import datetime, timedelta\nimport time\nimport thespian.test.helpers\nfrom thespian.actors import *\nfrom thespian.test import ActorSystemTestCase\n\nwakeupAfterPeriod = timedelta(seconds=0.65)\nsleepLongerThanWakeup = lambda: time.sleep(0.7)\nsleepPartOfWakeupPeriod = lambda: time.sleep(0.1)\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RetryActor(Actor):", "metadata": "root.RetryActor", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self):\n self._numWakeups = 0", "metadata": "root.RetryActor.__init__", "header": "['class', 'RetryActor', '(', 'Actor', ')', ':', '___EOS___']", "index": 21 }, { "content": " def receiveMessage(self, msg, sender):\n if \"check\" == msg:\n self.wakeupAfter(wakeupAfterPeriod)\n elif isinstance(msg, WakeupMessage):\n self._numWakeups += 1\n elif \"awoken?\" == msg:\n self.send(sender, self._numWakeups)", "metadata": "root.RetryActor.receiveMessage", "header": "['class', 'RetryActor', '(', 'Actor', ')', ':', '___EOS___']", "index": 23 }, { "content": "class TestASimpleSystem(ActorSystemTestCase):\n testbase='Simple'\n scope='func'\n\n\n\n\n\n\n", "metadata": "root.TestASimpleSystem", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def test_oneWakeup(self):\n aS = ActorSystem()\n waiter = aS.createActor(RetryActor)\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n\n aS.tell(waiter, 'check')\n # Next assert will fail if it takes more than the wakeupPeriod\n # to run after the previous statement.\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n\n sleepLongerThanWakeup()\n\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 1)", "metadata": "root.TestASimpleSystem.test_oneWakeup", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def test_threeWakeupsInSequence(self):\n aS = ActorSystem()\n waiter = aS.createActor(RetryActor)\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n\n aS.tell(waiter, 'check')\n # Next assert will fail if it takes more than the wakeupPeriod\n # to run after the previous statement.\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n\n sleepLongerThanWakeup()\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 1)\n\n aS.tell(waiter, 'check')\n # ditto above\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 1)\n\n sleepLongerThanWakeup()\n aS.tell(waiter, 'check')\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 2)\n\n sleepLongerThanWakeup()\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 3)", "metadata": "root.TestASimpleSystem.test_threeWakeupsInSequence", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_multipleWakeupsPending(self):\n aS = ActorSystem()\n waiter = aS.createActor(RetryActor)\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n\n aS.tell(waiter, 'check')\n aS.tell(waiter, 'check')\n # Next assert will fail if it takes more than the wakeupPeriod\n # to run after the previous statement.\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n\n sleepLongerThanWakeup()\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 2)\n\n aS.tell(waiter, 'check')\n sleepPartOfWakeupPeriod()\n aS.tell(waiter, 'check')\n sleepPartOfWakeupPeriod()\n aS.tell(waiter, 'check')\n\n sleepLongerThanWakeup()\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 5)", "metadata": "root.TestASimpleSystem.test_multipleWakeupsPending", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_exitWithWakeupsPending(self):\n aS = ActorSystem()\n waiter = aS.createActor(RetryActor)\n self.assertEqual(aS.ask(waiter, 'awoken?', 1), 0)\n aS.tell(waiter, 'check')\n sleepPartOfWakeupPeriod()\n aS.tell(waiter, ActorExitRequest())\n self.assertTrue(True) # ensure above doesn't throw exception", "metadata": "root.TestASimpleSystem.test_exitWithWakeupsPending", "header": "['class', 'TestASimpleSystem', '(', 'ActorSystemTestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": "class TestMultiprocUDPSystem(TestASimpleSystem):\n testbase='MultiprocUDP'", "metadata": "root.TestMultiprocUDPSystem", "header": "['module', '___EOS___']", "index": 111 }, { "content": " def setUp(self):\n self.setSystemBase('multiprocUDPBase')\n super(TestMultiprocUDPSystem, self).setUp()", "metadata": "root.TestMultiprocUDPSystem.setUp", "header": "['class', 'TestMultiprocUDPSystem', '(', 'TestASimpleSystem', ')', ':', '___EOS___']", "index": 113 }, { "content": "class TestMultiprocTCPSystem(TestASimpleSystem):\n testbase='MultiprocTCP'", "metadata": "root.TestMultiprocTCPSystem", "header": "['module', '___EOS___']", "index": 117 }, { "content": " def setUp(self):\n self.setSystemBase('multiprocTCPBase')\n super(TestMultiprocTCPSystem, self).setUp()", "metadata": "root.TestMultiprocTCPSystem.setUp", "header": "['class', 'TestMultiprocTCPSystem', '(', 'TestASimpleSystem', ')', ':', '___EOS___']", "index": 119 }, { "content": "class TestMultiprocQueueSystem(TestASimpleSystem):\n testbase='MultiprocQueue'", "metadata": "root.TestMultiprocQueueSystem", "header": "['module', '___EOS___']", "index": 123 }, { "content": " def setUp(self):\n self.setSystemBase('multiprocQueueBase')\n super(TestMultiprocQueueSystem, self).setUp()", "metadata": "root.TestMultiprocQueueSystem.setUp", "header": "['class', 'TestMultiprocQueueSystem', '(', 'TestASimpleSystem', ')', ':', '___EOS___']", "index": 125 } ]
[ { "span": "import unittest", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 15 }, { "span": "import thespian.test.helpers", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Verify", " ", "wake", "up", "Af", "ter", " ", "behavior", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "wake", "up", "Af", "ter", " ", "call", " ", "can", " ", "be", " ", "used", " ", "by", " ", "an", " ", "Act", "or", " ", "to", " ", "request", " ", "a", "\\", "10", ";", "Wake", "up", "Messag", "e", " ", "after", " ", "a", " ", "specified", " ", "time", " ", "period", ".", " ", " ", "Multipl", "e", " ", "wake", "up", "Af", "ter", "\\", "10", ";", "calls", " ", "can", " ", "be", " ", "pend", "ing", ";", " ", "the", "y", " ", "cann", "ot", " ", "be", " ", "cancel", "led", " ", "(", "alth", "ou", "gh", " ", "the", "y", " ", "are", "\\", "10", ";", "abort", "ed", " ", "if", " ", "the", " ", "Act", "or", " ", "is", " ", "kille", "d", ").", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "thes", "pian", "_", "._", "test_", "._", "helpers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "actors_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thes", "pian", "_", "._", "test_", "import_", "Act", "or", "System", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wake", "up", "Af", "ter", "Period_", "=_", "timedelta_", "(_", "seconds_", "=_", "0.65_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "=_", "lambda_", ":_", "time_", "._", "sleep_", "(_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "Part", "Of", "Wake", "up", "Period_", "=_", "lambda_", ":_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\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\\uNEWLINE\\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_", "Retr", "y", "Actor_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retr", "y", "Actor_", "(_", "Actor_", ")_", ":_", "\\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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "num", "Wake", "ups_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retr", "y", "Actor_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "receive", "Message_", "(_", "self_", ",_", "msg_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "check", "\"_", "==_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wake", "up", "After_", "(_", "wake", "up", "Af", "ter", "Period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "msg_", ",_", "Wake", "up", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "num", "Wake", "ups_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "aw", "oken", "?\"_", "==_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "sender_", ",_", "self_", "._", "\\u", "num", "Wake", "ups_", ")_", "\\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_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope_", "=_", "'", "func", "'_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "one", "Wake", "up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "S_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "waiter_", "=_", "a", "S_", "._", "create", "Actor_", "(_", "Retr", "y", "Actor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "xt", " ", "assert", " ", "will", " ", "fail", " ", "if", " ", "it", " ", "take", "s", " ", "more", " ", "than", " ", "the", " ", "wake", "up", "Period_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "run", " ", "after", " ", "the", " ", "previ", "ous", " ", "statem", "ent", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "three", "Wake", "ups", "In", "Sequence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "S_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "waiter_", "=_", "a", "S_", "._", "create", "Actor_", "(_", "Retr", "y", "Actor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "xt", " ", "assert", " ", "will", " ", "fail", " ", "if", " ", "it", " ", "take", "s", " ", "more", " ", "than", " ", "the", " ", "wake", "up", "Period_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "run", " ", "after", " ", "the", " ", "previ", "ous", " ", "statem", "ent", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dit", "to", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "Wake", "ups", "Pend", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "S_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "waiter_", "=_", "a", "S_", "._", "create", "Actor_", "(_", "Retr", "y", "Actor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "xt", " ", "assert", " ", "will", " ", "fail", " ", "if", " ", "it", " ", "take", "s", " ", "more", " ", "than", " ", "the", " ", "wake", "up", "Period_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "run", " ", "after", " ", "the", " ", "previ", "ous", " ", "statem", "ent", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "Part", "Of", "Wake", "up", "Period_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "Part", "Of", "Wake", "up", "Period_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sleep", "Long", "er", "Than", "Wake", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "impl", "e", "System_", "(_", "Act", "or", "System", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "exit", "With", "Wake", "ups", "Pend", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "S_", "=_", "Act", "or", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "waiter_", "=_", "a", "S_", "._", "create", "Actor_", "(_", "Retr", "y", "Actor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "S_", "._", "ask_", "(_", "waiter_", ",_", "'", "aw", "oken", "?'_", ",_", "1_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "'", "check", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sleep", "Part", "Of", "Wake", "up", "Period_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "S_", "._", "tell_", "(_", "waiter_", ",_", "Act", "or", "Exi", "t", "Request_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "True_", ")_", "#", " ", "ensure", " ", "above", " ", "doe", "sn", "'", "t", " ", "throw", " ", "exception_", "\\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", "Multi", "proc", "UD", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Multi", "proc", "UD", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "proc", "UD", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "System", "Base_", "(_", "'", "multipro", "c", "UD", "PB", "ase", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Multi", "proc", "UD", "PS", "ystem_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\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", "Multi", "proc", "TC", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Multi", "proc", "TC", "P", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "proc", "TC", "PS", "ystem_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "System", "Base_", "(_", "'", "multipro", "c", "TC", "PB", "ase", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Multi", "proc", "TC", "PS", "ystem_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\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", "Multi", "proc", "Queue", "System_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testb", "ase_", "=_", "'", "Multi", "proc", "Queue", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "proc", "Queue", "System_", "(_", "Test", "AS", "impl", "e", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "System", "Base_", "(_", "'", "multipro", "c", "Queue", "Base", "'_", ")_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reateDataport++\"\n reporter = Datastore(cik,\n interval,\n dataport_config,\n datastore_config,\n transport_config)\n status, message = reporter.createDataport(\n alias='V1',\n format=\"float\",\n name=None,\n preprocess=[['add', 1]],\n count=10,\n duration=\"infinity\",\n visibility=\"parent\")", "metadata": "root.caseCreateDataport", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "status,", "start_line": 73, "start_column": 4, "end_line": 73, "end_column": 10 }, { "span": "message ", "start_line": 73, "start_column": 12, "end_line": 73, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "case", "Creat", "e", "Data", "port_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"+", "+", "case", "Creat", "e", "Data", "port", "++", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reporter_", "=_", "Datas", "tore_", "(_", "ci", "k_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datap", "ort", "\\u", "config_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "config_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transport", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "message_", "=_", "reporter_", "._", "create", "Data", "port_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "alias_", "=_", "'", "V1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "preprocess_", "=_", "[_", "[_", "'", "add", "'_", ",_", "1_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", "=_", "\"", "infinity", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "visibility_", "=_", "\"", "parent", "\"_", ")_", "\\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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
caseywstark/colab/colab/apps/issues/models.py
[ { "content": "from datetime import datetime\n\nfrom django.core.urlresolvers import reverse\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.auth.models import User\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttypes import generic\n\nfrom tagging.fields import TagField\n\nfrom disciplines.models import Discipline\nfrom people.models import Institution\nfrom papers.models import Paper\nimport object_feeds\n\n\nobject_feeds.register(Issue)\n\n\nfrom django.db.models.signals import pre_save, post_save\n\n\npost_save.connect(issue_feed_title_update, sender=Issue)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Issue(models.Model):\n \n title = models.CharField(_(\"title\"), max_length=255, unique=True)\n slug = models.SlugField(_(\"slug\"), unique=True)\n creator = models.ForeignKey(User, verbose_name=_(\"creator\"), related_name=\"%(class)s_created\")\n created = models.DateTimeField(_(\"created\"), default=datetime.now)\n description = models.TextField(_(\"description\"))\n \n private = models.BooleanField(_(\"private\"), default=False)\n sandbox = models.BooleanField(_(\"sandbox\"), default=False)\n model_project = models.BooleanField(_(\"model project\"), default=False)\n \n disciplines = models.ManyToManyField(Discipline, blank=True)\n tags = TagField()\n \n # resolution\n resolved = models.BooleanField(default=False)\n resolution = models.ForeignKey(Paper, null=True, blank=True, related_name='resolved_issue')\n \n contributor_users = models.ManyToManyField(User,\n through = \"IssueContributor\",\n verbose_name = _(\"contributor\")\n )\n \n # store contributing institutions! why not?\n institutions = models.ManyToManyField(Institution, blank=True)\n \n ### denormalization\n # votes\n yeas = models.PositiveIntegerField(default=0, editable=False)\n nays = models.PositiveIntegerField(default=0, editable=False)\n votes = models.PositiveIntegerField(default=0, editable=False)\n # contributors\n contributors_count = models.PositiveIntegerField(default=1, editable=False)\n # comments\n comments_count = models.PositiveIntegerField(default=0, editable=False)\n # followers\n followers_count = models.PositiveIntegerField(default=0, editable=False)\n \n \n class Meta:\n verbose_name = _(\"Issue\")\n verbose_name_plural = _(\"Issues\")\n \n \n \n \n ", "metadata": "root.Issue", "header": "['module', '___EOS___']", "index": 16 }, { "content": " @property\n def papers(self):\n return Paper.objects.filter(content_type=ContentType.objects.get_for_model(self),object_id=self.id)", "metadata": "root.Issue.papers", "header": "['class', 'Issue', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 55 }, { "content": " def __unicode__(self):\n return self.title", "metadata": "root.Issue.__unicode__", "header": "['class', 'Issue', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 63 }, { "content": " def get_absolute_url(self):\n return reverse(\"issue_detail\", kwargs={\"slug\": self.slug})", "metadata": "root.Issue.get_absolute_url", "header": "['class', 'Issue', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 66 }, { "content": " def user_is_contributor(self, user):\n return self.contributors.filter(user=user).exists()", "metadata": "root.Issue.user_is_contributor", "header": "['class', 'Issue', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 69 }, { "content": " def user_can_read(self, user):\n if self.private and not self.user_is_contributor(user):\n return False\n return True", "metadata": "root.Issue.user_can_read", "header": "['class', 'Issue', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 72 }, { "content": " def resolve(self, resolution_paper):\n if resolution_paper in self.papers:\n self.resolution = resolution_paper\n self.resolved = True\n self.save()\n return resolution_paper\n return False", "metadata": "root.Issue.resolve", "header": "['class', 'Issue', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 77 }, { "content": "class IssueContributor(models.Model):\n \n issue = models.ForeignKey(Issue, related_name = \"contributors\", verbose_name = _(\"issue\"))\n user = models.ForeignKey(User, related_name = \"issues\", verbose_name = _(\"user\"))\n \n contributions = models.PositiveIntegerField(_(\"contributions\"), default=1)\n \n away = models.BooleanField(_(\"away\"), default=False)\n away_message = models.CharField(_(\"away_message\"), max_length=500)\n away_since = models.DateTimeField(_(\"away since\"), default=datetime.now)\n \n class Meta:\n unique_together = [(\"user\", \"issue\")]", "metadata": "root.IssueContributor", "header": "['module', '___EOS___']", "index": 87 }, { "content": "def issue_feed_title_update(sender, instance, created, **kwargs):\n instance.feed.title = instance.title\n instance.feed.save()", "metadata": "root.issue_feed_title_update", "header": "['module', '___EOS___']", "index": 103 } ]
[ { "span": "from django.contrib.contenttypes import generic", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 47 }, { "span": "from django.db.models.signals import pre_save, post_save", "start_line": 101, "start_column": 0, "end_line": 101, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "import_", "generic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tagging", "_", "._", "fields_", "import_", "Ta", "g", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "disciplin", "es_", "._", "models_", "import_", "Disc", "ipl", "ine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "people_", "._", "models_", "import_", "Institut", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "papers", "_", "._", "models_", "import_", "Pap", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "object\\u", "feeds_", "\\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_", "object\\u", "feeds_", "._", "register_", "(_", "Issue_", ")_", "\\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_", "from_", "django_", "._", "db_", "._", "models_", "._", "signals_", "import_", "pre", "\\u", "save_", ",_", "post", "\\u", "save_", "\\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_", "post", "\\u", "save_", "._", "connect_", "(_", "issue", "\\u", "feed", "\\u", "title", "\\u", "update_", ",_", "sender_", "=_", "Issue_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "title", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slug_", "=_", "models_", "._", "Sl", "ug", "Field_", "(_", "\\u_", "(_", "\"", "slug", "\"_", ")_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creator_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "creat", "or", "\"_", ")_", ",_", "relate", "d\\u", "name_", "=_", "\"%", "(", "class", ")", "s", "\\u", "created", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "\\u_", "(_", "\"", "created", "\"_", ")_", ",_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "models_", "._", "Text", "Field_", "(_", "\\u_", "(_", "\"", "description", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "private_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "\"", "private", "\"_", ")_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sandbox_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "\"", "sand", "box", "\"_", ")_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "project_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "\"", "model", " ", "project", "\"_", ")_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disciplin", "es_", "=_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "Disc", "ipl", "ine_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "Ta", "g", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resolution_", "\\u\\u\\uNL\\u\\u\\u_", "resolved_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolution_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Pap", "er_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "resolve", "d\\u", "issue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contributor", "\\u", "users_", "=_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "User_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "through_", "=_", "\"", "Issue", "Contributor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "contributor", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "store", " ", "contrib", "uti", "ng", " ", "institution", "s", "!", " ", "wh", "y", " ", "not", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "institution", "s_", "=_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "Institut", "ion_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "deno", "rmal", "ization_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "votes_", "\\u\\u\\uNL\\u\\u\\u_", "ye", "as_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na", "ys_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "votes_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "contributor", "s", "\\u", "count_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "1_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "comments_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "s", "\\u", "count_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "followers", "_", "\\u\\u\\uNL\\u\\u\\u_", "followers", "\\u", "count_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "default_", "=_", "0_", ",_", "editable_", "=_", "False_", ")_", "\\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_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Issue", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "\"", "Issues", "\"_", ")_", "\\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_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "papers", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Pap", "er_", "._", "objects_", "._", "filter_", "(_", "content", "\\u", "type_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "self_", ")_", ",_", "object\\u", "id_", "=_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "abs", "olute", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\"", "issue", "\\u", "deta", "il", "\"_", ",_", "kwargs_", "=_", "{_", "\"", "slug", "\"_", ":_", "self_", "._", "slug_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "is", "\\u", "contributor_", "(_", "self_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "contributor", "s_", "._", "filter_", "(_", "user_", "=_", "user_", ")_", "._", "exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "\\u", "can", "\\u", "read_", "(_", "self_", ",_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "private_", "and_", "not_", "self_", "._", "user", "\\u", "is", "\\u", "contributor_", "(_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve_", "(_", "self_", ",_", "resolu", "tion", "\\u", "paper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "resolu", "tion", "\\u", "paper_", "in_", "self_", "._", "papers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "resolution_", "=_", "resolu", "tion", "\\u", "paper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resolved_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resolu", "tion", "\\u", "paper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Issue", "Contributor", "_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issue_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Issue_", ",_", "relate", "d\\u", "name_", "=_", "\"", "contributor", "s", "\"_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "issue", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "User_", ",_", "relate", "d\\u", "name_", "=_", "\"", "issue", "s", "\"_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "user", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contributions", "_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "\\u_", "(_", "\"", "contributions", "\"_", ")_", ",_", "default_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "away_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "\"", "awa", "y", "\"_", ")_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "message_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "awa", "y", "\\u", "message", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "since_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "\\u_", "(_", "\"", "awa", "y", " ", "sinc", "e", "\"_", ")_", ",_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unique", "\\u", "together_", "=_", "[_", "(_", "\"", "user", "\"_", ",_", "\"", "issue", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "issue", "\\u", "feed", "\\u", "title", "\\u", "update_", "(_", "sender_", ",_", "instance_", ",_", "created_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "._", "feed_", "._", "title_", "=_", "instance_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "feed_", "._", "save_", "(_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
recipy/recipy/test/examples/example_script_exception.py
[ { "content": "import recipy\nimport numpy\n\narr = numpy.arange(10)\narr = arr + 'hello'\n# We've made a fairly big change here!\n\nnumpy.save('testNGCM_2.npy', arr)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import recipy", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "recip", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arr_", "=_", "numpy_", "._", "arange_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr_", "=_", "arr_", "+_", "'", "hell", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "ve", " ", "made", " ", "a", " ", "fair", "ly", " ", "big", " ", "change", " ", "here", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "save_", "(_", "'", "test", "NG", "CM", "\\u", "2", ".", "npy", "'_", ",_", "arr_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
mediawiki-utilities/python-mediawiki-utilities/mw/xml_dump/tests/test_map.py
[ { "content": "def test_dict_yield():\n def test_map():\n f = io.StringIO(SAMPLE_XML)\n\n def process_dump(dump, path):\n for page in dump:\n count = 0\n for rev in page:\n count += 1\n\n yield {'page_id': page.id, 'revisions': count}\n\n pages = 0\n for doc in map([f], process_dump):\n page_id = doc['page_id']\n revisions = doc['revisions']\n if page_id == 1:\n eq_(revisions, 2)\n elif page_id == 2:\n eq_(revisions, 1)\n else:\n assert False\n\n pages += 1\n\n eq_(pages, 2)", "metadata": "root.test_dict_yield", "header": "['module', '___EOS___']", "index": 98 }, { "content": "@raises(TypeError)\ndef test_map_error():\n f = io.StringIO(SAMPLE_XML)\n\n def process_dump(dump, path):\n for page in dump:\n\n if page.id == 2:\n raise TypeError(\"Fake error\")\n\n pages = 0\n for doc in map([f], process_dump):\n page_id = doc['page_id']", "metadata": "root.test_map_error", "header": "['module', '___EOS___']", "index": 126 } ]
[ { "span": "test_map(", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 16 }, { "span": "pages ", "start_line": 136, "start_column": 4, "end_line": 136, "end_column": 9 }, { "span": "page_id ", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 15 } ]
[]
1
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_", "def_", "test\\u", "dict", "\\u", "yield_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "map_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "io_", "._", "String", "IO_", "(_", "SAMPLE", "\\u", "XML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "dump_", "(_", "dump_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "page_", "in_", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rev_", "in_", "page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "{_", "'", "page", "\\u", "id", "'_", ":_", "page_", "._", "id_", ",_", "'", "revis", "ion", "s", "'_", ":_", "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_", "pages_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "map_", "(_", "[_", "f_", "]_", ",_", "process", "\\u", "dump_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "id_", "=_", "doc_", "[_", "'", "page", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revisions_", "=_", "doc_", "[_", "'", "revis", "ion", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "page", "\\u", "id_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eq\\u_", "(_", "revisions_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "page", "\\u", "id_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eq\\u_", "(_", "revisions_", ",_", "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 ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pages_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eq\\u_", "(_", "pages_", ",_", "2_", ")_", "\\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_", "@_", "raises_", "(_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "map", "\\u", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "io_", "._", "String", "IO_", "(_", "SAMPLE", "\\u", "XML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "dump_", "(_", "dump_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "page_", "in_", "dump_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "page_", "._", "id_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Fake", " ", "error", "\"_", ")_", "\\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_", "pages_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "map_", "(_", "[_", "f_", "]_", ",_", "process", "\\u", "dump_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page", "\\u", "id_", "=_", "doc_", "[_", "'", "page", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
bigmlcom/python/bigml/tests/create_project_steps.py
[ { "content": "# -*- coding: utf-8 -*-\n#!/usr/bin/env python\n#\n# Copyright 2014-2015 BigML\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 os\nimport time\nimport json\nfrom datetime import datetime, timedelta\nfrom urllib import urlencode\nfrom world import world\n\nfrom bigml.api import HTTP_CREATED, HTTP_ACCEPTED\nfrom bigml.api import FINISHED\nfrom bigml.api import FAULTY\nfrom bigml.api import UPLOADING\nfrom bigml.api import get_status\n\nfrom read_project_steps import i_get_the_project\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def i_create_project(step, name):\n resource = world.api.create_project({\"name\": name})\n # update status\n world.status = resource['code']\n world.location = resource['location']\n world.project = resource['object']\n # save reference\n world.projects.append(resource['resource'])", "metadata": "root.i_create_project", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def wait_until_project_status_code_is(step, code1, code2, secs):\n start = datetime.utcnow()\n i_get_the_project(step, world.project['resource'])\n status = get_status(world.project)\n while (status['code'] != int(code1) and\n status['code'] != int(code2)):\n time.sleep(3)\n assert datetime.utcnow() - start < timedelta(seconds=int(secs))\n i_get_the_project(step, world.project['resource'])\n status = get_status(world.project)\n assert status['code'] == int(code1)", "metadata": "root.wait_until_project_status_code_is", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def the_project_is_finished(step, secs):\n wait_until_project_status_code_is(step, FINISHED, FAULTY, secs)", "metadata": "root.the_project_is_finished", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def i_update_project_name_with(step, name=\"\"):\n resource = world.api.update_project(world.project.get('resource'),\n {\"name\": name})\n world.status = resource['code']\n assert world.status == HTTP_ACCEPTED\n world.project = resource['object']", "metadata": "root.i_update_project_name_with", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def i_check_project_name(step, name=\"\"):\n updated_name = world.project.get(\"name\", \"\")\n if updated_name == name:\n assert True\n else:\n assert False, \"Project name: %s, expected name: %s\" % (updated_name,\n name)", "metadata": "root.i_check_project_name", "header": "['module', '___EOS___']", "index": 68 } ]
[ { "span": "import os", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 9 }, { "span": "import json", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 11 }, { "span": "from bigml.api import HTTP_CREATED, HTTP_ACCEPTED", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 49 }, { "span": "from bigml.api import UPLOADING", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", "-", "201", "5", " ", "Big", "ML_", "\\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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "world_", "import_", "world_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "big", "ml_", "._", "api_", "import_", "HTTP", "\\u", "CREATED_", ",_", "HTTP", "\\u", "ACCEPTED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "big", "ml_", "._", "api_", "import_", "FINISH", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "big", "ml_", "._", "api_", "import_", "FA", "ULT", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "big", "ml_", "._", "api_", "import_", "UPLOAD", "ING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "big", "ml_", "._", "api_", "import_", "get", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "read", "\\u", "project", "\\u", "steps_", "import_", "i", "\\u", "get", "\\u", "the", "\\u", "project_", "\\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_", "i", "\\u", "create", "\\u", "project_", "(_", "step_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "world_", "._", "api_", "._", "create", "\\u", "project_", "(_", "{_", "\"", "name", "\"_", ":_", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "update", " ", "status_", "\\u\\u\\uNL\\u\\u\\u_", "world_", "._", "status_", "=_", "resource_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "location_", "=_", "resource_", "[_", "'", "location", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "project_", "=_", "resource_", "[_", "'", "object", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "world_", "._", "projects_", "._", "append_", "(_", "resource_", "[_", "'", "resource", "'_", "]_", ")_", "\\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_", "wait", "\\u", "unti", "l\\u", "project", "\\u", "status", "\\u", "code", "\\u", "is_", "(_", "step_", ",_", "code", "1_", ",_", "code", "2_", ",_", "secs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "get", "\\u", "the", "\\u", "project_", "(_", "step_", ",_", "world_", "._", "project_", "[_", "'", "resource", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "get", "\\u", "status_", "(_", "world_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "status_", "[_", "'", "code", "'_", "]_", "!=_", "int_", "(_", "code", "1_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "[_", "'", "code", "'_", "]_", "!=_", "int_", "(_", "code", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "datetime_", "._", "utcnow_", "(_", ")_", "-_", "start_", "<_", "timedelta_", "(_", "seconds_", "=_", "int_", "(_", "secs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "get", "\\u", "the", "\\u", "project_", "(_", "step_", ",_", "world_", "._", "project_", "[_", "'", "resource", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "get", "\\u", "status_", "(_", "world_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "status_", "[_", "'", "code", "'_", "]_", "==_", "int_", "(_", "code", "1_", ")_", "\\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_", "the", "\\u", "project", "\\u", "is", "\\u", "finished_", "(_", "step_", ",_", "secs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wait", "\\u", "unti", "l\\u", "project", "\\u", "status", "\\u", "code", "\\u", "is_", "(_", "step_", ",_", "FINISH", "ED_", ",_", "FA", "ULT", "Y_", ",_", "secs_", ")_", "\\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_", "i", "\\u", "update", "\\u", "project", "\\u", "name", "\\u", "with_", "(_", "step_", ",_", "name_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "world_", "._", "api_", "._", "update", "\\u", "project_", "(_", "world_", "._", "project_", "._", "get_", "(_", "'", "resource", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "name", "\"_", ":_", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "status_", "=_", "resource_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "world_", "._", "status_", "==_", "HTTP", "\\u", "ACCEPTED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "world_", "._", "project_", "=_", "resource_", "[_", "'", "object", "'_", "]_", "\\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_", "i", "\\u", "check", "\\u", "project", "\\u", "name_", "(_", "step_", ",_", "name_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "d\\u", "name_", "=_", "world_", "._", "project_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update", "d\\u", "name_", "==_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "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 ", " _", "assert_", "False_", ",_", "\"", "Project", " ", "name", ":", " ", "%", "s", ",", " ", "expected", " ", "name", ":", " ", "%", "s", "\"_", "%_", "(_", "update", "d\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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Type", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def split(self):\n buf = []\n node = self\n while node is not None:\n buf.append(node)\n node = node.parent\n buf.reverse()\n return buf", "metadata": "root._TokenType.split", "header": "['class', '_TokenType', '(', 'tuple', ')', ':', '___EOS___']", "index": 14 }, { "content": " def __init__(self, *args):\n # no need to call super.__init__\n self.subtypes = set()", "metadata": "root._TokenType.__init__", "header": "['class', '_TokenType', '(', 'tuple', ')', ':', '___EOS___']", "index": 23 }, { "content": " def __contains__(self, val):\n return self is val or (\n type(val) is self.__class__ and\n val[:len(self)] == self\n )", "metadata": "root._TokenType.__contains__", "header": "['class', '_TokenType', '(', 'tuple', ')', ':', '___EOS___']", "index": 27 }, { "content": " def __getattr__(self, val):\n if not val or not val[0].isupper():\n return tuple.__getattribute__(self, val)\n new = _TokenType(self + (val,))\n setattr(self, val, new)\n self.subtypes.add(new)\n new.parent = self\n return new", "metadata": "root._TokenType.__getattr__", "header": "['class', '_TokenType', '(', 'tuple', ')', ':', '___EOS___']", "index": 33 }, { "content": " def __repr__(self):\n return 'Token' + (self and '.' or '') + '.'.join(self)", "metadata": "root._TokenType.__repr__", "header": "['class', '_TokenType', '(', 'tuple', ')', ':', '___EOS___']", "index": 42 } ]
[ { "span": "class _TokenType(tuple):", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 24 } ]
[ { "span": "self.subtypes ", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 21 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Token", "Type_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "None_", "\\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_", "\\u", "Token", "Type_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "split_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "node_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "buf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Token", "Type_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "need", " ", "to", " ", "call", " ", "super", ".\\u", "\\u", "init\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "subtypes", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Token", "Type_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "self_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "is_", "val_", "or_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "val_", ")_", "is_", "self_", "._", "\\u\\u", "class\\u\\u_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "[_", ":_", "len_", "(_", "self_", ")_", "]_", "==_", "self_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Token", "Type_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "val_", "or_", "not_", "val_", "[_", "0_", "]_", "._", "isupper", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tuple_", "._", "\\u\\u", "getattribute\\u\\u_", "(_", "self_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new_", "=_", "\\u", "Token", "Type_", "(_", "self_", "+_", "(_", "val_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "val_", ",_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subtypes", "_", "._", "add_", "(_", "new_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "._", "parent_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Token", "Type_", "(_", "tuple_", ")_", ":_", "\\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 ", " _", "return_", "'", "Token", "'_", "+_", "(_", "self_", "and_", "'.'_", "or_", "''_", ")_", "+_", "'.'_", "._", "join_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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, 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, 3, 1, 1, 1, 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, 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, 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 ]
Imprecise assert
openstack/swift/test/unit/common/middleware/test_keystoneauth.py
[ { "content": " def test_auth_scheme(self):\n req = self._make_request(path='/v1/BLAH_foo/c/o',\n headers={'X_IDENTITY_STATUS': 'Invalid'})\n resp = req.get_response(self.test_auth)\n self.assertEqual(resp.status_int, 401)\n self.assertTrue('Www-Authenticate' in resp.headers)", "metadata": "root.SwiftAuth.test_auth_scheme", "header": "['class', 'SwiftAuth', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 238 }, { "content": " def test_project_domain_id_sysmeta_set(self):\n proj_id = '12345678'\n proj_domain_id = '13'\n headers = get_identity_headers(tenant_id=proj_id,\n project_domain_id=proj_domain_id)\n account = get_account_for_tenant(self.test_auth, proj_id)\n path = '/v1/' + account\n # fake cached account info\n _, info_key = _get_cache_key(account, None)\n env = {info_key: {'status': 0, 'sysmeta': {}},\n 'keystone.token_info': _fake_token_info(version='3')}\n req = Request.blank(path, environ=env, headers=headers)\n req.method = 'POST'\n headers_out = {'X-Account-Sysmeta-Project-Domain-Id': proj_domain_id}\n fake_app = FakeApp(iter([('200 OK', headers_out, '')]))\n test_auth = keystoneauth.filter_factory({})(fake_app)\n resp = req.get_response(test_auth)\n self.assertEqual(resp.status_int, 200)\n self.assertEqual(len(fake_app.call_contexts), 1)\n headers_sent = fake_app.call_contexts[0]['headers']\n self.assertTrue('X-Account-Sysmeta-Project-Domain-Id' in headers_sent,\n headers_sent)\n self.assertEqual(headers_sent['X-Account-Sysmeta-Project-Domain-Id'],\n proj_domain_id)\n self.assertTrue('X-Account-Project-Domain-Id' in resp.headers)\n self.assertEqual(resp.headers['X-Account-Project-Domain-Id'],\n proj_domain_id)", "metadata": "root.SwiftAuth.test_project_domain_id_sysmeta_set", "header": "['class', 'SwiftAuth', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def _check_authenticate(self, account=None, identity=None, headers=None,\n exception=None, acl=None, env=None, path=None):\n if not identity:\n identity = self._get_identity()\n if not account:\n account = self._get_account(identity)\n if not path:\n path = '/v1/%s/c' % account\n # fake cached account info\n _, info_key = _get_cache_key(account, None)\n default_env = {'REMOTE_USER': identity['HTTP_X_TENANT_ID'],\n info_key: {'status': 200, 'sysmeta': {}}}\n default_env.update(identity)\n if env:\n default_env.update(env)\n req = self._make_request(path, headers=headers, environ=default_env)\n req.acl = acl\n\n env_identity = self.test_auth._keystone_identity(req.environ)\n result = self.test_auth.authorize(env_identity, req)\n\n # if we have requested an exception but nothing came back then\n if exception and not result:\n self.fail(\"error %s was not returned\" % (str(exception)))\n elif exception:\n self.assertEqual(result.status_int, exception)\n else:\n self.assertTrue(result is None)\n return req", "metadata": "root.TestAuthorize._check_authenticate", "header": "['class', 'TestAuthorize', '(', 'BaseTestAuthorize', ')', ':', '___EOS___']", "index": 588 }, { "content": " def _assert_set_project_domain(self, expected, account, req_project_id,\n req_project_domain_id,\n sysmeta_project_domain_id,\n warning=False):\n hdr = 'X-Account-Sysmeta-Project-Domain-Id'\n\n # set up fake account info in req env\n status = 0 if sysmeta_project_domain_id is None else 200\n sysmeta = {}\n if sysmeta_project_domain_id:\n sysmeta['project-domain-id'] = sysmeta_project_domain_id\n info = {'status': status, 'sysmeta': sysmeta}\n _, info_key = _get_cache_key(account, None)\n env = {info_key: info}\n\n # create fake env identity\n env_id = self._get_env_id(tenant_id=req_project_id,\n project_domain_id=req_project_domain_id)\n\n # reset fake logger\n self.test_auth.logger = FakeLogger()\n num_warnings = 0\n\n # check account requests\n path = '/v1/%s' % account\n for method in ['PUT', 'POST']:\n req = Request.blank(path, environ=env)\n req.method = method\n path_parts = req.split_path(1, 4, True)\n self.test_auth._set_project_domain_id(req, path_parts, env_id)\n if warning:\n num_warnings += 1\n warnings = self.test_auth.logger.get_lines_for_level('warning')\n self.assertEqual(len(warnings), num_warnings)\n self.assertTrue(warnings[-1].startswith('Inconsistent proj'))\n if expected is not None:\n self.assertTrue(hdr in req.headers)\n self.assertEqual(req.headers[hdr], expected)\n else:\n self.assertFalse(hdr in req.headers, req.headers)\n\n for method in ['GET', 'HEAD', 'DELETE', 'OPTIONS']:\n req = Request.blank(path, environ=env)\n req.method = method\n self.test_auth._set_project_domain_id(req, path_parts, env_id)\n self.assertFalse(hdr in req.headers)\n\n # check container requests\n path = '/v1/%s/c' % account\n for method in ['PUT']:\n req = Request.blank(path, environ=env)\n req.method = method\n path_parts = req.split_path(1, 4, True)\n self.test_auth._set_project_domain_id(req, path_parts, env_id)\n if warning:\n num_warnings += 1\n warnings = self.test_auth.logger.get_lines_for_level('warning')\n self.assertEqual(len(warnings), num_warnings)\n self.assertTrue(warnings[-1].startswith('Inconsistent proj'))\n if expected is not None:\n self.assertTrue(hdr in req.headers)\n self.assertEqual(req.headers[hdr], expected)\n else:\n self.assertFalse(hdr in req.headers)\n\n for method in ['POST', 'GET', 'HEAD', 'DELETE', 'OPTIONS']:\n req = Request.blank(path, environ=env)\n req.method = method\n self.test_auth._set_project_domain_id(req, path_parts, env_id)\n self.assertFalse(hdr in req.headers)\n\n # never set for object requests\n path = '/v1/%s/c/o' % account\n for method in ['PUT', 'COPY', 'POST', 'GET', 'HEAD', 'DELETE',\n 'OPTIONS']:\n req = Request.blank(path, environ=env)\n req.method = method\n path_parts = req.split_path(1, 4, True)\n self.test_auth._set_project_domain_id(req, path_parts, env_id)\n self.assertFalse(hdr in req.headers)", "metadata": "root.TestSetProjectDomain._assert_set_project_domain", "header": "['class', 'TestSetProjectDomain', '(', 'BaseTestAuthorize', ')', ':', '___EOS___']", "index": 1204 } ]
[ { "span": "self.assertTrue('Www-Authenticate' in resp.headers)", "start_line": 243, "start_column": 8, "end_line": 243, "end_column": 59 }, { "span": "self.assertTrue('X-Account-Project-Domain-Id' in resp.headers)", "start_line": 269, "start_column": 8, "end_line": 269, "end_column": 70 }, { "span": "self.assertTrue(result is None)", "start_line": 615, "start_column": 12, "end_line": 615, "end_column": 43 }, { "span": "self.assertTrue(hdr in req.headers)", "start_line": 1240, "start_column": 16, "end_line": 1240, "end_column": 51 }, { "span": "self.assertFalse(hdr in req.headers)", "start_line": 1249, "start_column": 12, "end_line": 1249, "end_column": 48 }, { "span": "self.assertTrue(hdr in req.headers)", "start_line": 1264, "start_column": 16, "end_line": 1264, "end_column": 51 }, { "span": "self.assertFalse(hdr in req.headers)", "start_line": 1267, "start_column": 16, "end_line": 1267, "end_column": 52 }, { "span": "self.assertFalse(hdr in req.headers)", "start_line": 1273, "start_column": 12, "end_line": 1273, "end_column": 48 }, { "span": "self.assertFalse(hdr in req.headers)", "start_line": 1283, "start_column": 12, "end_line": 1283, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Swi", "ft", "Auth_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "auth", "\\u", "scheme_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "self_", "._", "\\u", "make", "\\u", "request_", "(_", "path_", "=_", "'/", "v1", "/", "BLA", "H", "\\u", "foo", "/", "c", "/", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "X", "\\u", "IDENTITY", "\\u", "STATUS", "'_", ":_", "'", "Inva", "lid", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "req_", "._", "get", "\\u", "response_", "(_", "self_", "._", "test\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "int_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Ww", "w", "-", "Auth", "entica", "te", "'_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Swi", "ft", "Auth_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "project", "\\u", "domain", "\\u", "id", "\\u", "sys", "meta", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proj", "\\u", "id_", "=_", "'", "12345678", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proj", "\\u", "domain", "\\u", "id_", "=_", "'", "13", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "get", "\\u", "identi", "ty", "\\u", "headers_", "(_", "tenan", "t", "\\u", "id_", "=_", "proj", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "domain", "\\u", "id_", "=_", "proj", "\\u", "domain", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account_", "=_", "get", "\\u", "account", "\\u", "for", "\\u", "tenant_", "(_", "self_", "._", "test\\u", "auth_", ",_", "proj", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'/", "v1", "/'_", "+_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fake", " ", "cache", "d", " ", "account", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "info", "\\u", "key_", "=_", "\\u", "get", "\\u", "cache", "\\u", "key_", "(_", "account_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "{_", "info", "\\u", "key_", ":_", "{_", "'", "status", "'_", ":_", "0_", ",_", "'", "sys", "meta", "'_", ":_", "{_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keystone", ".", "token", "\\u", "info", "'_", ":_", "\\u", "fake", "\\u", "token", "\\u", "info_", "(_", "version_", "=_", "'", "3", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "Request_", "._", "blank_", "(_", "path_", ",_", "environ_", "=_", "env_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "s", "\\u", "out_", "=_", "{_", "'", "X", "-", "Account", "-", "Sys", "meta", "-", "Project", "-", "Doma", "in", "-", "Id", "'_", ":_", "proj", "\\u", "domain", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "app_", "=_", "Fake", "App_", "(_", "iter_", "(_", "[_", "(_", "'", "200", " ", "OK", "'_", ",_", "header", "s", "\\u", "out_", ",_", "''_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "auth_", "=_", "keystone", "auth_", "._", "filter", "\\u", "factory_", "(_", "{_", "}_", ")_", "(_", "fake", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "req_", "._", "get", "\\u", "response_", "(_", "test\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "int_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "fake", "\\u", "app_", "._", "call", "\\u", "contexts_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "s", "\\u", "sent_", "=_", "fake", "\\u", "app_", "._", "call", "\\u", "contexts_", "[_", "0_", "]_", "[_", "'", "header", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "X", "-", "Account", "-", "Sys", "meta", "-", "Project", "-", "Doma", "in", "-", "Id", "'_", "in_", "header", "s", "\\u", "sent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header", "s", "\\u", "sent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "header", "s", "\\u", "sent_", "[_", "'", "X", "-", "Account", "-", "Sys", "meta", "-", "Project", "-", "Doma", "in", "-", "Id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proj", "\\u", "domain", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "X", "-", "Account", "-", "Project", "-", "Doma", "in", "-", "Id", "'_", "in_", "resp_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "headers_", "[_", "'", "X", "-", "Account", "-", "Project", "-", "Doma", "in", "-", "Id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proj", "\\u", "domain", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Authoriz", "e_", "(_", "Base", "Test", "Authoriz", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "check", "\\u", "authenticate_", "(_", "self_", ",_", "account_", "=_", "None_", ",_", "identity_", "=_", "None_", ",_", "headers_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exception_", "=_", "None_", ",_", "acl_", "=_", "None_", ",_", "env_", "=_", "None_", ",_", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "identity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "identity_", "=_", "self_", "._", "\\u", "get", "\\u", "identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "account_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "account_", "=_", "self_", "._", "\\u", "get", "\\u", "account_", "(_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "'/", "v1", "/", "%", "s", "/", "c", "'_", "%_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fake", " ", "cache", "d", " ", "account", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "info", "\\u", "key_", "=_", "\\u", "get", "\\u", "cache", "\\u", "key_", "(_", "account_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "env_", "=_", "{_", "'", "REMO", "TE", "\\u", "USER", "'_", ":_", "identity_", "[_", "'", "HTTP", "\\u", "X", "\\u", "TENANT", "\\u", "ID", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "key_", ":_", "{_", "'", "status", "'_", ":_", "200_", ",_", "'", "sys", "meta", "'_", ":_", "{_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "env_", "._", "update_", "(_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "env_", "._", "update_", "(_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "self_", "._", "\\u", "make", "\\u", "request_", "(_", "path_", ",_", "headers_", "=_", "headers_", ",_", "environ_", "=_", "default", "\\u", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "acl_", "=_", "acl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "identity_", "=_", "self_", "._", "test\\u", "auth_", "._", "\\u", "keystone", "\\u", "identity_", "(_", "req_", "._", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "test\\u", "auth_", "._", "authorize_", "(_", "env", "\\u", "identity_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "have", " ", "request", "ed", " ", "an", " ", "exception", " ", "but", " ", "not", "hing", " ", "came", " ", "back", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exception_", "and_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "error", " ", "%", "s", " ", "was", " ", "not", " ", "return", "ed", "\"_", "%_", "(_", "str_", "(_", "exception_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "status", "\\u", "int_", ",_", "exception_", ")_", "\\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_", "._", "assert", "True_", "(_", "result_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "req_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Set", "Project", "Domain_", "(_", "Base", "Test", "Authoriz", "e_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "assert", "\\u", "set\\u", "project", "\\u", "domain_", "(_", "self_", ",_", "expected_", ",_", "account_", ",_", "req", "\\u", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "req", "\\u", "project", "\\u", "domain", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "meta", "\\u", "project", "\\u", "domain", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "warning_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "'", "X", "-", "Account", "-", "Sys", "meta", "-", "Project", "-", "Doma", "in", "-", "Id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "up", " ", "fake", " ", "account", " ", "info", " ", "in", " ", "req", " ", "env_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "0_", "if_", "sys", "meta", "\\u", "project", "\\u", "domain", "\\u", "id_", "is_", "None_", "else_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys", "meta_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys", "meta", "\\u", "project", "\\u", "domain", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys", "meta_", "[_", "'", "project", "-", "domain", "-", "id", "'_", "]_", "=_", "sys", "meta", "\\u", "project", "\\u", "domain", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "=_", "{_", "'", "status", "'_", ":_", "status_", ",_", "'", "sys", "meta", "'_", ":_", "sys", "meta_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "info", "\\u", "key_", "=_", "\\u", "get", "\\u", "cache", "\\u", "key_", "(_", "account_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "{_", "info", "\\u", "key_", ":_", "info_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "fake", " ", "env", " ", "identity_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "id_", "=_", "self_", "._", "\\u", "get", "\\u", "env", "\\u", "id_", "(_", "tenan", "t", "\\u", "id_", "=_", "req", "\\u", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "domain", "\\u", "id_", "=_", "req", "\\u", "project", "\\u", "domain", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "fake", " ", "logger_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "test\\u", "auth_", "._", "logger_", "=_", "Fake", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "warnings_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "account", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "v1", "/", "%", "s", "'_", "%_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "[_", "'", "PU", "T", "'_", ",_", "'", "POST", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "Request_", "._", "blank_", "(_", "path_", ",_", "environ_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "parts_", "=_", "req_", "._", "split", "\\u", "path_", "(_", "1_", ",_", "4_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "auth_", "._", "\\u", "set\\u", "project", "\\u", "domain", "\\u", "id_", "(_", "req_", ",_", "path", "\\u", "parts_", ",_", "env", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "warning_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "warnings_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "=_", "self_", "._", "test\\u", "auth_", "._", "logger_", "._", "get", "\\u", "lines", "\\u", "for", "\\u", "level_", "(_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "warnings_", ")_", ",_", "num", "\\u", "warnings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "warnings_", "[_", "-_", "1_", "]_", "._", "startswith_", "(_", "'", "Inco", "nsis", "tent", " ", "proj", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "expected_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "hdr_", "in_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "headers_", "[_", "hdr_", "]_", ",_", "expected_", ")_", "\\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_", "._", "assert", "False_", "(_", "hdr_", "in_", "req_", "._", "headers_", ",_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "method_", "in_", "[_", "'", "GET", "'_", ",_", "'", "HEAD", "'_", ",_", "'", "DELET", "E", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "Request_", "._", "blank_", "(_", "path_", ",_", "environ_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "auth_", "._", "\\u", "set\\u", "project", "\\u", "domain", "\\u", "id_", "(_", "req_", ",_", "path", "\\u", "parts_", ",_", "env", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hdr_", "in_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "container", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "'/", "v1", "/", "%", "s", "/", "c", "'_", "%_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "[_", "'", "PU", "T", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "Request_", "._", "blank_", "(_", "path_", ",_", "environ_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "parts_", "=_", "req_", "._", "split", "\\u", "path_", "(_", "1_", ",_", "4_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "auth_", "._", "\\u", "set\\u", "project", "\\u", "domain", "\\u", "id_", "(_", "req_", ",_", "path", "\\u", "parts_", ",_", "env", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "warning_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "warnings_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "=_", "self_", "._", "test\\u", "auth_", "._", "logger_", "._", "get", "\\u", "lines", "\\u", "for", "\\u", "level_", "(_", "'", "warn", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "warnings_", ")_", ",_", "num", "\\u", "warnings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "warnings_", "[_", "-_", "1_", "]_", "._", "startswith_", "(_", "'", "Inco", "nsis", "tent", " ", "proj", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "expected_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "hdr_", "in_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "req_", "._", "headers_", "[_", "hdr_", "]_", ",_", "expected_", ")_", "\\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_", "._", "assert", "False_", "(_", "hdr_", "in_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "method_", "in_", "[_", "'", "POST", "'_", ",_", "'", "GET", "'_", ",_", "'", "HEAD", "'_", ",_", "'", "DELET", "E", "'_", ",_", "'", "OPTION", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "Request_", "._", "blank_", "(_", "path_", ",_", "environ_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "auth_", "._", "\\u", "set\\u", "project", "\\u", "domain", "\\u", "id_", "(_", "req_", ",_", "path", "\\u", "parts_", ",_", "env", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hdr_", "in_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "neve", "r", " ", "set", " ", "for", " ", "object", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "'/", "v1", "/", "%", "s", "/", "c", "/", "o", "'_", "%_", "account_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "[_", "'", "PU", "T", "'_", ",_", "'", "COPY", "'_", ",_", "'", "POST", "'_", ",_", "'", "GET", "'_", ",_", "'", "HEAD", "'_", ",_", "'", "DELET", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "OPTION", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "Request_", "._", "blank_", "(_", "path_", ",_", "environ_", "=_", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "parts_", "=_", "req_", "._", "split", "\\u", "path_", "(_", "1_", ",_", "4_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "test\\u", "auth_", "._", "\\u", "set\\u", "project", "\\u", "domain", "\\u", "id_", "(_", "req_", ",_", "path", "\\u", "parts_", ",_", "env", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hdr_", "in_", "req_", "._", "headers_", ")_", "\\u\\u\\uNEW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/django-compositepks/tests/runtests.py
[ { "content": " def runTest(self):\n from django.core.management.validation import get_validation_errors\n from django.db.models.loading import load_app\n from cStringIO import StringIO\n\n try:\n module = load_app(self.model_label)\n except Exception, e:\n self.fail('Unable to load invalid model module')\n\n # Make sure sys.stdout is not a tty so that we get errors without\n # coloring attached (makes matching the results easier). We restore\n # sys.stderr afterwards.\n orig_stdout = sys.stdout\n s = StringIO()\n sys.stdout = s\n count = get_validation_errors(s, module)\n sys.stdout = orig_stdout\n s.seek(0)\n error_log = s.read()\n actual = error_log.split('\\n')\n expected = module.model_errors.split('\\n')\n\n unexpected = [err for err in actual if err not in expected]\n missing = [err for err in expected if err not in actual]\n\n self.assert_(not unexpected, \"Unexpected Errors: \" + '\\n'.join(unexpected))\n self.assert_(not missing, \"Missing Errors: \" + '\\n'.join(missing))", "metadata": "root.InvalidModelTestCase.runTest", "header": "['class', 'InvalidModelTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": "def django_tests(verbosity, interactive, test_labels):\n from django.conf import settings\n\n old_installed_apps = settings.INSTALLED_APPS\n old_test_database_name = settings.TEST_DATABASE_NAME\n old_root_urlconf = getattr(settings, \"ROOT_URLCONF\", \"\")\n old_template_dirs = settings.TEMPLATE_DIRS\n old_use_i18n = settings.USE_I18N\n old_login_url = settings.LOGIN_URL\n old_language_code = settings.LANGUAGE_CODE\n old_middleware_classes = settings.MIDDLEWARE_CLASSES\n\n # Redirect some settings for the duration of these tests.\n settings.INSTALLED_APPS = ALWAYS_INSTALLED_APPS\n settings.ROOT_URLCONF = 'urls'\n settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), TEST_TEMPLATE_DIR),)\n settings.USE_I18N = True\n settings.LANGUAGE_CODE = 'en'\n settings.LOGIN_URL = '/accounts/login/'\n settings.MIDDLEWARE_CLASSES = (\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.middleware.common.CommonMiddleware',\n )\n settings.SITE_ID = 1\n\n # Load all the ALWAYS_INSTALLED_APPS.\n # (This import statement is intentionally delayed until after we\n # access settings because of the USE_I18N dependency.)\n from django.db.models.loading import get_apps, load_app\n get_apps()\n\n # Load all the test model apps.\n for model_dir, model_name in get_test_models():\n model_label = '.'.join([model_dir, model_name])\n try:\n # if the model was named on the command line, or\n # no models were named (i.e., run all), import\n # this model and add it to the list to test.\n if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):\n if verbosity >= 1:\n print \"Importing model %s\" % model_name\n mod = load_app(model_label)\n if mod:\n if model_label not in settings.INSTALLED_APPS:\n settings.INSTALLED_APPS.append(model_label)\n except Exception, e:\n sys.stderr.write(\"Error while importing %s:\" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))\n continue\n\n # Add tests for invalid models.\n extra_tests = []\n for model_dir, model_name in get_invalid_models():\n model_label = '.'.join([model_dir, model_name])\n if not test_labels or model_name in test_labels:\n extra_tests.append(InvalidModelTestCase(model_label))\n try:\n # Invalid models are not working apps, so we cannot pass them into\n # the test runner with the other test_labels\n test_labels.remove(model_name)\n except ValueError:\n pass\n\n # Run the test suite, including the extra validation tests.\n from django.test.simple import run_tests\n failures = run_tests(test_labels, verbosity=verbosity, interactive=interactive, extra_tests=extra_tests)\n if failures:\n sys.exit(failures)\n\n # Restore the old settings.\n settings.INSTALLED_APPS = old_installed_apps\n settings.ROOT_URLCONF = old_root_urlconf\n settings.TEMPLATE_DIRS = old_template_dirs\n settings.USE_I18N = old_use_i18n\n settings.LANGUAGE_CODE = old_language_code\n settings.LOGIN_URL = old_login_url\n settings.MIDDLEWARE_CLASSES = old_middleware_classes", "metadata": "root.django_tests", "header": "['module', '___EOS___']", "index": 87 } ]
[ { "span": "count ", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 13 }, { "span": "old_test_database_name ", "start_line": 91, "start_column": 4, "end_line": 91, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Inva", "lid", "Model", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "Test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "core_", "._", "management_", "._", "validation_", "import_", "get", "\\u", "validation", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "loading_", "import_", "load", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\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 ", " _", "module_", "=_", "load", "\\u", "app_", "(_", "self_", "._", "model", "\\u", "label_", ")_", "\\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 ", " _", "self_", "._", "fail_", "(_", "'", "Una", "ble", " ", "to", " ", "load", " ", "invalid", " ", "model", " ", "module", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "sys", ".", "stdout", " ", "is", " ", "not", " ", "a", " ", "tt", "y", " ", "so", " ", "tha", "t", " ", "we", " ", "get", " ", "error", "s", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "colori", "ng", " ", "attache", "d", " ", "(", "make", "s", " ", "matchi", "ng", " ", "the", " ", "results", " ", "easi", "er", ").", " ", "We", " ", "restore_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", ".", "std", "err", " ", "after", "ward", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "stdout_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "get", "\\u", "validation", "\\u", "errors_", "(_", "s_", ",_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "orig", "\\u", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "log_", "=_", "s_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "error", "\\u", "log_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "module_", "._", "model", "\\u", "errors_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unexpected", "_", "=_", "[_", "err_", "for_", "err_", "in_", "actual_", "if_", "err_", "not_", "in_", "expected_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missing_", "=_", "[_", "err_", "for_", "err_", "in_", "expected_", "if_", "err_", "not_", "in_", "actual_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "not_", "unexpected", "_", ",_", "\"", "Une", "xpe", "cte", "d", " ", "Error", "s", ":", " ", "\"_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "unexpected", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "not_", "missing_", ",_", "\"", "Missing", " ", "Error", "s", ":", " ", "\"_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "missing_", ")_", ")_", "\\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_", "django", "\\u", "tests_", "(_", "verbosity_", ",_", "interactive_", ",_", "test\\u", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "install", "ed", "\\u", "apps_", "=_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "test\\u", "databa", "se", "\\u", "name_", "=_", "settings_", "._", "TEST", "\\u", "DATA", "BASE", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "root", "\\u", "url", "conf_", "=_", "getattr_", "(_", "settings_", ",_", "\"", "ROO", "T", "\\u", "URL", "CONF", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "template", "\\u", "dirs_", "=_", "settings_", "._", "TEMPL", "ATE", "\\u", "DIRS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "use", "\\u", "i18n_", "=_", "settings_", "._", "USE", "\\u", "I1", "8", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "login", "\\u", "url_", "=_", "settings_", "._", "LOGIN", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "language", "\\u", "code_", "=_", "settings_", "._", "LANGUAGE", "\\u", "CODE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "middle", "ware", "\\u", "classes_", "=_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redirect", " ", "some", " ", "settings", " ", "for", " ", "the", " ", "duration", " ", "of", " ", "these", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", "=_", "ALWAYS", "\\u", "INSTALLE", "D", "\\u", "APPS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "ROO", "T", "\\u", "URLCONF_", "=_", "'", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "TEST", "\\u", "TEMPL", "ATE", "\\u", "DIR_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "USE", "\\u", "I1", "8", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "LANGUAGE", "\\u", "CODE_", "=_", "'", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "LOGIN", "\\u", "URL_", "=_", "'/", "account", "s", "/", "login", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "session", "s", ".", "middle", "ware", ".", "Sess", "ion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", ".", "middle", "ware", ".", "Auth", "entica", "tion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "middle", "ware", ".", "common", ".", "Common", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "SITE", "\\u", "ID_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "the", " ", "ALWAYS", "\\u", "INSTALLE", "D", "\\u", "APP", "S", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "Thi", "s", " ", "import", " ", "statem", "ent", " ", "is", " ", "intent", "ional", "ly", " ", "delayed", " ", "unti", "l", " ", "after", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "access", " ", "settings", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "USE", "\\u", "I1", "8", "N", " ", "dependen", "cy", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "loading_", "import_", "get", "\\u", "apps_", ",_", "load", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "apps_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "all", " ", "the", " ", "test", " ", "model", " ", "apps", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model", "\\u", "dir_", ",_", "model", "\\u", "name_", "in_", "get", "\\u", "test\\u", "models_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "label_", "=_", "'.'_", "._", "join_", "(_", "[_", "model", "\\u", "dir_", ",_", "model", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "model", " ", "was", " ", "named", " ", "on", " ", "the", " ", "command", " ", "line", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "model", "s", " ", "wer", "e", " ", "named", " ", "(", "i", ".", "e", ".,", " ", "run", " ", "all", "),", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "model", " ", "and", " ", "add", " ", "it", " ", "to", " ", "the", " ", "list", " ", "to", " ", "test", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "test\\u", "labels_", "or_", "model", "\\u", "name_", "in_", "set_", "(_", "[_", "label_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "for_", "label_", "in_", "test\\u", "labels_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbosity_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Import", "ing", " ", "model", " ", "%", "s", "\"_", "%_", "model", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod_", "=_", "load", "\\u", "app_", "(_", "model", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "model", "\\u", "label_", "not_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", "._", "append_", "(_", "model", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\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_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Error", " ", "whi", "le", " ", "import", "ing", " ", "%", "s", ":\"_", "%_", "model", "\\u", "name_", "+_", "''_", "._", "join_", "(_", "traceback_", "._", "format\\u", "exception_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "tests", " ", "for", " ", "invalid", " ", "model", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "\\u", "tests_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "\\u", "dir_", ",_", "model", "\\u", "name_", "in_", "get", "\\u", "invalid", "\\u", "models_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "label_", "=_", "'.'_", "._", "join_", "(_", "[_", "model", "\\u", "dir_", ",_", "model", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "test\\u", "labels_", "or_", "model", "\\u", "name_", "in_", "test\\u", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "\\u", "tests_", "._", "append_", "(_", "Inva", "lid", "Model", "Test", "Case_", "(_", "model", "\\u", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "model", "s", " ", "are", " ", "not", " ", "working", " ", "apps", ",", " ", "so", " ", "we", " ", "cann", "ot", " ", "pass", " ", "them", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "test", " ", "runn", "er", " ", "with", " ", "the", " ", "other", " ", "test\\u", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "labels_", "._", "remove_", "(_", "model", "\\u", "name_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "the", " ", "test", " ", "suit", "e", ",", " ", "inclu", "ding", " ", "the", " ", "extra", " ", "validation", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "simple_", "import_", "run", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failures_", "=_", "run", "\\u", "tests_", "(_", "test\\u", "labels_", ",_", "verbosity_", "=_", "verbosity_", ",_", "interactive_", "=_", "interactive_", ",_", "extra", "\\u", "tests_", "=_", "extra", "\\u", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "failures_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "failures_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "the", " ", "old", " ", "settings", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", "=_", "old", "\\u", "install", "ed", "\\u", "apps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "ROO", "T", "\\u", "URLCONF_", "=_", "old", "\\u", "root", "\\u", "url", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "old", "\\u", "template", "\\u", "dirs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "USE", "\\u", "I1", "8", "N_", "=_", "old", "\\u", "use", "\\u", "i18n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "LANGUAGE", "\\u", "CODE_", "=_", "old", "\\u", "language", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "LOGIN", "\\u", "URL_", "=_", "old", "\\u", "login", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "old", "\\u", "middle", "ware", "\\u", "classes_", "\\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, 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port matplotlib as mpl\nimport matplotlib.pyplot as plt\n\nimport pyfits\n\nimport exorings\nimport j1407\n\nfrom scipy.optimize import fmin\n#from scipy.ndimage import convolve\nfrom scipy.interpolate import UnivariateSpline\nfrom scipy.interpolate import interp1d\n\nfrom matplotlib.patches import PathPatch\n\nmpl.interactive(True)\n# set sensible imshow defaults\nmpl.rc('image', interpolation='nearest', origin='lower', cmap='gray')\nmpl.rc('axes.formatter', limits=(-7, 7))\n\nG = 6.6738480e-11 # m3 kg-1 s-2\nyr = 365.242189669 * 86400 # sec\nmsol = 1.98855e30 # kg\nrsol = 6.5500e8 # m\nmjup = 1.8986e27 # kg\nrjup = 6.9911e7 # m\nmearth = 5.97219e24 # kg\nmmoon = 7.3476e22 # kg\nau = 1.49597870700e11 # m\npc = 3.0856e16 # m\n\n# switch - implemented from http://code.activestate.com/recipes/410692/\n\n\n\n\n\n\n\n\n\n\n\nnn = 1\n\n\n\n################################################################################\n# BEGIN main program\n################################################################################\n\n(time, flux, flux_err) = j1407.j1407_photom_binned('j1407_bincc.dat', 54160.0, 54300.0)\n\n# range of days that ring statistics should be considered\nrings_tmin = 54220. - 30.\nrings_tmax = 54220. + 30.\n\nprint 'restricting statistics of KIC to HJD range %.1f to %.1f' % (rings_tmin, rings_tmax)\ngoodp_rings = (time > rings_tmin) * (time < rings_tmax)\ngood_rings_npoints = goodp_rings.size\nprint 'number of points for statistics of KIC is %d' % (good_rings_npoints)\n\n# get gradients\n(grad_time, grad_mag, grad_mag_norm) = j1407.j1407_gradients('j1407_gradients.txt')\n\n# parse input options\n\nfitsin = 'ring002.fits'\nfitsout = 'ring003.fits'\n\nread_in_ring_parameters = False\nread_in_disk_parameters = False\n\ntx = 54221.15\nvstar = -1\n\n\ntry:\n opts, args = getopt.getopt(sys.argv[1:], \"hd:r:o:t:s:\", \\\n [\"dfile=\", \"rfile=\", \"ofile=\", \"tx=\", \"vstar=\"])\nexcept getopt.GetoptError:\n print_help()\n sys.exit(2)\nfor opt, arg in opts:\n if opt == '-h':\n print_help()\n sys.exit()\n elif opt in (\"-d\", \"--dfile\"):\n fitsin_disk = arg\n read_in_disk_parameters = True\n elif opt in (\"-r\", \"--rfile\"):\n fitsin_ring = arg\n read_in_ring_parameters = True\n elif opt in (\"-o\", \"--ofile\"):\n fitsout = arg\n elif opt in (\"-t\", \"--tx\"):\n tx = np.array(float(arg))\n print 'tx = time of central eclipse forced to be = ', tx\n elif opt in (\"-s\", \"--vstar\"):\n vstar = np.array(float(arg))\nprint 'Output file is ', fitsout\n\n# read in or create the ring system tau and radii\n\nphi_deg = 165.2 # guess tilt disk in degrees\ni_deg = 72.1 # guess inclination in degrees\ndt = 54225 # guess at date of central eclipse (dr/dt)=0\ny = 3.81 # guess at impact parameter b (units of days)\n\nRstar = 1.13 # solar radii \\pm 0.14 van Werkhoven 14\nMstar = 0.9 # msol \\pm 0.1 van Werkhoven 14\nRstar = 0.99 # solar radii \\pm 0.11 Kenworthy 15a\nRstar = 0.93 # for the smallest possible radius from equatorial rotation Kenworthy 15a\nMb = 18.5 # secondary in Mjup\nPb = 5.5 # secondary period in Mjup\n\nt_ecl = 56. # length of eclipse in days\n\n# convert to an orbital velocity\na = Ptoa(Pb, Mstar, Mb)\nprint 'Primary mass = %5.2f msol' % Mstar\nprint 'Primary radius = %5.2f rsol' % Rstar\nprint 'Secondary mass = %5.2f mjup' % Mb\nprint 'Orbital radius = %5.2f AU' % a\nv = vcirc(Mstar, Mb, a)\n\nif vstar > 0:\n v = vstar\n print 'manual velocity of star is %.1f km.s-1' % v\n\nprint 'Orbital velocity = %5.2f km/s (use option -s to set new velocity)' % (v/1.e3)\n\ndstar = (Rstar * rsol * 2 / v) / 86400.\n\nprint 'Primary diameter = %5.2f days' % dstar\n\nif read_in_ring_parameters:\n print 'Reading in rings from %s' % fitsin_ring\n (resxx, taun_rings, rad_rings, xxxdstar) = exorings.read_ring_fits(fitsin_ring)\nelse:\n print \"Starting with new rings....\"\n rad_rings = np.array([59.0])\n taun_rings = np.array([0.0])\n rad_rings = np.append(rad_rings, (100.))\n taun_rings = np.append(taun_rings, (1000.))\n\nexorings.print_ring_tau(rad_rings, exorings.y_to_tau(taun_rings))\n\nif read_in_disk_parameters:\n print 'Reading in disk parameters from %s' % fitsin_disk\n (res, taun_ringsxx, rad_ringsxx, dstarxx) = exorings.read_ring_fits(fitsin_disk)\nelse:\n # run minimizer to find best guess values\n print 'No disk gradient parameters read in - refitting new ones....'\n res = fmin(costfunc, np.array([y, dt, i_deg, phi_deg]), maxiter=5000, \\\n args=(grad_time, grad_mag_norm, tx))\n\n# set up stellar disk\nkern = exorings.make_star_limbd(21, 0.8)\n\n# make the radius and projected gradient for the measured gradient points\n(ring_disk_fit, grad_disk_fit) = exorings.ring_grad_line(grad_time, res[0], res[1], res[2], res[3])\n# produce fine grained gradient and ring values\nsamp_t = np.arange(-100, 100, 0.001) + 54222.\n(samp_r, samp_g) = exorings.ring_grad_line(samp_t, res[0], res[1], res[2], res[3])\nhjd_minr = samp_t[np.argmin(samp_g)]\n\nhjd_to_ring = interp1d(samp_t, samp_r, kind='linear')\n\n(rstart, rend) = exorings.ring_mask_no_photometry(kern, dstar, time, res[0], res[1], res[2], res[3])\n\n### RESULTS of fitting routine\n\nprint ''\nprint 'Disk parameters fitting to gradients'\nprint '------------------------------------'\nprint ''\nprint ' impact parameter b = %8.2f days' % res[0]\nprint ' HJD min approach t_b = %8.2f days' % res[1]\nprint ' disk inclination i = %7.1f deg' % res[2]\nprint ' disk tilt phi = %7.1f deg' % res[3]\nprint ' HJD min gradient = %8.2f days' % hjd_minr\nprint ' rmin = %8.2f days' % np.min(samp_r)\n\n# http://en.wikipedia.org/wiki/Bayesian_information_criterion\n# n - number of points in data\n# k - number of free parameters\n# BIC = chisquared + k . ln(n) + C\n# C is a constant which does not change between candidate models but is\n# dependent on the data points\n\n# plot folded light curve\ntime0 = np.abs(time-hjd_minr)\ntime0_grad = np.abs(grad_time-hjd_minr)\n\n# flux_color and flux_col\n# hold the color of the points for ingress and egress\nflux_color = np.chararray((time.shape))\nflux_color[:] = 'b'\nflux_color[(time > hjd_minr)] = 'r'\n\n# probably a better pythonic way to do this, but this works.\nflux_col = ''\nfor b in flux_color.tolist():\n flux_col = str.join('', (flux_col, b))\n\n# h1.scatter(time0_grad,np.ones_like(time0_grad)*0.8)\n\nfig_fold = plt.figure(figsize=(16, 6))\n\nh1 = fig_fold.add_subplot(111)\nplot_folded_phot(fig_fold)\n\nstrip, dummy, g = exorings.ellipse_strip(rad_rings, exorings.y_to_tau(taun_rings), \\\n res[0], res[1], res[2], res[3], kern, dstar)\n\n# g[0] = time\n# g[1] = stellar convolved tau\n# g[2] = stellar tau no convolution\n# g[3] = gradient\ngt_abs = np.abs(g[0]-hjd_minr)\ng1 = g[1]\ngt_ingr = gt_abs[(g[0] <= hjd_minr)]\ngt_egr = gt_abs[(g[0] > hjd_minr)]\ng1_ingr = g1[(g[0] <= hjd_minr)]\ng1_egr = g1[(g[0] > hjd_minr)]\n\nh1.plot(np.abs(g[0]-hjd_minr), g[1])\nh1.plot(gt_ingr, g1_ingr, color='blue')\nh1.plot(gt_egr, g1_egr, color='red')\nh1.plot(np.abs(g[0]-hjd_minr), g[2], color='orange')\nh1.set_xlabel('Time from eclipse midpoint [days]')\nh1.set_ylabel('Transmission')\n\nprint \"Menu\"\nprint \"a - add a ring\"\nprint \"d - delete a ring boundary to the right\"\nprint \"o - run Amoeba optimizer\"\nprint \"v - display rings in vector format\"\nprint \"r - display rings in pixel format (slow)\"\nprint \"\"\nbadring = 1\n\n\ncid = fig_fold.canvas.mpl_connect('key_press_event', onclick)\nplt.show()\n\nraw_input('press return to finish')\nexorings.write_ring_fits(fitsout, res, taun_rings, rad_rings, dstar)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "Rstar ", "start_line": 264, "start_column": 0, "end_line": 264, "end_column": 5 }, { "span": "Rstar ", "start_line": 266, "start_column": 0, "end_line": 266, "end_column": 5 } ]
[ { "span": "Rstar ", "start_line": 267, "start_column": 0, "end_line": 267, "end_column": 5 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", ",_", "getopt_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "'/", "User", "s", "/", "ken", "worth", "y", "/", "Drop", "box", "/", "python", "\\u", "workbook", "s", "/", "lib", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "as_", "mpl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyfits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "exo", "rings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "j", "140", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "optimize_", "import_", "fmin", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "sci", "py", ".", "ndim", "age", " ", "import", " ", "convolve", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "interpolate_", "import_", "Uni", "varia", "te", "Spline", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "interpolate_", "import_", "interp1d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "matplotlib_", "._", "patches_", "import_", "Path", "Patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mpl_", "._", "interactive_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "sensi", "ble", " ", "ims", "how", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "mpl_", "._", "rc_", "(_", "'", "image", "'_", ",_", "interpolation_", "=_", "'", "near", "est", "'_", ",_", "origin_", "=_", "'", "lower", "'_", ",_", "cmap_", "=_", "'", "gray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mpl_", "._", "rc_", "(_", "'", "axes", ".", "formatter", "'_", ",_", "limits_", "=_", "(_", "-_", "7_", ",_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G_", "=_", "6.6", "738", "480", "e-1", "1_", "#", " ", "m3", " ", "kg", "-1", " ", "s", "-", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yr_", "=_", "365", ".2", "421", "896", "69_", "*_", "86400_", "#", " ", "sec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mso", "l_", "=_", "1.9", "885", "5e", "30_", "#", " ", "kg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rs", "ol_", "=_", "6.5", "500", "e8", "_", "#", " ", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mj", "up_", "=_", "1.8", "986", "e2", "7_", "#", " ", "kg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rj", "up_", "=_", "6.9", "911", "e7", "_", "#", " ", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mea", "rt", "h_", "=_", "5.9", "721", "9e", "24_", "#", " ", "kg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mmo", "on_", "=_", "7.3", "476", "e2", "2_", "#", " ", "kg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "au_", "=_", "1.4", "959", "787", "0700", "e1", "1_", "#", " ", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pc_", "=_", "3.0", "856", "e1", "6_", "#", " ", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "switch", " ", "-", " ", "implemented", " ", "from", " ", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/", "410", "692", "/_", "\\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\\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\\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_", "nn_", "=_", "1_", "\\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\\uNL\\u\\u\\u_", "#", " ", "BEGIN", " ", "main", " ", "program_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "time_", ",_", "flux_", ",_", "flux", "\\u", "err_", ")_", "=_", "j", "140", "7_", "._", "j", "140", "7", "\\u", "photom", "\\u", "binned", "_", "(_", "'", "j", "140", "7", "\\u", "binc", "c", ".", "dat", "'_", ",_", "541", "60.0_", ",_", "543", "00", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "range", " ", "of", " ", "day", "s", " ", "tha", "t", " ", "ring", " ", "statistic", "s", " ", "shou", "ld", " ", "be", " ", "consider", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "rings", "\\u", "tmin_", "=_", "542", "20._", "-_", "30.", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rings", "\\u", "tmax_", "=_", "542", "20._", "+_", "30.", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "restrict", "ing", " ", "statistic", "s", " ", "of", " ", "KI", "C", " ", "to", " ", "HJ", "D", " ", "range", " ", "%", ".1", "f", " ", "to", " ", "%", ".1", "f", "'_", "%_", "(_", "rings", "\\u", "tmin_", ",_", "rings", "\\u", "tmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "p", "\\u", "rings_", "=_", "(_", "time_", ">_", "rings", "\\u", "tmin_", ")_", "*_", "(_", "time_", "<_", "rings", "\\u", "tmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "rings", "\\u", "npoints_", "=_", "good", "p", "\\u", "rings_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "number", " ", "of", " ", "points", " ", "for", " ", "statistic", "s", " ", "of", " ", "KI", "C", " ", "is", " ", "%", "d", "'_", "%_", "(_", "good", "\\u", "rings", "\\u", "npoints_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "gradients_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "grad", "\\u", "time_", ",_", "grad", "\\u", "mag_", ",_", "grad", "\\u", "mag", "\\u", "norm_", ")_", "=_", "j", "140", "7_", "._", "j", "140", "7", "\\u", "gradients_", "(_", "'", "j", "140", "7", "\\u", "gradi", "ents", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "input", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fits", "in_", "=_", "'", "ring", "002", ".", "fits", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fits", "out_", "=_", "'", "ring", "003", ".", "fits", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "in", "\\u", "ring", "\\u", "parameters_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "in", "\\u", "disk", "\\u", "parameters_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", "=_", "542", "21.", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vst", "ar_", "=_", "-_", "1_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "\"", "hd", ":", "r", ":", "o", ":", "t", ":", "s", ":\"_", ",_", "[_", "\"", "dfile", "=\"_", ",_", "\"", "rfil", "e", "=\"_", ",_", "\"", "ofi", "le", "=\"_", ",_", "\"", "tx", "=\"_", ",_", "\"", "vst", "ar", "=\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "opt_", ",_", "arg_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "in_", "(_", "\"-", "d", "\"_", ",_", "\"--", "dfile", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fits", "in", "\\u", "disk_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "in", "\\u", "disk", "\\u", "parameters_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "in_", "(_", "\"-", "r", "\"_", ",_", "\"--", "rfil", "e", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fits", "in", "\\u", "ring_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "in", "\\u", "ring", "\\u", "parameters_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "in_", "(_", "\"-", "o", "\"_", ",_", "\"--", "ofi", "le", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fits", "out_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "in_", "(_", "\"-", "t", "\"_", ",_", "\"--", "tx", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx_", "=_", "np_", "._", "array_", "(_", "float_", "(_", "arg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "tx", " ", "=", " ", "time", " ", "of", " ", "central", " ", "eclipse", " ", "forced", " ", "to", " ", "be", " ", "=", " ", "'_", ",_", "tx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "in_", "(_", "\"-", "s", "\"_", ",_", "\"--", "vst", "ar", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vst", "ar_", "=_", "np_", "._", "array_", "(_", "float_", "(_", "arg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Output", " ", "file", " ", "is", " ", "'_", ",_", "fits", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "in", " ", "or", " ", "create", " ", "the", " ", "ring", " ", "system", " ", "tau", " ", "and", " ", "radii_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phi", "\\u", "deg_", "=_", "165", ".2_", "#", " ", "guess", " ", "tilt", " ", "disk", " ", "in", " ", "degrees_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "deg_", "=_", "72.", "1_", "#", " ", "guess", " ", "incl", "ination", " ", "in", " ", "degrees_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "542", "25_", "#", " ", "guess", " ", "at", " ", "date", " ", "of", " ", "central", " ", "eclipse", " ", "(", "dr", "/", "dt", ")=", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "3.8", "1_", "#", " ", "guess", " ", "at", " ", "impact", " ", "parameter", " ", "b", " ", "(", "unit", "s", " ", "of", " ", "day", "s", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Rs", "tar_", "=_", "1.1", "3_", "#", " ", "solar", " ", "radi", "i", " ", "\\\\", "pm", " ", "0.14", " ", "van", " ", "Wer", "kh", "ove", "n", " ", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ms", "tar_", "=_", "0.9_", "#", " ", "mso", "l", " ", "\\\\", "pm", " ", "0.", "1", " ", "van", " ", "Wer", "kh", "ove", "n", " ", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Rs", "tar_", "=_", "0.99_", "#", " ", "solar", " ", "radi", "i", " ", "\\\\", "pm", " ", "0.11", " ", "Ken", "worth", "y", " ", "15", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Rs", "tar_", "=_", "0.93", "_", "#", " ", "for", " ", "the", " ", "smallest", " ", "possib", "le", " ", "radi", "us", " ", "from", " ", "equa", "tori", "al", " ", "rotati", "on", " ", "Ken", "worth", "y", " ", "15", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mb", "_", "=_", "18.", "5_", "#", " ", "second", "ary", " ", "in", " ", "Mj", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pb", "_", "=_", "5.5_", "#", " ", "second", "ary", " ", "period", " ", "in", " ", "Mj", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "\\u", "ecl", "_", "=_", "56.", "_", "#", " ", "length", " ", "of", " ", "eclipse", " ", "in", " ", "days_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "to", " ", "an", " ", "orbital", " ", "velocity_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "Pt", "oa", "_", "(_", "Pb", "_", ",_", "Ms", "tar_", ",_", "Mb", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Prim", "ary", " ", "mass", " ", "=", " ", "%", "5.2", "f", " ", " ", "mso", "l", "'_", "%_", "Ms", "tar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Prim", "ary", " ", "radi", "us", " ", " ", " ", "=", " ", "%", "5.2", "f", " ", " ", "rs", "ol", "'_", "%_", "Rs", "tar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Second", "ary", " ", "mass", " ", " ", " ", "=", " ", "%", "5.2", "f", " ", " ", "mj", "up", "'_", "%_", "Mb", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Orbit", "al", " ", "radi", "us", " ", " ", " ", "=", " ", "%", "5.2", "f", " ", " ", "AU", "'_", "%_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "vc", "irc_", "(_", "Ms", "tar_", ",_", "Mb", "_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "vst", "ar_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "vst", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "manu", "al", " ", "velo", "city", " ", "of", " ", "star", " ", "is", " ", "%", ".1", "f", " ", "km", ".", "s", "-1", "'_", "%_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Orbit", "al", " ", "velo", "city", " ", "=", " ", "%", "5.2", "f", " ", " ", "km", "/", "s", " ", "(", "use", " ", "option", " ", "-", "s", " ", "to", " ", "set", " ", "new", " ", "velo", "city", ")'_", "%_", "(_", "v_", "/_", "1.e", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dsta", "r_", "=_", "(_", "Rs", "tar_", "*_", "rs", "ol_", "*_", "2_", "/_", "v_", ")_", "/_", "8640", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Prim", "ary", " ", "diam", "eter", " ", "=", " ", "%", "5.2", "f", " ", " ", "day", "s", "'_", "%_", "dsta", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "read", "\\u", "in", "\\u", "ring", "\\u", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Reading", " ", "in", " ", "rings", " ", "from", " ", "%", "s", "'_", "%_", "fits", "in", "\\u", "ring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "res", "xx_", ",_", "tau", "n", "\\u", "rings_", ",_", "rad", "\\u", "rings_", ",_", "xxx", "dsta", "r_", ")_", "=_", "exo", "rings_", "._", "read", "\\u", "ring", "\\u", "fits_", "(_", "fits", "in", "\\u", "ring_", ")_", "\\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 ", " _", "print_", "\"", "Start", "ing", " ", "with", " ", "new", " ", "rings", "....", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rad", "\\u", "rings_", "=_", "np_", "._", "array_", "(_", "[_", "59.", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tau", "n", "\\u", "rings_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rad", "\\u", "rings_", "=_", "np_", "._", "append_", "(_", "rad", "\\u", "rings_", ",_", "(_", "100._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tau", "n", "\\u", "rings_", "=_", "np_", "._", "append_", "(_", "tau", "n", "\\u", "rings_", ",_", "(_", "1000._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exo", "rings_", "._", "print", "\\u", "ring", "\\u", "tau_", "(_", "rad", "\\u", "rings_", ",_", "exo", "rings_", "._", "y", "\\u", "to", "\\u", "tau_", "(_", "tau", "n", "\\u", "rings_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "read", "\\u", "in", "\\u", "disk", "\\u", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Reading", " ", "in", " ", "disk", " ", "parameter", "s", " ", "from", " ", "%", "s", "'_", "%_", "fits", "in", "\\u", "disk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "res_", ",_", "tau", "n", "\\u", "rings", "xx_", ",_", "rad", "\\u", "rings", "xx_", ",_", "dsta", "rx", "x_", ")_", "=_", "exo", "rings_", "._", "read", "\\u", "ring", "\\u", "fits_", "(_", "fits", "in", "\\u", "disk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "run", " ", "minimize", "r", " ", "to", " ", "find", " ", "best", " ", "guess", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "No", " ", "disk", " ", "gradi", "ent", " ", "parameter", "s", " ", "read", " ", "in", " ", "-", " ", "refi", "tting", " ", "new", " ", "ones", "....", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "fmin", "_", "(_", "cost", "func_", ",_", "np_", "._", "array_", "(_", "[_", "y_", ",_", "dt_", ",_", "i", "\\u", "deg_", ",_", "phi", "\\u", "deg_", "]_", ")_", ",_", "maxiter_", "=_", "5000_", ",_", "args_", "=_", "(_", "grad", "\\u", "time_", ",_", "grad", "\\u", "mag", "\\u", "norm_", ",_", "tx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "up", " ", "stellar", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kern", "_", "=_", "exo", "rings_", "._", "make", "\\u", "star", "\\u", "limb", "d_", "(_", "21_", ",_", "0.8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "radi", "us", " ", "and", " ", "projected", " ", "gradi", "ent", " ", "for", " ", "the", " ", "measure", "d", " ", "gradi", "ent", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ring", "\\u", "disk", "\\u", "fit_", ",_", "grad", "\\u", "disk", "\\u", "fit_", ")_", "=_", "exo", "rings_", "._", "ring", "\\u", "grad", "\\u", "line_", "(_", "grad", "\\u", "time_", ",_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "2_", "]_", ",_", "res_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "produce", " ", "fine", " ", "grain", "ed", " ", "gradi", "ent", " ", "and", " ", "ring", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "samp", "\\u", "t_", "=_", "np_", "._", "arange_", "(_", "-_", "100_", ",_", "100_", ",_", "0.001_", ")_", "+_", "542", "22.", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "samp", "\\u", "r_", ",_", "samp", "\\u", "g_", ")_", "=_", "exo", "rings_", "._", "ring", "\\u", "grad", "\\u", "line_", "(_", "samp", "\\u", "t_", ",_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "2_", "]_", ",_", "res_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hj", "d\\u", "min", "r_", "=_", "samp", "\\u", "t_", "[_", "np_", "._", "argmin_", "(_", "samp", "\\u", "g_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hj", "d\\u", "to", "\\u", "ring_", "=_", "interp1d_", "(_", "samp", "\\u", "t_", ",_", "samp", "\\u", "r_", ",_", "kind_", "=_", "'", "linear", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rsta", "rt_", ",_", "rend", "_", ")_", "=_", "exo", "rings_", "._", "ring", "\\u", "mask", "\\u", "no", "\\u", "photom", "etry", "_", "(_", "kern", "_", ",_", "dsta", "r_", ",_", "time_", ",_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "2_", "]_", ",_", "res_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "RESULTS", " ", "of", " ", "fitting", " ", "routine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Disk", " ", "parameter", "s", " ", "fitting", " ", "to", " ", "gradi", "ents", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-------", "--------------", "--------------", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "impact", " ", "parameter", " ", "b", " ", " ", " ", "=", " ", "%", "8.2", "f", " ", "day", "s", "'_", "%_", "res_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "HJ", "D", " ", "min", " ", "appro", "ach", " ", "t", "\\u", "b", " ", "=", " ", "%", "8.2", "f", " ", "day", "s", "'_", "%_", "res_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "disk", " ", "incl", "ination", " ", "i", " ", " ", " ", "=", " ", "%", "7.1", "f", " ", " ", "deg", "'_", "%_", "res_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", " ", " ", " ", "disk", " ", "tilt", " ", "phi", " ", "=", " ", "%", "7.1", "f", " ", " ", "deg", "'_", "%_", "res_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "HJ", "D", " ", "min", " ", "gradi", "ent", " ", "=", " ", "%", "8.2", "f", " ", "day", "s", "'_", "%_", "hj", "d\\u", "min", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", " ", " ", " ", " ", "rmin", " ", "=", " ", "%", "8.2", "f", " ", "day", "s", "'_", "%_", "np_", "._", "min_", "(_", "samp", "\\u", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Bayes", "ian", "\\u", "informati", "on", "\\u", "criterion_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "n", " ", "-", " ", "number", " ", "of", " ", "points", " ", "in", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "k", " ", "-", " ", "number", " ", "of", " ", "free", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BIC", " ", "=", " ", "chisq", "uar", "ed", " ", "+", " ", "k", " ", ".", " ", "ln", "(", "n", ")", " ", "+", " ", "C_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "C", " ", "is", " ", "a", " ", "constant", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "change", " ", "bet", "ween", " ", "candidate", " ", "model", "s", " ", "but", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependent", " ", "on", " ", "the", " ", "data", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plot", " ", "fold", "ed", " ", "light", " ", "curve_", "\\u\\u\\uNL\\u\\u\\u_", "time", "0_", "=_", "np_", "._", "abs_", "(_", "time_", "-_", "hj", "d\\u", "min", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "0", "\\u", "grad_", "=_", "np_", "._", "abs_", "(_", "grad", "\\u", "time_", "-_", "hj", "d\\u", "min", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flux", "\\u", "color", " ", "and", " ", "flux", "\\u", "col_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hold", " ", "the", " ", "color", " ", "of", " ", "the", " ", "points", " ", "for", " ", "ingress", " ", "and", " ", "egress", "_", "\\u\\u\\uNL\\u\\u\\u_", "flux", "\\u", "color_", "=_", "np_", "._", "chara", "rray_", "(_", "(_", "time_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux", "\\u", "color_", "[_", ":_", "]_", "=_", "'", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux", "\\u", "color_", "[_", "(_", "time_", ">_", "hj", "d\\u", "min", "r_", ")_", "]_", "=_", "'", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "probab", "ly", " ", "a", " ", "bett", "er", " ", "python", "ic", " ", "way", " ", "to", " ", "do", " ", "this", ",", " ", "but", " ", "this", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "flux", "\\u", "col_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "b_", "in_", "flux", "\\u", "color_", "._", "tolist_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux", "\\u", "col_", "=_", "str_", "._", "join_", "(_", "''_", ",_", "(_", "flux", "\\u", "col_", ",_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h1", ".", "scatter", "(", "time", "0", "\\u", "grad", ",", "np", ".", "ones", "\\u", "like", "(", "time", "0", "\\u", "grad", ")*", "0.", "8", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig", "\\u", "fold_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "16_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h1_", "=_", "fig", "\\u", "fold_", "._", "add", "\\u", "subplot_", "(_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "fold", "ed", "\\u", "phot", "_", "(_", "fig", "\\u", "fold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", ",_", "dummy_", ",_", "g_", "=_", "exo", "rings_", "._", "ellips", "e\\u", "strip_", "(_", "rad", "\\u", "rings_", ",_", "exo", "rings_", "._", "y", "\\u", "to", "\\u", "tau_", "(_", "tau", "n", "\\u", "rings_", ")_", ",_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "2_", "]_", ",_", "res_", "[_", "3_", "]_", ",_", "kern", "_", ",_", "dsta", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "[", "0", "]", " ", "=", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "[", "1", "]", " ", "=", " ", "stellar", " ", "convolve", "d", " ", "tau_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "[", "2", "]", " ", "=", " ", "stellar", " ", "tau", " ", "no", " ", "convolution", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "g", "[", "3", "]", " ", "=", " ", "gradient_", "\\u\\u\\uNL\\u\\u\\u_", "gt", "\\u", "abs_", "=_", "np_", "._", "abs_", "(_", "g_", "[_", "0_", "]_", "-_", "hj", "d\\u", "min", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1_", "=_", "g_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gt", "\\u", "ingr", "_", "=_", "gt", "\\u", "abs_", "[_", "(_", "g_", "[_", "0_", "]_", "<=_", "hj", "d\\u", "min", "r_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gt", "\\u", "egr", "_", "=_", "gt", "\\u", "abs_", "[_", "(_", "g_", "[_", "0_", "]_", ">_", "hj", "d\\u", "min", "r_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1", "\\u", "ingr", "_", "=_", "g1_", "[_", "(_", "g_", "[_", "0_", "]_", "<=_", "hj", "d\\u", "min", "r_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g1", "\\u", "egr", "_", "=_", "g1_", "[_", "(_", "g_", "[_", "0_", "]_", ">_", "hj", "d\\u", "min", "r_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h1_", "._", "plot_", "(_", "np_", "._", "abs_", "(_", "g_", "[_", "0_", "]_", "-_", "hj", "d\\u", "min", "r_", ")_", ",_", "g_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "._", "plot_", "(_", "gt", "\\u", "ingr", "_", ",_", "g1", "\\u", "ingr", "_", ",_", "color_", "=_", "'", "blue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "._", "plot_", "(_", "gt", "\\u", "egr", "_", ",_", "g1", "\\u", "egr", "_", ",_", "color_", "=_", "'", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "._", "plot_", "(_", "np_", "._", "abs_", "(_", "g_", "[_", "0_", "]_", "-_", "hj", "d\\u", "min", "r_", ")_", ",_", "g_", "[_", "2_", "]_", ",_", "color_", "=_", "'", "orange", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "._", "set\\u", "xlabel_", "(_", "'", "Time", " ", "from", " ", "eclipse", " ", "midpoint", " ", "[", "day", "s", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h1_", "._", "set\\u", "ylabel_", "(_", "'", "Trans", "missio", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Menu", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "a", " ", "-", " ", "add", " ", "a", " ", "ring", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "d", " ", "-", " ", "delete", " ", "a", " ", "ring", " ", "bound", "ary", " ", "to", " ", "the", " ", "right", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "o", " ", "-", " ", "run", " ", "Amo", "eba", " ", "optimize", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "v", " ", "-", " ", "display", " ", "rings", " ", "in", " ", "vector", " ", "format", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "r", " ", "-", " ", "display", " ", "rings", " ", "in", " ", "pixel", " ", "format", " ", "(", "slow", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "ring_", "=_", "1_", "\\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_", "cid_", "=_", "fig", "\\u", "fold_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "'", "key", "\\u", "press", "\\u", "event", "'_", ",_", "onc", "lick", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raw", "\\u", "input_", "(_", "'", "press", " ", "return", " ", "to", " ", "finish", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "rings_", "._", "write", "\\u", "ring", "\\u", "fits_", "(_", "fits", "out_", ",_", "res_", ",_", "tau", "n", "\\u", "rings_", ",_", "rad", "\\u", "rings_", ",_", "dsta", "r_", ")_" ]
[ 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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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 ]
Unused local variable
statsmodels/statsmodels/statsmodels/duration/hazard_regression.py
[ { "content": " def breslow_gradient(self, params):\n \"\"\"\n Returns the gradient of the log partial likelihood, using the\n Breslow method to handle tied times.\n \"\"\"\n\n surv = self.surv\n\n grad = 0.\n\n # Loop over strata\n for stx in range(surv.nstrat):\n\n # Indices of subjects in the stratum\n strat_ix = surv.stratum_rows[stx]\n\n # Unique failure times in the stratum\n uft_ix = surv.ufailt_ix[stx]\n nuft = len(uft_ix)\n\n # exog and linear predictor for the stratum\n exog_s = surv.exog_s[stx]\n linpred = np.dot(exog_s, params)\n if surv.offset_s is not None:\n linpred += surv.offset_s[stx]\n linpred -= linpred.max()\n e_linpred = np.exp(linpred)\n\n xp0, xp1 = 0., 0.\n\n # Iterate backward through the unique failure times.\n for i in range(nuft)[::-1]:\n\n # Update for new cases entering the risk set.\n ix = surv.risk_enter[stx][i]\n if len(ix) > 0:\n v = exog_s[ix,:]\n xp0 += e_linpred[ix].sum()\n xp1 += (e_linpred[ix][:,None] * v).sum(0)\n\n # Account for all cases that fail at this point.\n ix = uft_ix[i]\n grad += (exog_s[ix,:] - xp1 / xp0).sum(0)\n\n # Update for cases leaving the risk set.\n ix = surv.risk_exit[stx][i]\n if len(ix) > 0:\n v = exog_s[ix,:]\n xp0 -= e_linpred[ix].sum()\n xp1 -= (e_linpred[ix][:,None] * v).sum(0)\n\n return grad", "metadata": "root.PHReg.breslow_gradient", "header": "['class', 'PHReg', '(', 'model', '.', 'LikelihoodModel', ')', ':', '___EOS___']", "index": 734 }, { "content": " def efron_gradient(self, params):\n \"\"\"\n Returns the gradient of the log partial likelihood evaluated\n at `params`, using the Efron method to handle tied times.\n \"\"\"\n\n surv = self.surv\n\n grad = 0.\n\n # Loop over strata\n for stx in range(surv.nstrat):\n\n # Indices of cases in the stratum\n strat_ix = surv.stratum_rows[stx]\n\n # exog and linear predictor of the stratum\n exog_s = surv.exog_s[stx]\n linpred = np.dot(exog_s, params)\n if surv.offset_s is not None:\n linpred += surv.offset_s[stx]\n linpred -= linpred.max()\n e_linpred = np.exp(linpred)\n\n xp0, xp1 = 0., 0.\n\n # Iterate backward through the unique failure times.\n uft_ix = surv.ufailt_ix[stx]\n nuft = len(uft_ix)\n for i in range(nuft)[::-1]:\n\n # Update for new cases entering the risk set.\n ix = surv.risk_enter[stx][i]\n if len(ix) > 0:\n v = exog_s[ix,:]\n xp0 += e_linpred[ix].sum()\n xp1 += (e_linpred[ix][:,None] * v).sum(0)\n ixf = uft_ix[i]\n if len(ixf) > 0:\n v = exog_s[ixf,:]\n xp0f = e_linpred[ixf].sum()\n xp1f = (e_linpred[ixf][:,None] * v).sum(0)\n\n # Consider all cases that fail at this point.\n grad += v.sum(0)\n\n m = len(ixf)\n J = np.arange(m, dtype=np.float64) / m\n numer = xp1 - np.outer(J, xp1f)\n denom = xp0 - np.outer(J, xp0f)\n ratio = numer / denom\n rsum = ratio.sum(0)\n grad -= rsum\n\n # Update for cases leaving the risk set.\n ix = surv.risk_exit[stx][i]\n if len(ix) > 0:\n v = exog_s[ix,:]\n xp0 -= e_linpred[ix].sum()\n xp1 -= (e_linpred[ix][:,None] * v).sum(0)\n\n return grad", "metadata": "root.PHReg.efron_gradient", "header": "['class', 'PHReg', '(', 'model', '.', 'LikelihoodModel', ')', ':', '___EOS___']", "index": 787 } ]
[ { "span": "strat_ix ", "start_line": 748, "start_column": 12, "end_line": 748, "end_column": 20 }, { "span": "strat_ix ", "start_line": 801, "start_column": 12, "end_line": 801, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "PH", "Reg_", "(_", "model_", "._", "Likelihood", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bre", "slow", "\\u", "gradient_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "gradi", "ent", " ", "of", " ", "the", " ", "log", " ", "partial", " ", "likelihood", ",", " ", "usi", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Bre", "slow", " ", "method", " ", "to", " ", "handle", " ", "tied", " ", "times", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sur", "v_", "=_", "self_", "._", "sur", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "strat", "a_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "st", "x_", "in_", "range_", "(_", "sur", "v_", "._", "nstr", "at_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Indic", "es", " ", "of", " ", "subject", "s", " ", "in", " ", "the", " ", "strat", "um_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strat", "\\u", "ix_", "=_", "sur", "v_", "._", "strat", "um", "\\u", "rows_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unique", " ", "fail", "ure", " ", "times", " ", "in", " ", "the", " ", "strat", "um_", "\\u\\u\\uNL\\u\\u\\u_", "uf", "t", "\\u", "ix_", "=_", "sur", "v_", "._", "uf", "ail", "t", "\\u", "ix_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "ft_", "=_", "len_", "(_", "uf", "t", "\\u", "ix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exo", "g", " ", "and", " ", "linear", " ", "predictor", " ", "for", " ", "the", " ", "strat", "um_", "\\u\\u\\uNL\\u\\u\\u_", "exo", "g", "\\u", "s_", "=_", "sur", "v_", "._", "exo", "g", "\\u", "s_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lin", "pred_", "=_", "np_", "._", "dot_", "(_", "exo", "g", "\\u", "s_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sur", "v_", "._", "offset", "\\u", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lin", "pred_", "+=_", "sur", "v_", "._", "offset", "\\u", "s_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lin", "pred_", "-=_", "lin", "pred_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "lin", "pred_", "=_", "np_", "._", "exp_", "(_", "lin", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xp", "0_", ",_", "xp", "1_", "=_", "0._", ",_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "back", "ward", " ", "through", " ", "the", " ", "unique", " ", "fail", "ure", " ", "times", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nu", "ft_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "for", " ", "new", " ", "case", "s", " ", "entering", " ", "the", " ", "risk", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix_", "=_", "sur", "v_", "._", "risk", "\\u", "enter_", "[_", "st", "x_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ix_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "exo", "g", "\\u", "s_", "[_", "ix_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "0_", "+=_", "e\\u", "lin", "pred_", "[_", "ix_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "1_", "+=_", "(_", "e\\u", "lin", "pred_", "[_", "ix_", "]_", "[_", ":_", ",_", "None_", "]_", "*_", "v_", ")_", "._", "sum_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Account", " ", "for", " ", "all", " ", "case", "s", " ", "tha", "t", " ", "fail", " ", "at", " ", "this", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ix_", "=_", "uf", "t", "\\u", "ix_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grad_", "+=_", "(_", "exo", "g", "\\u", "s_", "[_", "ix_", ",_", ":_", "]_", "-_", "xp", "1_", "/_", "xp", "0_", ")_", "._", "sum_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "for", " ", "case", "s", " ", "leaving", " ", "the", " ", "risk", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "ix_", "=_", "sur", "v_", "._", "risk", "\\u", "exit_", "[_", "st", "x_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ix_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "exo", "g", "\\u", "s_", "[_", "ix_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "0_", "-=_", "e\\u", "lin", "pred_", "[_", "ix_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "1_", "-=_", "(_", "e\\u", "lin", "pred_", "[_", "ix_", "]_", "[_", ":_", ",_", "None_", "]_", "*_", "v_", ")_", "._", "sum_", "(_", "0_", ")_", "\\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_", "return_", "grad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PH", "Reg_", "(_", "model_", "._", "Likelihood", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ef", "ron", "\\u", "gradient_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "gradi", "ent", " ", "of", " ", "the", " ", "log", " ", "partial", " ", "likelihood", " ", "evaluate", "d", "\\", "10", ";", " ", " ", " ", " ", "at", " ", "`", "params", "`", ",", " ", "usi", "ng", " ", "the", " ", "Ef", "ron", " ", "method", " ", "to", " ", "handle", " ", "tied", " ", "times", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sur", "v_", "=_", "self_", "._", "sur", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grad_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "strat", "a_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "st", "x_", "in_", "range_", "(_", "sur", "v_", "._", "nstr", "at_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Indic", "es", " ", "of", " ", "case", "s", " ", "in", " ", "the", " ", "strat", "um_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strat", "\\u", "ix_", "=_", "sur", "v_", "._", "strat", "um", "\\u", "rows_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exo", "g", " ", "and", " ", "linear", " ", "predictor", " ", "of", " ", "the", " ", "strat", "um_", "\\u\\u\\uNL\\u\\u\\u_", "exo", "g", "\\u", "s_", "=_", "sur", "v_", "._", "exo", "g", "\\u", "s_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lin", "pred_", "=_", "np_", "._", "dot_", "(_", "exo", "g", "\\u", "s_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sur", "v_", "._", "offset", "\\u", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lin", "pred_", "+=_", "sur", "v_", "._", "offset", "\\u", "s_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lin", "pred_", "-=_", "lin", "pred_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "lin", "pred_", "=_", "np_", "._", "exp_", "(_", "lin", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xp", "0_", ",_", "xp", "1_", "=_", "0._", ",_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "back", "ward", " ", "through", " ", "the", " ", "unique", " ", "fail", "ure", " ", "times", "._", "\\u\\u\\uNL\\u\\u\\u_", "uf", "t", "\\u", "ix_", "=_", "sur", "v_", "._", "uf", "ail", "t", "\\u", "ix_", "[_", "st", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "ft_", "=_", "len_", "(_", "uf", "t", "\\u", "ix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nu", "ft_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "for", " ", "new", " ", "case", "s", " ", "entering", " ", "the", " ", "risk", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix_", "=_", "sur", "v_", "._", "risk", "\\u", "enter_", "[_", "st", "x_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ix_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "exo", "g", "\\u", "s_", "[_", "ix_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "0_", "+=_", "e\\u", "lin", "pred_", "[_", "ix_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "1_", "+=_", "(_", "e\\u", "lin", "pred_", "[_", "ix_", "]_", "[_", ":_", ",_", "None_", "]_", "*_", "v_", ")_", "._", "sum_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ix", "f_", "=_", "uf", "t", "\\u", "ix_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ix", "f_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "exo", "g", "\\u", "s_", "[_", "ix", "f_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "0f", "_", "=_", "e\\u", "lin", "pred_", "[_", "ix", "f_", "]_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "1f", "_", "=_", "(_", "e\\u", "lin", "pred_", "[_", "ix", "f_", "]_", "[_", ":_", ",_", "None_", "]_", "*_", "v_", ")_", "._", "sum_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Consider", " ", "all", " ", "case", "s", " ", "tha", "t", " ", "fail", " ", "at", " ", "this", " ", "point", "._", "\\u\\u\\uNL\\u\\u\\u_", "grad_", "+=_", "v_", "._", "sum_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "len_", "(_", "ix", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "np_", "._", "arange_", "(_", "m_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "/_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nume", "r_", "=_", "xp", "1_", "-_", "np_", "._", "outer_", "(_", "J_", ",_", "xp", "1f", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "denom_", "=_", "xp", "0_", "-_", "np_", "._", "outer_", "(_", "J_", ",_", "xp", "0f", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ratio_", "=_", "nume", "r_", "/_", "denom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsu", "m_", "=_", "ratio_", "._", "sum_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grad_", "-=_", "rsu", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "for", " ", "case", "s", " ", "leaving", " ", "the", " ", "risk", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ix_", "=_", "sur", "v_", "._", "risk", "\\u", "exit_", "[_", "st", "x_", "]_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ix_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "exo", "g", "\\u", "s_", "[_", "ix_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xp", "0_", "-=_", "e\\u", "lin", "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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 ]
Unused import
munki/munki/code/apps/Managed Software Center/Managed Software Center/MSCAppDelegate.py
[ { "content": "# encoding: utf-8\n#\n# MSCAppDelegate.py\n# Managed Software Center\n#\n# Copyright 2013-2016 Greg Neagle.\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# https://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# struct for the url handler\nimport struct\nimport os\nfrom urlparse import urlparse\n\nfrom objc import YES, NO, IBAction, IBOutlet, nil\nimport PyObjCTools\nfrom Foundation import *\nfrom AppKit import *\n\nfrom MSCStatusController import MSCStatusController\n\nimport munki\nimport mschtml\nimport msclog\nimport MunkiItems\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MSCAppDelegate(NSObject):\n\n mainWindowController = IBOutlet()\n statusController = IBOutlet()\n\n\n\n\n\n\n\n", "metadata": "root.MSCAppDelegate", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def applicationShouldTerminate_(self, sender):\n '''Called if user selects 'Quit' from menu'''\n return self.mainWindowController.appShouldTerminate()", "metadata": "root.MSCAppDelegate.applicationShouldTerminate_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 41 }, { "content": " def applicationDidFinishLaunching_(self, sender):\n '''NSApplication delegate method called at launch'''\n # setup client logging\n msclog.setup_logging()\n \n # userInfo dict can be nil, seems to be with 10.6\n if sender.userInfo():\n userNotification = sender.userInfo().get('NSApplicationLaunchUserNotificationKey')\n # we get this notification at launch because it's too early to have declared ourself\n # a NSUserNotificationCenterDelegate\n if userNotification:\n NSLog(\"Launched via Notification interaction\")\n self.userNotificationCenter_didActivateNotification_(\n NSUserNotificationCenter.defaultUserNotificationCenter(), userNotification)\n \n # Prevent automatic relaunching at login on Lion+\n if NSApp.respondsToSelector_('disableRelaunchOnLogin'):\n NSApp.disableRelaunchOnLogin()\n\n ver = NSBundle.mainBundle().infoDictionary().get('CFBundleShortVersionString')\n msclog.log(\"MSC\", \"launched\", \"VER=%s\" % ver)\n \n # if we're running under Snow Leopard, swap out the Dock icon for one\n # without the Retina assets to avoid an appearance issue when the\n # icon has a badge in the Dock (and App Switcher)\n # Darwin major version 10 is Snow Leopard (10.6)\n if os.uname()[2].split('.')[0] == '10':\n myImage = NSImage.imageNamed_(\"Managed Software Center 10_6\")\n NSApp.setApplicationIconImage_(myImage)\n\n # if we are running under Mountain Lion or later set ourselves as a delegate\n # for NSUserNotificationCenter notifications\n if os.uname()[2].split('.')[0] > '11':\n NSUserNotificationCenter.defaultUserNotificationCenter().setDelegate_(self)\n\n # have the statuscontroller register for its own notifications\n self.statusController.registerForNotifications()\n\n # user may have launched the app manually, or it may have\n # been launched by /usr/local/munki/managedsoftwareupdate\n # to display available updates\n if munki.thereAreUpdatesToBeForcedSoon(hours=2):\n # skip the check and just display the updates\n # by pretending the lastcheck is now\n lastcheck = NSDate.date()\n else:\n lastcheck = munki.pref('LastCheckDate')\n max_cache_age = munki.pref('CheckResultsCacheSeconds')\n # if there is no lastcheck timestamp, check for updates.\n if not lastcheck:\n self.mainWindowController.checkForUpdates()\n elif lastcheck.timeIntervalSinceNow() * -1 > int(max_cache_age):\n # check for updates if the last check is over the\n # configured manualcheck cache age max.\n self.mainWindowController.checkForUpdates()\n elif MunkiItems.updateCheckNeeded():\n # check for updates if we have optional items selected for install\n # or removal that have not yet been processed\n self.mainWindowController.checkForUpdates()\n \n # load the initial view only if we are not already loading something else.\n # enables launching the app to a specific panel, eg. from URL handler\n if not self.mainWindowController.webView.isLoading():\n self.mainWindowController.loadInitialView()", "metadata": "root.MSCAppDelegate.applicationDidFinishLaunching_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 45 }, { "content": " def applicationWillFinishLaunching_(self, notification):\n '''Installs URL handler for calls outside the app eg. web clicks'''\n man = NSAppleEventManager.sharedAppleEventManager()\n man.setEventHandler_andSelector_forEventClass_andEventID_(\n self,\n \"openURL:withReplyEvent:\",\n struct.unpack(\">i\", \"GURL\")[0],\n struct.unpack(\">i\", \"GURL\")[0])", "metadata": "root.MSCAppDelegate.applicationWillFinishLaunching_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 110 }, { "content": " def openMunkiURL(self, url):\n '''Display page associated with munki:// url'''\n parsed_url = urlparse(url)\n if parsed_url.scheme != 'munki':\n msclog.debug_log(\"URL %s has unsupported scheme\" % url)\n return\n filename = mschtml.unquote(parsed_url.netloc)\n # add .html if no extension\n if not os.path.splitext(filename)[1]:\n filename += u'.html'\n if filename.endswith(u'.html'):\n mschtml.build_page(filename)\n self.mainWindowController.load_page(filename)\n else:\n msclog.debug_log(\"%s doesn't have a valid extension. Prevented from opening\" % url)", "metadata": "root.MSCAppDelegate.openMunkiURL", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 119 }, { "content": " def openURL_withReplyEvent_(self, event, replyEvent):\n '''Handle openURL messages'''\n keyDirectObject = struct.unpack(\">i\", \"----\")[0]\n url = event.paramDescriptorForKeyword_(keyDirectObject).stringValue().decode('utf8')\n msclog.log(\"MSU\", \"Called by external URL: %s\", url)\n self.openMunkiURL(url)", "metadata": "root.MSCAppDelegate.openURL_withReplyEvent_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 135 }, { "content": " def userNotificationCenter_didActivateNotification_(self, center, notification):\n '''User clicked on a Notification Center alert'''\n user_info = notification.userInfo()\n if user_info.get('action') == 'open_url':\n url = user_info.get('value')\n msclog.log(\"MSU\", \"Got user notification to open %s\" % url)\n self.openMunkiURL(url)\n center.removeDeliveredNotification_(notification)\n else:\n msclog.log(\"MSU\", \"Got user notification with unrecognized userInfo\")", "metadata": "root.MSCAppDelegate.userNotificationCenter_didActivateNotification_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 142 }, { "content": " def userNotificationCenter_shouldPresentNotification_(self, center, notification):\n return True", "metadata": "root.MSCAppDelegate.userNotificationCenter_shouldPresentNotification_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 153 }, { "content": " def userNotificationCenter_didDeliverNotification_(self, center, notification):\n pass", "metadata": "root.MSCAppDelegate.userNotificationCenter_didDeliverNotification_", "header": "['class', 'MSCAppDelegate', '(', 'NSObject', ')', ':', '___EOS___']", "index": 156 } ]
[ { "span": "from objc import YES, NO, IBAction, IBOutlet, nil", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 49 }, { "span": "import PyObjCTools", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 18 }, { "span": "from MSCStatusController import MSCStatusController", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "MS", "CA", "pp", "Delegate", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Manage", "d", " ", "Sof", "twa", "re", " ", "Center_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "2013", "-", "2016", " ", "Gre", "g", " ", "Ne", "agl", "e", "._", "\\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_", "#", " ", " ", "https", "://", "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_", "#", " ", "struct", " ", "for", " ", "the", " ", "url", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "objc_", "import_", "YES_", ",_", "NO_", ",_", "IBA", "ction_", ",_", "IB", "Outl", "et_", ",_", "nil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Py", "Obj", "CT", "ools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Foun", "dati", "on_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "App", "Kit_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "MS", "CS", "tat", "us", "Controller_", "import_", "MS", "CS", "tat", "us", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mun", "ki_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "msc", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "msc", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Mun", "ki", "Items_", "\\u\\u\\uNEWLINE\\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_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "Window", "Controller_", "=_", "IB", "Outl", "et_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "Controller_", "=_", "IB", "Outl", "et_", "(_", ")_", "\\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_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "applica", "tion", "Sho", "ul", "d", "Terminate", "\\u_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Call", "ed", " ", "if", " ", "user", " ", "select", "s", " ", "'", "Qui", "t", "'", " ", "from", " ", "menu", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "main", "Window", "Controller_", "._", "app", "Sho", "ul", "d", "Terminate", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "applica", "tion", "Di", "d", "Finish", "Launch", "ing", "\\u_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "NS", "Applica", "tion", " ", "delegate", " ", "method", " ", "call", "ed", " ", "at", " ", "launch", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "setup", " ", "client", " ", "logging_", "\\u\\u\\uNL\\u\\u\\u_", "msc", "log_", "._", "setup", "\\u", "logging_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", "Info", " ", "dict", " ", "can", " ", "be", " ", "nil", ",", " ", "see", "ms", " ", "to", " ", "be", " ", "with", " ", "10.", "6_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sender_", "._", "user", "Info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Notification_", "=_", "sender_", "._", "user", "Info_", "(_", ")_", "._", "get_", "(_", "'", "NS", "Applica", "tion", "Launch", "User", "Notifi", "cation", "Key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "get", " ", "this", " ", "notification", " ", "at", " ", "launch", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "too", " ", "ear", "ly", " ", "to", " ", "have", " ", "declared", " ", "ours", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "NS", "User", "Notifi", "cation", "Center", "Delegate_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user", "Notification_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "NS", "Log_", "(_", "\"", "Launch", "ed", " ", "via", " ", "Notifi", "cation", " ", "interacti", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "Notifi", "cation", "Center", "\\u", "did", "Activat", "e", "Notifi", "cation", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "NS", "User", "Notifi", "cation", "Center_", "._", "default", "User", "Notifi", "cation", "Center_", "(_", ")_", ",_", "user", "Notification_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prev", "ent", " ", "automati", "c", " ", "rela", "unc", "hing", " ", "at", " ", "login", " ", "on", " ", "Li", "on", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "NS", "App_", "._", "respond", "s", "To", "Select", "or\\u_", "(_", "'", "disable", "Rela", "unc", "h", "On", "Logi", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "NS", "App_", "._", "disable", "Rela", "unc", "h", "On", "Login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ver_", "=_", "NS", "Bundle_", "._", "main", "Bundle_", "(_", ")_", "._", "info", "Dictionary_", "(_", ")_", "._", "get_", "(_", "'", "CF", "Bun", "dle", "Short", "Version", "String", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msc", "log_", "._", "log_", "(_", "\"", "MS", "C", "\"_", ",_", "\"", "launched", "\"_", ",_", "\"", "VER", "=", "%", "s", "\"_", "%_", "ver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", "'", "re", " ", "runn", "ing", " ", "under", " ", "Snow", " ", "Leo", "par", "d", ",", " ", "swap", " ", "out", " ", "the", " ", "Dock", " ", "icon", " ", "for", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "the", " ", "Ret", "ina", " ", "asset", "s", " ", "to", " ", "avoid", " ", "an", " ", "appearance", " ", "issue", " ", "whe", "n", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "icon", " ", "has", " ", "a", " ", "badge", " ", "in", " ", "the", " ", "Dock", " ", "(", "and", " ", "App", " ", "Switche", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dar", "win", " ", "major", " ", "version", " ", "10", " ", "is", " ", "Snow", " ", "Leo", "par", "d", " ", "(", "10.", "6", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "uname_", "(_", ")_", "[_", "2_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "==_", "'", "10", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "Image_", "=_", "NS", "Image_", "._", "image", "Name", "d\\u", "_", "(_", "\"", "Manage", "d", " ", "Sof", "twa", "re", " ", "Center", " ", "10", "\\u", "6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NS", "App_", "._", "set", "Applica", "tion", "Ico", "n", "Image", "\\u_", "(_", "my", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "runn", "ing", " ", "under", " ", "Mount", "ain", " ", "Li", "on", " ", "or", " ", "late", "r", " ", "set", " ", "ours", "elv", "es", " ", "as", " ", "a", " ", "delegate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "NS", "User", "Notifi", "cation", "Center", " ", "notifications_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "uname_", "(_", ")_", "[_", "2_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", ">_", "'", "11", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "NS", "User", "Notifi", "cation", "Center_", "._", "default", "User", "Notifi", "cation", "Center_", "(_", ")_", "._", "set", "Delegate", "\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "the", " ", "statusc", "ontr", "olle", "r", " ", "register", " ", "for", " ", "its", " ", "own", " ", "notifications_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "status", "Controller_", "._", "register", "For", "Notifi", "cations", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "may", " ", "have", " ", "launched", " ", "the", " ", "app", " ", "manu", "ally", ",", " ", "or", " ", "it", " ", "may", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "launched", " ", "by", " ", "/", "usr", "/", "local", "/", "mun", "ki", "/", "manage", "dso", "ft", "ware", "update_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "display", " ", "avail", "able", " ", "updates_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mun", "ki_", "._", "there", "Are", "Update", "s", "To", "Be", "Force", "d", "So", "on_", "(_", "hours_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "skip", " ", "the", " ", "check", " ", "and", " ", "just", " ", "display", " ", "the", " ", "updates_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "prete", "ndin", "g", " ", "the", " ", "lastc", "heck", " ", "is", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lastc", "heck_", "=_", "NS", "Date_", "._", "date_", "(_", ")_", "\\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 ", " _", "lastc", "heck_", "=_", "mun", "ki_", "._", "pref_", "(_", "'", "Las", "t", "Check", "Date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "cache", "\\u", "age_", "=_", "mun", "ki_", "._", "pref_", "(_", "'", "Check", "Result", "s", "Cache", "Second", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "no", " ", "lastc", "heck", " ", "timestamp", ",", " ", "check", " ", "for", " ", "update", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "lastc", "heck_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "main", "Window", "Controller_", "._", "check", "For", "Update", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lastc", "heck_", "._", "time", "Interv", "al", "Sin", "ce", "Now_", "(_", ")_", "*_", "-_", "1_", ">_", "int_", "(_", "max", "\\u", "cache", "\\u", "age_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "update", "s", " ", "if", " ", "the", " ", "last", " ", "check", " ", "is", " ", "over", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "configur", "ed", " ", "manu", "alc", "heck", " ", "cache", " ", "age", " ", "max", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "main", "Window", "Controller_", "._", "check", "For", "Update", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Mun", "ki", "Items_", "._", "update", "Check", "Needed", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "update", "s", " ", "if", " ", "we", " ", "have", " ", "option", "al", " ", "items", " ", "selecte", "d", " ", "for", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "removal", " ", "tha", "t", " ", "have", " ", "not", " ", "ye", "t", " ", "bee", "n", " ", "processed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "main", "Window", "Controller_", "._", "check", "For", "Update", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "the", " ", "initial", " ", "view", " ", "only", " ", "if", " ", "we", " ", "are", " ", "not", " ", "alr", "ead", "y", " ", "load", "ing", " ", "somet", "hing", " ", "else", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "enable", "s", " ", "launch", "ing", " ", "the", " ", "app", " ", "to", " ", "a", " ", "specific", " ", "panel", ",", " ", "eg", ".", " ", "from", " ", "URL", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "main", "Window", "Controller_", "._", "web", "View_", "._", "is", "Load", "ing_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "main", "Window", "Controller_", "._", "load", "Initial", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "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_", "def_", "applica", "tion", "Wil", "l", "Finish", "Launch", "ing", "\\u_", "(_", "self_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Install", "s", " ", "URL", " ", "handler", " ", "for", " ", "calls", " ", "outsi", "de", " ", "the", " ", "app", " ", "eg", ".", " ", "web", " ", "clicks", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "man_", "=_", "NS", "Apple", "Event", "Manager_", "._", "shared", "Apple", "Event", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "man_", "._", "set", "Event", "Handle", "r", "\\u", "and", "Select", "or", "\\u", "for", "Event", "Class\\u", "and", "Event", "ID", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "open", "URL", ":", "with", "Repl", "y", "Event", ":\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "unpack_", "(_", "\">", "i", "\"_", ",_", "\"", "GU", "RL", "\"_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "unpack_", "(_", "\">", "i", "\"_", ",_", "\"", "GU", "RL", "\"_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "Mun", "ki", "URL_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Display", " ", "page", " ", "associate", "d", " ", "with", " ", "mun", "ki", "://", " ", "url", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed", "\\u", "url_", "=_", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parsed", "\\u", "url_", "._", "scheme_", "!=_", "'", "mun", "ki", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msc", "log_", "._", "debug", "\\u", "log_", "(_", "\"", "URL", " ", "%", "s", " ", "has", " ", "unsup", "porte", "d", " ", "sche", "me", "\"_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "msc", "html_", "._", "unquote_", "(_", "parsed", "\\u", "url_", "._", "netloc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", ".", "html", " ", "if", " ", "no", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "+=_", "u", "'.", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filename_", "._", "endswith_", "(_", "u", "'.", "html", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msc", "html_", "._", "build", "\\u", "page_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "main", "Window", "Controller_", "._", "load", "\\u", "page_", "(_", "filename_", ")_", "\\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 ", " _", "msc", "log_", "._", "debug", "\\u", "log_", "(_", "\"%", "s", " ", "doe", "sn", "'", "t", " ", "have", " ", "a", " ", "valid", " ", "extensi", "on", ".", " ", "Prev", "ente", "d", " ", "from", " ", "opening", "\"_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "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_", "def_", "open", "URL", "\\u", "with", "Repl", "y", "Event", "\\u_", "(_", "self_", ",_", "event_", ",_", "repl", "y", "Event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Handle", " ", "open", "URL", " ", "message", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "Direct", "Object_", "=_", "struct_", "._", "unpack_", "(_", "\">", "i", "\"_", ",_", "\"----", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "event_", "._", "param", "Descrip", "tor", "For", "Key", "word", "\\u_", "(_", "key", "Direct", "Object_", ")_", "._", "string", "Value_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msc", "log_", "._", "log_", "(_", "\"", "MS", "U", "\"_", ",_", "\"", "Call", "ed", " ", "by", " ", "external", " ", "URL", ":", " ", "%", "s", "\"_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "open", "Mun", "ki", "URL_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "Notifi", "cation", "Center", "\\u", "did", "Activat", "e", "Notifi", "cation", "\\u_", "(_", "self_", ",_", "center_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "User", " ", "click", "ed", " ", "on", " ", "a", " ", "Notifi", "cation", " ", "Center", " ", "alert", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "=_", "notification_", "._", "user", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user", "\\u", "info_", "._", "get_", "(_", "'", "action", "'_", ")_", "==_", "'", "open", "\\u", "url", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "user", "\\u", "info_", "._", "get_", "(_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msc", "log_", "._", "log_", "(_", "\"", "MS", "U", "\"_", ",_", "\"", "Got", " ", "user", " ", "notification", " ", "to", " ", "open", " ", "%", "s", "\"_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "open", "Mun", "ki", "URL_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center_", "._", "remove", "Deliver", "ed", "Notifi", "cation", "\\u_", "(_", "notification_", ")_", "\\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 ", " _", "msc", "log_", "._", "log_", "(_", "\"", "MS", "U", "\"_", ",_", "\"", "Got", " ", "user", " ", "notification", " ", "with", " ", "unre", "cogni", "zed", " ", "user", "Info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "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_", "def_", "user", "Notifi", "cation", "Center", "\\u", "shou", "ld", "Present", "Notifi", "cation", "\\u_", "(_", "self_", ",_", "center_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MS", "CA", "pp", "Delegate_", "(_", "NS", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "user", "Notifi", "cation", "Center", "\\u", "did", "Deliver", "Notifi", "cation", "\\u_", "(_", "self_", ",_", "center_", ",_", "notification_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 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,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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, 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, 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 ]
Wrong number of arguments in a class instantiation
kdart/pycopia/net/pycopia/iscsi/protocol.py
[ { "content": "class Connection(socket.AsyncSocket):\n \"\"\"Connection contains associated transactions.\n Assures connection allegiance.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.Connection", "header": "['module', '___EOS___']", "index": 61 }, { "content": " def __init__(self, debug=False):\n super(Connection, self).__init__(socket.AF_INET, socket.SOCK_STREAM)", "metadata": "root.Connection.__init__", "header": "['class', 'Connection', '(', 'socket', '.', 'AsyncSocket', ')', ':', '___EOS___']", "index": 66 }, { "content": " def __init__(self, sock, session_context):\n self._sock = sock\n self._context = session_context\n self.cid = 0 # connection ID", "metadata": "root.Connection.__init__", "header": "['class', 'Connection', '(', 'socket', '.', 'AsyncSocket', ')', ':', '___EOS___']", "index": 70 }, { "content": " def fileno(self):\n return self._sock.fileno()", "metadata": "root.Connection.fileno", "header": "['class', 'Connection', '(', 'socket', '.', 'AsyncSocket', ')', ':', '___EOS___']", "index": 75 }, { "content": " def close(self):\n sock = self._sock\n self._sock = None\n sock.close()", "metadata": "root.Connection.close", "header": "['class', 'Connection', '(', 'socket', '.', 'AsyncSocket', ')', ':', '___EOS___']", "index": 78 }, { "content": " def login(self):\n pdu = headers.LoginPDU()\n pdu.current_stage = SECURITY_NEGOTIATION_STAGE\n pdu.next_stage = OP_PARMS_NEGOTIATION_STAGE\n pdu.ISID = self._context[\"isid\"]\n # add data part\n pdu[\"SessionType\"] = \"Normal\"\n pdu[\"AuthMethod\"] = \"Chap,None\"\n pdu[\"InitiatorName\"] = self._context[\"initiator\"]\n pdu[\"TargetName\"] = self._context[\"target\"]\n self._sock.send(pdu.encode())", "metadata": "root.Connection.login", "header": "['class', 'Connection', '(', 'socket', '.', 'AsyncSocket', ')', ':', '___EOS___']", "index": 83 }, { "content": " def add_connection(self, port=constants.LISTEN_PORT):\n sock = Connection(self._context)\n h = asyncio.register(sock)\n self._connections.append(sock)", "metadata": "root.Session.add_connection", "header": "['class', 'Session', '(', 'object', ')', ':', '___EOS___']", "index": 149 } ]
[ { "span": "Connection(self._context)", "start_line": 150, "start_column": 15, "end_line": 150, "end_column": 40 } ]
[ { "span": "def __init__(self, sock, session_context):", "start_line": 70, "start_column": 4, "end_line": 70, "end_column": 46 } ]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "class_", "instantiation", "_", "[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_", "Connection_", "(_", "socket_", "._", "Async", "Socket_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", "ion", " ", "contain", "s", " ", "associate", "d", " ", "transaction", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Assu", "res", " ", "connecti", "on", " ", "alle", "gian", "ce", ".", "\\", "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\\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_", "Connection_", "(_", "socket_", "._", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "debug_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Connection_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "socket_", "._", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "sock_", ",_", "session", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sock_", "=_", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "context_", "=_", "session", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cid_", "=_", "0_", "#", " ", "connecti", "on", " ", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "socket_", "._", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fileno_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "sock_", "._", "fileno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "socket_", "._", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "self_", "._", "\\u", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "socket_", "._", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdu_", "=_", "headers_", "._", "Logi", "n", "PD", "U_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdu_", "._", "current", "\\u", "stage_", "=_", "SECURITY", "\\u", "NEG", "OT", "IAT", "ION", "\\u", "STAGE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdu_", "._", "next", "\\u", "stage_", "=_", "OP", "\\u", "PAR", "MS", "\\u", "NEG", "OT", "IAT", "ION", "\\u", "STAGE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdu_", "._", "ISI", "D_", "=_", "self_", "._", "\\u", "context_", "[_", "\"", "isi", "d", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "data", " ", "part_", "\\u\\u\\uNL\\u\\u\\u_", "pdu_", "[_", "\"", "Sess", "ion", "Type", "\"_", "]_", "=_", "\"", "Normal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdu_", "[_", "\"", "Auth", "Meth", "od", "\"_", "]_", "=_", "\"", "Chap", ",", "Non", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdu_", "[_", "\"", "Initiat", "or", "Name", "\"_", "]_", "=_", "self_", "._", "\\u", "context_", "[_", "\"", "initiator", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdu_", "[_", "\"", "Target", "Name", "\"_", "]_", "=_", "self_", "._", "\\u", "context_", "[_", "\"", "target", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sock_", "._", "send_", "(_", "pdu_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "connection_", "(_", "self_", ",_", "port_", "=_", "constants_", "._", "LISTEN", "\\u", "PORT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "Connection_", "(_", "self_", "._", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "asyncio_", "._", "register_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "connections_", "._", "append_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
nltk/nltk/nltk/collocations.py
[ { "content": "# Natural Language Toolkit: Collocations and Association Measures\n#\n# Copyright (C) 2001-2016 NLTK Project\n# Author: Joel Nothman <jnothman@student.usyd.edu.au>\n# URL: <http://nltk.org>\n# For license information, see LICENSE.TXT\n#\n\"\"\"\nTools to identify collocations --- words that often appear consecutively\n--- within corpora. They may also be used to find other associations between\nword occurrences.\nSee Manning and Schutze ch. 5 at http://nlp.stanford.edu/fsnlp/promo/colloc.pdf\nand the Text::NSP Perl package at http://ngram.sourceforge.net\n\nFinding collocations requires first calculating the frequencies of words and\ntheir appearance in the context of other words. Often the collection of words\nwill then requiring filtering to only retain useful content terms. Each ngram\nof words may then be scored according to some association measure, in order\nto determine the relative likelihood of each ngram being a collocation.\n\nThe ``BigramCollocationFinder`` and ``TrigramCollocationFinder`` classes provide\nthese functionalities, dependent on being provided a function which scores a\nngram given appropriate frequency counts. A number of standard association\nmeasures are provided in bigram_measures and trigram_measures.\n\"\"\"\nfrom __future__ import print_function\n\n# Possible TODOs:\n# - consider the distinction between f(x,_) and f(x) and whether our\n# approximation is good enough for fragmented data, and mention it\n# - add a n-gram collocation finder with measures which only utilise n-gram\n# and unigram counts (raw_freq, pmi, student_t)\n\nimport itertools as _itertools\nfrom nltk.compat import iteritems\n\nfrom nltk.probability import FreqDist\nfrom nltk.util import ngrams\nfrom nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures\nfrom nltk.metrics.spearman import ranks_from_scores, spearman_correlation\n\n\n\n\n\n\n\n\n\n\n\n# Slows down loading too much\n# bigram_measures = BigramAssocMeasures()\n# trigram_measures = TrigramAssocMeasures()\n\nif __name__ == '__main__':\n import sys\n from nltk.metrics import BigramAssocMeasures\n\n try:\n scorer = eval('BigramAssocMeasures.' + sys.argv[1])\n except IndexError:\n scorer = None\n try:\n compare_scorer = eval('BigramAssocMeasures.' + sys.argv[2])\n except IndexError:\n compare_scorer = None\n\n demo(scorer, compare_scorer)\n\n__all__ = ['BigramCollocationFinder',\n 'TrigramCollocationFinder', 'QuadgramCollocationFinder']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AbstractCollocationFinder(object):\n \"\"\"\n An abstract base class for collocation finders whose purpose is to\n collect collocation candidate frequencies, filter and rank them.\n\n As a minimum, collocation finders require the frequencies of each\n word in a corpus, and the joint frequency of word tuples. This data\n should be provided through nltk.probability.FreqDist objects or an\n identical interface.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AbstractCollocationFinder", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def __init__(self, word_fd, ngram_fd):\n self.word_fd = word_fd\n self.N = word_fd.N()\n self.ngram_fd = ngram_fd", "metadata": "root.AbstractCollocationFinder.__init__", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " @classmethod\n def _build_new_documents(cls, documents, window_size, pad_left=False, pad_right=False, pad_symbol=None):\n '''\n Pad the document with the place holder according to the window_size\n '''\n padding = (pad_symbol,) * (window_size - 1)\n if pad_right:\n return _itertools.chain.from_iterable(_itertools.chain(doc, padding) for doc in documents)\n if pad_left:\n return _itertools.chain.from_iterable(_itertools.chain(padding, doc) for doc in documents)", "metadata": "root.AbstractCollocationFinder._build_new_documents", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " @classmethod\n def from_documents(cls, documents):\n \"\"\"Constructs a collocation finder given a collection of documents,\n each of which is a list (or iterable) of tokens.\n \"\"\"\n #return cls.from_words(_itertools.chain(*documents))\n return cls.from_words(cls._build_new_documents(documents, cls.default_ws, pad_right=True))", "metadata": "root.AbstractCollocationFinder.from_documents", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " @staticmethod\n def _ngram_freqdist(words, n):\n return FreqDist(tuple(words[i:i + n]) for i in range(len(words) - 1))", "metadata": "root.AbstractCollocationFinder._ngram_freqdist", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def _apply_filter(self, fn=lambda ngram, freq: False):\n \"\"\"Generic filter removes ngrams from the frequency distribution\n if the function returns True when passed an ngram tuple.\n \"\"\"\n tmp_ngram = FreqDist()\n for ngram, freq in iteritems(self.ngram_fd):\n if not fn(ngram, freq):\n tmp_ngram[ngram] = freq\n self.ngram_fd = tmp_ngram", "metadata": "root.AbstractCollocationFinder._apply_filter", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 81 }, { "content": " def apply_freq_filter(self, min_freq):\n \"\"\"Removes candidate ngrams which have frequency less than min_freq.\"\"\"\n self._apply_filter(lambda ng, freq: freq < min_freq)", "metadata": "root.AbstractCollocationFinder.apply_freq_filter", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 91 }, { "content": " def apply_ngram_filter(self, fn):\n \"\"\"Removes candidate ngrams (w1, w2, ...) where fn(w1, w2, ...)\n evaluates to True.\n \"\"\"\n self._apply_filter(lambda ng, f: fn(*ng))", "metadata": "root.AbstractCollocationFinder.apply_ngram_filter", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def apply_word_filter(self, fn):\n \"\"\"Removes candidate ngrams (w1, w2, ...) where any of (fn(w1), fn(w2),\n ...) evaluates to True.\n \"\"\"\n self._apply_filter(lambda ng, f: any(fn(w) for w in ng))", "metadata": "root.AbstractCollocationFinder.apply_word_filter", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 101 }, { "content": " def _score_ngrams(self, score_fn):\n \"\"\"Generates of (ngram, score) pairs as determined by the scoring\n function provided.\n \"\"\"\n for tup in self.ngram_fd:\n score = self.score_ngram(score_fn, *tup)\n if score is not None:\n yield tup, score", "metadata": "root.AbstractCollocationFinder._score_ngrams", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def score_ngrams(self, score_fn):\n \"\"\"Returns a sequence of (ngram, score) pairs ordered from highest to\n lowest score, as determined by the scoring function provided.\n \"\"\"\n return sorted(self._score_ngrams(score_fn), key=lambda t: (-t[1], t[0]))", "metadata": "root.AbstractCollocationFinder.score_ngrams", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 116 }, { "content": " def nbest(self, score_fn, n):\n \"\"\"Returns the top n ngrams when scored by the given function.\"\"\"\n return [p for p, s in self.score_ngrams(score_fn)[:n]]", "metadata": "root.AbstractCollocationFinder.nbest", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 122 }, { "content": " def above_score(self, score_fn, min_score):\n \"\"\"Returns a sequence of ngrams, ordered by decreasing score, whose\n scores each exceed the given minimum score.\n \"\"\"\n for ngram, score in self.score_ngrams(score_fn):\n if score > min_score:\n yield ngram\n else:\n break", "metadata": "root.AbstractCollocationFinder.above_score", "header": "['class', 'AbstractCollocationFinder', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": "class BigramCollocationFinder(AbstractCollocationFinder):\n \"\"\"A tool for the finding and ranking of bigram collocations or other\n association measures. It is often useful to use from_words() rather than\n constructing an instance directly.\n \"\"\"\n default_ws = 2\n\n\n", "metadata": "root.BigramCollocationFinder", "header": "['module', '___EOS___']", "index": 137 }, { "content": " def __init__(self, word_fd, bigram_fd, window_size=2):\n \"\"\"Construct a BigramCollocationFinder, given FreqDists for\n appearances of words and (possibly non-contiguous) bigrams.\n \"\"\"\n AbstractCollocationFinder.__init__(self, word_fd, bigram_fd)\n self.window_size = window_size", "metadata": "root.BigramCollocationFinder.__init__", "header": "['class', 'BigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 144 }, { "content": " @classmethod\n def from_words(cls, words, window_size=2):\n \"\"\"Construct a BigramCollocationFinder for all bigrams in the given\n sequence. When window_size > 2, count non-contiguous bigrams, in the\n style of Church and Hanks's (1990) association ratio.\n \"\"\"\n wfd = FreqDist()\n bfd = FreqDist()\n\n if window_size < 2:\n raise ValueError(\"Specify window_size at least 2\")\n\n for window in ngrams(words, window_size, pad_right=True):\n w1 = window[0]\n if w1 is None:\n continue\n wfd[w1] += 1\n for w2 in window[1:]:\n if w2 is not None:\n bfd[(w1, w2)] += 1\n return cls(wfd, bfd, window_size=window_size)", "metadata": "root.BigramCollocationFinder.from_words", "header": "['class', 'BigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 151 }, { "content": " def score_ngram(self, score_fn, w1, w2):\n \"\"\"Returns the score for a given bigram using the given scoring\n function. Following Church and Hanks (1990), counts are scaled by\n a factor of 1/(window_size - 1).\n \"\"\"\n n_all = self.N\n n_ii = self.ngram_fd[(w1, w2)] / (self.window_size - 1.0)\n if not n_ii:\n return\n n_ix = self.word_fd[w1]\n n_xi = self.word_fd[w2]\n return score_fn(n_ii, (n_ix, n_xi), n_all)", "metadata": "root.BigramCollocationFinder.score_ngram", "header": "['class', 'BigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 173 }, { "content": "class TrigramCollocationFinder(AbstractCollocationFinder):\n \"\"\"A tool for the finding and ranking of trigram collocations or other\n association measures. It is often useful to use from_words() rather than\n constructing an instance directly.\n \"\"\"\n default_ws = 3\n\n\n\n", "metadata": "root.TrigramCollocationFinder", "header": "['module', '___EOS___']", "index": 187 }, { "content": " def __init__(self, word_fd, bigram_fd, wildcard_fd, trigram_fd):\n \"\"\"Construct a TrigramCollocationFinder, given FreqDists for\n appearances of words, bigrams, two words with any word between them,\n and trigrams.\n \"\"\"\n AbstractCollocationFinder.__init__(self, word_fd, trigram_fd)\n self.wildcard_fd = wildcard_fd\n self.bigram_fd = bigram_fd", "metadata": "root.TrigramCollocationFinder.__init__", "header": "['class', 'TrigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 194 }, { "content": " @classmethod\n def from_words(cls, words, window_size=3):\n \"\"\"Construct a TrigramCollocationFinder for all trigrams in the given\n sequence.\n \"\"\"\n if window_size < 3:\n raise ValueError(\"Specify window_size at least 3\")\n\n wfd = FreqDist()\n wildfd = FreqDist()\n bfd = FreqDist()\n tfd = FreqDist()\n for window in ngrams(words, window_size, pad_right=True):\n w1 = window[0]\n if w1 is None:\n continue\n for w2, w3 in _itertools.combinations(window[1:], 2):\n wfd[w1] += 1\n if w2 is None:\n continue\n bfd[(w1, w2)] += 1\n if w3 is None:\n continue\n wildfd[(w1, w3)] += 1\n tfd[(w1, w2, w3)] += 1\n return cls(wfd, bfd, wildfd, tfd)", "metadata": "root.TrigramCollocationFinder.from_words", "header": "['class', 'TrigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 203 }, { "content": " def bigram_finder(self):\n \"\"\"Constructs a bigram collocation finder with the bigram and unigram\n data from this finder. Note that this does not include any filtering\n applied to this finder.\n \"\"\"\n return BigramCollocationFinder(self.word_fd, self.bigram_fd)", "metadata": "root.TrigramCollocationFinder.bigram_finder", "header": "['class', 'TrigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 230 }, { "content": " def score_ngram(self, score_fn, w1, w2, w3):\n \"\"\"Returns the score for a given trigram using the given scoring\n function.\n \"\"\"\n n_all = self.N\n n_iii = self.ngram_fd[(w1, w2, w3)]\n if not n_iii:\n return\n n_iix = self.bigram_fd[(w1, w2)]\n n_ixi = self.wildcard_fd[(w1, w3)]\n n_xii = self.bigram_fd[(w2, w3)]\n n_ixx = self.word_fd[w1]\n n_xix = self.word_fd[w2]\n n_xxi = self.word_fd[w3]\n return score_fn(n_iii,\n (n_iix, n_ixi, n_xii),\n (n_ixx, n_xix, n_xxi),\n n_all)", "metadata": "root.TrigramCollocationFinder.score_ngram", "header": "['class', 'TrigramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 237 }, { "content": "class QuadgramCollocationFinder(AbstractCollocationFinder):\n \"\"\"A tool for the finding and ranking of quadgram collocations or other association measures.\n It is often useful to use from_words() rather than constructing an instance directly.\n \"\"\"\n default_ws = 4\n\n\n", "metadata": "root.QuadgramCollocationFinder", "header": "['module', '___EOS___']", "index": 257 }, { "content": " def __init__(self, word_fd, quadgram_fd, ii, iii, ixi, ixxi, iixi, ixii):\n \"\"\"Construct a QuadgramCollocationFinder, given FreqDists for appearances of words,\n bigrams, trigrams, two words with one word and two words between them, three words\n with a word between them in both variations.\n \"\"\"\n AbstractCollocationFinder.__init__(self, word_fd, quadgram_fd)\n self.iii = iii\n self.ii = ii\n self.ixi = ixi\n self.ixxi = ixxi\n self.iixi = iixi\n self.ixii = ixii", "metadata": "root.QuadgramCollocationFinder.__init__", "header": "['class', 'QuadgramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 263 }, { "content": " @classmethod\n def from_words(cls, words, window_size=4):\n if window_size < 4:\n raise ValueError(\"Specify window_size at least 4\")\n ixxx = FreqDist()\n iiii = FreqDist()\n ii = FreqDist()\n iii = FreqDist()\n ixi = FreqDist()\n ixxi = FreqDist()\n iixi = FreqDist()\n ixii = FreqDist()\n\n for window in ngrams(words, window_size, pad_right=True):\n w1 = window[0]\n if w1 is None:\n continue\n for w2, w3, w4 in _itertools.combinations(window[1:], 3):\n ixxx[w1] += 1\n if w2 is None:\n continue\n ii[(w1, w2)] += 1\n if w3 is None:\n continue\n iii[(w1, w2, w3)] += 1\n ixi[(w1, w3)] += 1\n if w4 is None:\n continue\n iiii[(w1, w2, w3, w4)] += 1\n ixxi[(w1, w4)] += 1\n ixii[(w1, w3, w4)] += 1\n iixi[(w1, w2, w4)] += 1\n\n return cls(ixxx, iiii, ii, iii, ixi, ixxi, iixi, ixii)", "metadata": "root.QuadgramCollocationFinder.from_words", "header": "['class', 'QuadgramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 276 }, { "content": " def score_ngram(self, score_fn, w1, w2, w3, w4):\n n_all = self.N\n n_iiii = self.ngram_fd[(w1, w2, w3, w4)]\n if not n_iiii:\n return\n n_iiix = self.iii[(w1, w2, w3)]\n n_xiii = self.iii[(w2, w3, w4)]\n n_iixi = self.iixi[(w1, w2, w4)]\n n_ixii = self.ixii[(w1, w3, w4)]\n\n n_iixx = self.ii[(w1, w2)]\n n_xxii = self.ii[(w3, w4)]\n n_xiix = self.ii[(w2, w3)]\n n_ixix = self.ixi[(w1, w3)]\n n_ixxi = self.ixxi[(w1, w4)]\n n_xixi = self.ixi[(w2, w4)]\n\n n_ixxx = self.word_fd[w1]\n n_xixx = self.word_fd[w2]\n n_xxix = self.word_fd[w3]\n n_xxxi = self.word_fd[w4]\n return score_fn(n_iiii,\n (n_iiix, n_iixi, n_ixii, n_xiii),\n (n_iixx, n_ixix, n_ixxi, n_xixi, n_xxii, n_xiix),\n (n_ixxx, n_xixx, n_xxix, n_xxxi),\n n_all)", "metadata": "root.QuadgramCollocationFinder.score_ngram", "header": "['class', 'QuadgramCollocationFinder', '(', 'AbstractCollocationFinder', ')', ':', '___EOS___']", "index": 311 }, { "content": "def demo(scorer=None, compare_scorer=None):\n \"\"\"Finds bigram collocations in the files of the WebText corpus.\"\"\"\n from nltk.metrics import BigramAssocMeasures, spearman_correlation, ranks_from_scores\n\n if scorer is None:\n scorer = BigramAssocMeasures.likelihood_ratio\n if compare_scorer is None:\n compare_scorer = BigramAssocMeasures.raw_freq\n\n from nltk.corpus import stopwords, webtext\n\n ignored_words = stopwords.words('english')\n word_filter = lambda w: len(w) < 3 or w.lower() in ignored_words\n\n for file in webtext.fileids():\n words = [word.lower()\n for word in webtext.words(file)]\n\n cf = BigramCollocationFinder.from_words(words)\n cf.apply_freq_filter(3)\n cf.apply_word_filter(word_filter)\n\n corr = spearman_correlation(ranks_from_scores(cf.score_ngrams(scorer)),\n ranks_from_scores(cf.score_ngrams(compare_scorer)))\n print(file)\n print('\\t', [' '.join(tup) for tup in cf.nbest(scorer, 15)])\n print('\\t Correlation to %s: %0.4f' % (compare_scorer.__name__, corr))", "metadata": "root.demo", "header": "['module', '___EOS___']", "index": 339 } ]
[ { "span": "from nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 87 }, { "span": "from nltk.metrics.spearman import ranks_from_scores, spearman_correlation", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 73 }, { "span": "from nltk.metrics import BigramAssocMeasures", "start_line": 373, "start_column": 4, "end_line": 373, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "Tool", "kit", ":", " ", "Coll", "ocation", "s", " ", "and", " ", "Assoc", "iation", " ", "Measure", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "1", "-", "2016", " ", "NL", "TK", " ", "Project_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Jo", "el", " ", "Not", "hma", "n", " ", "<", "jn", "oth", "man", "@", "student", ".", "us", "yd", ".", "edu", ".", "au", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", ":", " ", "<", "http", "://", "nlt", "k", ".", "org", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "license", " ", "informati", "on", ",", " ", "see", " ", "LICENSE", ".", "TXT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Tool", "s", " ", "to", " ", "identify", " ", "coll", "ocation", "s", " ", "---", " ", "words", " ", "tha", "t", " ", "oft", "en", " ", "appear", " ", "consec", "uti", "vel", "y", "\\", "10", ";", "---", " ", "within", " ", "corpora", ".", " ", "The", "y", " ", "may", " ", "als", "o", " ", "be", " ", "used", " ", "to", " ", "find", " ", "other", " ", "associations", " ", "bet", "ween", "\\", "10", ";", "word", " ", "occurrences", ".", "\\", "10", ";", "See", " ", "Man", "ning", " ", "and", " ", "Sch", "ut", "ze", " ", "ch", ".", " ", "5", " ", "at", " ", "http", "://", "nlp", ".", "stan", "for", "d", ".", "edu", "/", "fs", "nlp", "/", "promo", "/", "coll", "oc", ".", "pdf", "\\", "10", ";", "and", " ", "the", " ", "Text", "::", "NS", "P", " ", "Per", "l", " ", "package", " ", "at", " ", "http", "://", "ngram", ".", "sourcef", "org", "e", ".", "net", "\\", "10", ";", "\\", "10", ";", "Finding", " ", "coll", "ocation", "s", " ", "require", "s", " ", "first", " ", "calculati", "ng", " ", "the", " ", "freque", "ncie", "s", " ", "of", " ", "words", " ", "and", "\\", "10", ";", "thei", "r", " ", "appearance", " ", "in", " ", "the", " ", "context", " ", "of", " ", "other", " ", "words", ".", " ", "Of", "ten", " ", "the", " ", "collection", " ", "of", " ", "words", "\\", "10", ";", "will", " ", "then", " ", "requi", "ring", " ", "filtering", " ", "to", " ", "only", " ", "retain", " ", "usef", "ul", " ", "content", " ", "term", "s", ".", " ", "Ea", "ch", " ", "ngram", "\\", "10", ";", "of", " ", "words", " ", "may", " ", "then", " ", "be", " ", "scored", " ", "according", " ", "to", " ", "some", " ", "associ", "ation", " ", "measure", ",", " ", "in", " ", "order", "\\", "10", ";", "to", " ", "dete", "rmin", "e", " ", "the", " ", "relative", " ", "likelihood", " ", "of", " ", "each", " ", "ngram", " ", "bei", "ng", " ", "a", " ", "coll", "ocation", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "``", "Big", "ram", "Coll", "ocation", "Fin", "der", "``", " ", "and", " ", "``", "Trig", "ram", "Coll", "ocation", "Fin", "der", "``", " ", "classe", "s", " ", "provide", "\\", "10", ";", "these", " ", "functional", "iti", "es", ",", " ", "dependent", " ", "on", " ", "bei", "ng", " ", "provided", " ", "a", " ", "function", " ", "whi", "ch", " ", "score", "s", " ", "a", "\\", "10", ";", "ngram", " ", "give", "n", " ", "appropr", "iate", " ", "freque", "nc", "y", " ", "count", "s", ".", " ", "A", " ", "number", " ", "of", " ", "standard", " ", "associ", "ation", "\\", "10", ";", "measure", "s", " ", "are", " ", "provided", " ", "in", " ", "bigram", "\\u", "measure", "s", " ", "and", " ", "trig", "ram", "\\u", "measure", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "#", " ", "Poss", "ibl", "e", " ", "TOD", "Os", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "consider", " ", "the", " ", "distinct", "ion", " ", "bet", "ween", " ", "f", "(", "x", ",\\u", ")", " ", "and", " ", "f", "(", "x", ")", " ", "and", " ", "whe", "ther", " ", "our_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "approx", "imat", "ion", " ", "is", " ", "good", " ", "eno", "ugh", " ", "for", " ", "fragment", "ed", " ", "data", ",", " ", "and", " ", "menti", "on", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "add", " ", "a", " ", "n", "-", "gram", " ", "coll", "ocation", " ", "finde", "r", " ", "with", " ", "measure", "s", " ", "whi", "ch", " ", "only", " ", "utilis", "e", " ", "n", "-", "gram_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "and", " ", "unig", "ram", " ", "count", "s", " ", "(", "raw", "\\u", "freq", ",", " ", "pmi", ",", " ", "student", "\\u", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "as_", "\\u", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "compat_", "import_", "iteritems_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nltk_", "._", "probability_", "import_", "Freq", "Dist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "util_", "import_", "ngrams_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "metrics_", "import_", "Conti", "ngen", "cy", "Measure", "s_", ",_", "Big", "ram", "Assoc", "Measure", "s_", ",_", "Trig", "ram", "Assoc", "Measure", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "metrics_", "._", "spear", "man_", "import_", "ranks", "\\u", "from", "\\u", "scores_", ",_", "spear", "man", "\\u", "correlation_", "\\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_", "#", " ", "Slow", "s", " ", "down", " ", "load", "ing", " ", "too", " ", "muc", "h_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bigram", "\\u", "measure", "s", " ", "=", " ", "Big", "ram", "Assoc", "Measure", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trig", "ram", "\\u", "measure", "s", " ", "=", " ", "Trig", "ram", "Assoc", "Measure", "s", "()", "_", "\\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 ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "metrics_", "import_", "Big", "ram", "Assoc", "Measure", "s_", "\\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 ", " _", "scorer", "_", "=_", "eval_", "(_", "'", "Big", "ram", "Assoc", "Measure", "s", ".'_", "+_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scorer", "_", "=_", "None_", "\\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 ", " _", "compare", "\\u", "scorer", "_", "=_", "eval_", "(_", "'", "Big", "ram", "Assoc", "Measure", "s", ".'_", "+_", "sys_", "._", "argv_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compare", "\\u", "scorer", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "demo_", "(_", "scorer", "_", ",_", "compare", "\\u", "scorer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Big", "ram", "Coll", "ocation", "Fin", "der", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Trig", "ram", "Coll", "ocation", "Fin", "der", "'_", ",_", "'", "Quad", "gram", "Coll", "ocation", "Fin", "der", "'_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "abstract", " ", "base", " ", "class", " ", "for", " ", "coll", "ocation", " ", "finde", "rs", " ", "who", "se", " ", "purpose", " ", "is", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "collect", " ", "coll", "ocation", " ", "candidate", " ", "freque", "ncie", "s", ",", " ", "filter", " ", "and", " ", "rank", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "As", " ", "a", " ", "minim", "um", ",", " ", "coll", "ocation", " ", "finde", "rs", " ", "require", " ", "the", " ", "freque", "ncie", "s", " ", "of", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "word", " ", "in", " ", "a", " ", "corp", "us", ",", " ", "and", " ", "the", " ", "joint", " ", "freque", "nc", "y", " ", "of", " ", "word", " ", "tuple", "s", ".", " ", "Thi", "s", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "provided", " ", "through", " ", "nlt", "k", ".", "probabilit", "y", ".", "Freq", "Dist", " ", "object", "s", " ", "or", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "identi", "cal", " ", "interface", ".", "\\", "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_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "ngram", "\\u", "fd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "word", "\\u", "fd_", "=_", "word", "\\u", "fd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "N_", "=_", "word", "\\u", "fd_", "._", "N_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ngram", "\\u", "fd_", "=_", "ngram", "\\u", "fd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "build", "\\u", "new", "\\u", "documents_", "(_", "cls_", ",_", "documents_", ",_", "window", "\\u", "size_", ",_", "pad", "\\u", "left_", "=_", "False_", ",_", "pad", "\\u", "right_", "=_", "False_", ",_", "pad", "\\u", "symbol_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Pad", " ", "the", " ", "document", " ", "with", " ", "the", " ", "place", " ", "holder", " ", "according", " ", "to", " ", "the", " ", "window", "\\u", "size", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "padding_", "=_", "(_", "pad", "\\u", "symbol_", ",_", ")_", "*_", "(_", "window", "\\u", "size_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pad", "\\u", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "itertools_", "._", "chain_", "._", "from", "\\u", "iterable_", "(_", "\\u", "itertools_", "._", "chain_", "(_", "doc_", ",_", "padding_", ")_", "for_", "doc_", "in_", "documents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pad", "\\u", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "itertools_", "._", "chain_", "._", "from", "\\u", "iterable_", "(_", "\\u", "itertools_", "._", "chain_", "(_", "padding_", ",_", "doc_", ")_", "for_", "doc_", "in_", "documents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "documents_", "(_", "cls_", ",_", "documents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", "s", " ", "a", " ", "coll", "ocation", " ", "finde", "r", " ", "give", "n", " ", "a", " ", "collection", " ", "of", " ", "document", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "of", " ", "whi", "ch", " ", "is", " ", "a", " ", "list", " ", "(", "or", " ", "iterable", ")", " ", "of", " ", "token", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "cls", ".", "from", "\\u", "words", "(\\u", "iter", "tool", "s", ".", "chain", "(*", "document", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cls_", "._", "from", "\\u", "words_", "(_", "cls_", "._", "\\u", "build", "\\u", "new", "\\u", "documents_", "(_", "documents_", ",_", "cls_", "._", "default", "\\u", "ws_", ",_", "pad", "\\u", "right_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "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_", "\\u", "ngram", "\\u", "freq", "dist_", "(_", "words_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Freq", "Dist_", "(_", "tuple_", "(_", "words_", "[_", "i_", ":_", "i_", "+_", "n_", "]_", ")_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "words_", ")_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "appl", "y", "\\u", "filter_", "(_", "self_", ",_", "fn_", "=_", "lambda_", "ngram_", ",_", "freq_", ":_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gene", "ric", " ", "filter", " ", "remove", "s", " ", "ngram", "s", " ", "from", " ", "the", " ", "freque", "nc", "y", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "function", " ", "return", "s", " ", "Tru", "e", " ", "whe", "n", " ", "pass", "ed", " ", "an", " ", "ngram", " ", "tuple", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "ngram_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ngram_", ",_", "freq_", "in_", "iteritems_", "(_", "self_", "._", "ngram", "\\u", "fd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "fn_", "(_", "ngram_", ",_", "freq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "ngram_", "[_", "ngram_", "]_", "=_", "freq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ngram", "\\u", "fd_", "=_", "tmp", "\\u", "ngram_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "freq", "\\u", "filter_", "(_", "self_", ",_", "min", "\\u", "freq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "candidate", " ", "ngram", "s", " ", "whi", "ch", " ", "have", " ", "freque", "nc", "y", " ", "less", " ", "than", " ", "min", "\\u", "freq", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "\\u", "filter_", "(_", "lambda_", "ng_", ",_", "freq_", ":_", "freq_", "<_", "min", "\\u", "freq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "ngram", "\\u", "filter_", "(_", "self_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "candidate", " ", "ngram", "s", " ", "(", "w", "1", ",", " ", "w2", ",", " ", "...)", " ", "where", " ", "fn", "(", "w", "1", ",", " ", "w2", ",", " ", "...)", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "s", " ", "to", " ", "Tru", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "\\u", "filter_", "(_", "lambda_", "ng_", ",_", "f_", ":_", "fn_", "(_", "*_", "ng_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "word", "\\u", "filter_", "(_", "self_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "candidate", " ", "ngram", "s", " ", "(", "w", "1", ",", " ", "w2", ",", " ", "...)", " ", "where", " ", "any", " ", "of", " ", "(", "fn", "(", "w", "1", "),", " ", "fn", "(", "w2", "),", "\\", "10", ";", " ", " ", " ", " ", "...)", " ", "evaluate", "s", " ", "to", " ", "Tru", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "appl", "y", "\\u", "filter_", "(_", "lambda_", "ng_", ",_", "f_", ":_", "any_", "(_", "fn_", "(_", "w_", ")_", "for_", "w_", "in_", "ng_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "score", "\\u", "ngrams_", "(_", "self_", ",_", "score", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", "s", " ", "of", " ", "(", "ngram", ",", " ", "score", ")", " ", "pair", "s", " ", "as", " ", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "scor", "ing", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "provided", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tup_", "in_", "self_", "._", "ngram", "\\u", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score_", "=_", "self_", "._", "score", "\\u", "ngram_", "(_", "score", "\\u", "fn_", ",_", "*_", "tup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "score_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "tup_", ",_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "score", "\\u", "ngrams_", "(_", "self_", ",_", "score", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "sequence", " ", "of", " ", "(", "ngram", ",", " ", "score", ")", " ", "pair", "s", " ", "order", "ed", " ", "from", " ", "high", "est", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "lowe", "st", " ", "score", ",", " ", "as", " ", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "scor", "ing", " ", "function", " ", "provided", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sorted_", "(_", "self_", "._", "\\u", "score", "\\u", "ngrams_", "(_", "score", "\\u", "fn_", ")_", ",_", "key_", "=_", "lambda_", "t_", ":_", "(_", "-_", "t_", "[_", "1_", "]_", ",_", "t_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "nbe", "st_", "(_", "self_", ",_", "score", "\\u", "fn_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "top", " ", "n", " ", "ngram", "s", " ", "whe", "n", " ", "scored", " ", "by", " ", "the", " ", "give", "n", " ", "function", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "p_", "for_", "p_", ",_", "s_", "in_", "self_", "._", "score", "\\u", "ngrams_", "(_", "score", "\\u", "fn_", ")_", "[_", ":_", "n_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Coll", "ocation", "Finder_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "above", "\\u", "score_", "(_", "self_", ",_", "score", "\\u", "fn_", ",_", "min", "\\u", "score_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "sequence", " ", "of", " ", "ngram", "s", ",", " ", "order", "ed", " ", "by", " ", "decre", "asin", "g", " ", "score", ",", " ", "who", "se", "\\", "10", ";", " ", " ", " ", " ", "score", "s", " ", "each", " ", "exceed", " ", "the", " ", "give", "n", " ", "minim", "um", " ", "score", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ngram_", ",_", "score_", "in_", "self_", "._", "score", "\\u", "ngrams_", "(_", "score", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "score_", ">_", "min", "\\u", "score_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "ngram_", "\\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 ", " _", "break_", "\\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_", "class_", "Big", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "tool", " ", "for", " ", "the", " ", "finding", " ", "and", " ", "ranking", " ", "of", " ", "bigram", " ", "coll", "ocation", "s", " ", "or", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "associ", "ation", " ", "measure", "s", ".", " ", "It", " ", "is", " ", "oft", "en", " ", "usef", "ul", " ", "to", " ", "use", " ", "from", "\\u", "words", "()", " ", "rat", "her", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "constructi", "ng", " ", "an", " ", "instance", " ", "direct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "ws_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Big", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "bigram", "\\u", "fd_", ",_", "window", "\\u", "size_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "Big", "ram", "Coll", "ocation", "Fin", "der", ",", " ", "give", "n", " ", "Freq", "Dist", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "appearance", "s", " ", "of", " ", "words", " ", "and", " ", "(", "possib", "ly", " ", "non", "-", "contiguous", ")", " ", "bigram", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Abstract", "Coll", "ocation", "Finder_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "bigram", "\\u", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window", "\\u", "size_", "=_", "window", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Big", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "words_", "(_", "cls_", ",_", "words_", ",_", "window", "\\u", "size_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "Big", "ram", "Coll", "ocation", "Fin", "der", " ", "for", " ", "all", " ", "bigram", "s", " ", "in", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "sequence", ".", " ", " ", "Whe", "n", " ", "window", "\\u", "size", " ", ">", " ", "2", ",", " ", "count", " ", "non", "-", "contiguous", " ", "bigram", "s", ",", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "style", " ", "of", " ", "Chu", "rch", " ", "and", " ", "Han", "ks", "'", "s", " ", "(", "1990", ")", " ", "associ", "ation", " ", "ratio", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "d_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf", "d_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "window", "\\u", "size_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Speci", "fy", " ", "window", "\\u", "size", " ", "at", " ", "leas", "t", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "window_", "in_", "ngrams_", "(_", "words_", ",_", "window", "\\u", "size_", ",_", "pad", "\\u", "right_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w1_", "=_", "window_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w1_", "is_", "None_", ":_", "\\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_", "wf", "d_", "[_", "w1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "w2_", "in_", "window_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "w2_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bf", "d_", "[_", "(_", "w1_", ",_", "w2_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "wf", "d_", ",_", "bf", "d_", ",_", "window", "\\u", "size_", "=_", "window", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Big", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "score", "\\u", "ngram_", "(_", "self_", ",_", "score", "\\u", "fn_", ",_", "w1_", ",_", "w2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "score", " ", "for", " ", "a", " ", "give", "n", " ", "bigram", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "scor", "ing", "\\", "10", ";", " ", " ", " ", " ", "function", ".", " ", " ", "Follow", "ing", " ", "Chu", "rch", " ", "and", " ", "Han", "ks", " ", "(", "1990", "),", " ", "count", "s", " ", "are", " ", "scale", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "factor", " ", "of", " ", "1", "/(", "window", "\\u", "size", " ", "-", " ", "1", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "all_", "=_", "self_", "._", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ii_", "=_", "self_", "._", "ngram", "\\u", "fd_", "[_", "(_", "w1_", ",_", "w2_", ")_", "]_", "/_", "(_", "self_", "._", "window", "\\u", "size_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "n", "\\u", "ii_", ":_", "\\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_", "n", "\\u", "ix_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "score", "\\u", "fn_", "(_", "n", "\\u", "ii_", ",_", "(_", "n", "\\u", "ix_", ",_", "n", "\\u", "xi_", ")_", ",_", "n", "\\u", "all_", ")_", "\\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_", "Trig", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "tool", " ", "for", " ", "the", " ", "finding", " ", "and", " ", "ranking", " ", "of", " ", "trig", "ram", " ", "coll", "ocation", "s", " ", "or", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "associ", "ation", " ", "measure", "s", ".", " ", "It", " ", "is", " ", "oft", "en", " ", "usef", "ul", " ", "to", " ", "use", " ", "from", "\\u", "words", "()", " ", "rat", "her", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "constructi", "ng", " ", "an", " ", "instance", " ", "direct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "ws_", "=_", "3_", "\\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_", "Trig", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "bigram", "\\u", "fd_", ",_", "wild", "card", "\\u", "fd_", ",_", "trig", "ram", "\\u", "fd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "Trig", "ram", "Coll", "ocation", "Fin", "der", ",", " ", "give", "n", " ", "Freq", "Dist", "s", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "appearance", "s", " ", "of", " ", "words", ",", " ", "bigram", "s", ",", " ", "two", " ", "words", " ", "with", " ", "any", " ", "word", " ", "bet", "ween", " ", "them", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "trig", "rams", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Abstract", "Coll", "ocation", "Finder_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "trig", "ram", "\\u", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wild", "card", "\\u", "fd_", "=_", "wild", "card", "\\u", "fd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bigram", "\\u", "fd_", "=_", "bigram", "\\u", "fd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trig", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "words_", "(_", "cls_", ",_", "words_", ",_", "window", "\\u", "size_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "Trig", "ram", "Coll", "ocation", "Fin", "der", " ", "for", " ", "all", " ", "trig", "rams", " ", "in", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "sequence", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "window", "\\u", "size_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Speci", "fy", " ", "window", "\\u", "size", " ", "at", " ", "leas", "t", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wf", "d_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wild", "fd_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bf", "d_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "d_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "window_", "in_", "ngrams_", "(_", "words_", ",_", "window", "\\u", "size_", ",_", "pad", "\\u", "right_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w1_", "=_", "window_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w1_", "is_", "None_", ":_", "\\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_", "for_", "w2_", ",_", "w3", "_", "in_", "\\u", "itertools_", "._", "combinations_", "(_", "window_", "[_", "1_", ":_", "]_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wf", "d_", "[_", "w1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w2_", "is_", "None_", ":_", "\\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_", "bf", "d_", "[_", "(_", "w1_", ",_", "w2_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w3", "_", "is_", "None_", ":_", "\\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_", "wild", "fd_", "[_", "(_", "w1_", ",_", "w3", "_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "d_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w3", "_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "wf", "d_", ",_", "bf", "d_", ",_", "wild", "fd_", ",_", "tf", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trig", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bigram", "\\u", "finder_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", "s", " ", "a", " ", "bigram", " ", "coll", "ocation", " ", "finde", "r", " ", "with", " ", "the", " ", "bigram", " ", "and", " ", "unig", "ram", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "from", " ", "this", " ", "finde", "r", ".", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "doe", "s", " ", "not", " ", "include", " ", "any", " ", "filtering", "\\", "10", ";", " ", " ", " ", " ", "applied", " ", "to", " ", "this", " ", "finde", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Big", "ram", "Coll", "ocation", "Finder_", "(_", "self_", "._", "word", "\\u", "fd_", ",_", "self_", "._", "bigram", "\\u", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Trig", "ram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "score", "\\u", "ngram_", "(_", "self_", ",_", "score", "\\u", "fn_", ",_", "w1_", ",_", "w2_", ",_", "w3", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "score", " ", "for", " ", "a", " ", "give", "n", " ", "trig", "ram", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "scor", "ing", "\\", "10", ";", " ", " ", " ", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "all_", "=_", "self_", "._", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "iii", "_", "=_", "self_", "._", "ngram", "\\u", "fd_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w3", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "n", "\\u", "iii", "_", ":_", "\\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_", "n", "\\u", "ii", "x_", "=_", "self_", "._", "bigram", "\\u", "fd_", "[_", "(_", "w1_", ",_", "w2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ix", "i_", "=_", "self_", "._", "wild", "card", "\\u", "fd_", "[_", "(_", "w1_", ",_", "w3", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi", "i_", "=_", "self_", "._", "bigram", "\\u", "fd_", "[_", "(_", "w2_", ",_", "w3", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ix", "x_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi", "x_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xx", "i_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w3", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "score", "\\u", "fn_", "(_", "n", "\\u", "iii", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n", "\\u", "ii", "x_", ",_", "n", "\\u", "ix", "i_", ",_", "n", "\\u", "xi", "i_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n", "\\u", "ix", "x_", ",_", "n", "\\u", "xi", "x_", ",_", "n", "\\u", "xx", "i_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "all_", ")_", "\\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_", "Quad", "gram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "tool", " ", "for", " ", "the", " ", "finding", " ", "and", " ", "ranking", " ", "of", " ", "quad", "gram", " ", "coll", "ocation", "s", " ", "or", " ", "other", " ", "associ", "ation", " ", "measure", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "oft", "en", " ", "usef", "ul", " ", "to", " ", "use", " ", "from", "\\u", "words", "()", " ", "rat", "her", " ", "than", " ", "constructi", "ng", " ", "an", " ", "instance", " ", "direct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "ws_", "=_", "4_", "\\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_", "Quad", "gram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "quad", "gram", "\\u", "fd_", ",_", "ii_", ",_", "iii", "_", ",_", "ix", "i_", ",_", "ix", "xi_", ",_", "ii", "xi_", ",_", "ix", "ii_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "a", " ", "Quad", "gram", "Coll", "ocation", "Fin", "der", ",", " ", "give", "n", " ", "Freq", "Dist", "s", " ", "for", " ", "appearance", "s", " ", "of", " ", "words", ",", "\\", "10", ";", " ", " ", " ", " ", "bigram", "s", ",", " ", "trig", "rams", ",", " ", "two", " ", "words", " ", "with", " ", "one", " ", "word", " ", "and", " ", "two", " ", "words", " ", "bet", "ween", " ", "them", ",", " ", "three", " ", "words", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "a", " ", "word", " ", "bet", "ween", " ", "them", " ", "in", " ", "bot", "h", " ", "variations", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Abstract", "Coll", "ocation", "Finder_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "word", "\\u", "fd_", ",_", "quad", "gram", "\\u", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "iii", "_", "=_", "iii", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ii_", "=_", "ii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ix", "i_", "=_", "ix", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ix", "xi_", "=_", "ix", "xi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ii", "xi_", "=_", "ii", "xi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ix", "ii_", "=_", "ix", "ii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quad", "gram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "words_", "(_", "cls_", ",_", "words_", ",_", "window", "\\u", "size_", "=_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "window", "\\u", "size_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Speci", "fy", " ", "window", "\\u", "size", " ", "at", " ", "leas", "t", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ix", "xx_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iii", "i_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iii", "_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "i_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "xi_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii", "xi_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "ii_", "=_", "Freq", "Dist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "window_", "in_", "ngrams_", "(_", "words_", ",_", "window", "\\u", "size_", ",_", "pad", "\\u", "right_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w1_", "=_", "window_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w1_", "is_", "None_", ":_", "\\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_", "for_", "w2_", ",_", "w3", "_", ",_", "w", "4_", "in_", "\\u", "itertools_", "._", "combinations_", "(_", "window_", "[_", "1_", ":_", "]_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix", "xx_", "[_", "w1_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w2_", "is_", "None_", ":_", "\\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_", "ii_", "[_", "(_", "w1_", ",_", "w2_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w3", "_", "is_", "None_", ":_", "\\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_", "iii", "_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w3", "_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "i_", "[_", "(_", "w1_", ",_", "w3", "_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "w", "4_", "is_", "None_", ":_", "\\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_", "iii", "i_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w3", "_", ",_", "w", "4_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "xi_", "[_", "(_", "w1_", ",_", "w", "4_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix", "ii_", "[_", "(_", "w1_", ",_", "w3", "_", ",_", "w", "4_", ")_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii", "xi_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w", "4_", ")_", "]_", "+=_", "1_", "\\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_", "cls_", "(_", "ix", "xx_", ",_", "iii", "i_", ",_", "ii_", ",_", "iii", "_", ",_", "ix", "i_", ",_", "ix", "xi_", ",_", "ii", "xi_", ",_", "ix", "ii_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quad", "gram", "Coll", "ocation", "Finder_", "(_", "Abstract", "Coll", "ocation", "Finder_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "score", "\\u", "ngram_", "(_", "self_", ",_", "score", "\\u", "fn_", ",_", "w1_", ",_", "w2_", ",_", "w3", "_", ",_", "w", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "\\u", "all_", "=_", "self_", "._", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "iii", "i_", "=_", "self_", "._", "ngram", "\\u", "fd_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w3", "_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "n", "\\u", "iii", "i_", ":_", "\\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_", "n", "\\u", "iii", "x_", "=_", "self_", "._", "iii", "_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w3", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi", "ii_", "=_", "self_", "._", "iii", "_", "[_", "(_", "w2_", ",_", "w3", "_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ii", "xi_", "=_", "self_", "._", "ii", "xi_", "[_", "(_", "w1_", ",_", "w2_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ix", "ii_", "=_", "self_", "._", "ix", "ii_", "[_", "(_", "w1_", ",_", "w3", "_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "ii", "xx_", "=_", "self_", "._", "ii_", "[_", "(_", "w1_", ",_", "w2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xx", "ii_", "=_", "self_", "._", "ii_", "[_", "(_", "w3", "_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi", "ix_", "=_", "self_", "._", "ii_", "[_", "(_", "w2_", ",_", "w3", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ix", "ix_", "=_", "self_", "._", "ix", "i_", "[_", "(_", "w1_", ",_", "w3", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "ix", "xi_", "=_", "self_", "._", "ix", "xi_", "[_", "(_", "w1_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi", "xi_", "=_", "self_", "._", "ix", "i_", "[_", "(_", "w2_", ",_", "w", "4_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "ix", "xx_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xi", "xx_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xx", "ix_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w3", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "xxx", "i_", "=_", "self_", "._", "word", "\\u", "fd_", "[_", "w", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "score", "\\u", "fn_", "(_", "n", "\\u", "iii", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n", "\\u", "iii", "x_", ",_", "n", "\\u", "ii", "xi_", ",_", "n", "\\u", "ix", "ii_", ",_", "n", "\\u", "xi", "ii_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n", "\\u", "ii", "xx_", ",_", "n", "\\u", "ix", "ix_", ",_", "n", "\\u", "ix", "xi_", ",_", "n", "\\u", "xi", "xi_", ",_", "n", "\\u", "xx", "ii_", ",_", "n", "\\u", "xi", "ix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n", "\\u", "ix", "xx_", ",_", "n", "\\u", "xi", "xx_", ",_", "n", "\\u", "xx", "ix_", ",_", "n", "\\u", "xxx", "i_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "all_", ")_", "\\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_", "demo_", "(_", "scorer", "_", "=_", "None_", ",_", "compare", "\\u", "scorer", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "ds", " ", "bigram", " ", "coll", "ocation", "s", " ", "in", " ", "the", " ", "files", " ", "of", " ", "the", " ", "Web", "Text", " ", "corp", "us", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "metrics_", "import_", "Big", "ram", "Assoc", "Measure", "s_", ",_", "spear", "man", "\\u", "correlation_", ",_", "ranks", "\\u", "from", "\\u", "scores_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "scorer", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scorer", "_", "=_", "Big", "ram", "Assoc", "Measure", "s_", "._", "likelihood", "\\u", "ratio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compare", "\\u", "scorer", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compare", "\\u", "scorer", "_", "=_", "Big", "ram", "Assoc", "Measure", "s_", "._", "raw", "\\u", "freq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "nltk_", "._", "corpus_", "import_", "stopwords_", ",_", "web", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "d\\u", "words_", "=_", "stopwords_", "._", "words_", "(_", "'", "english", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "\\u", "filter_", "=_", "lambda_", "w_", ":_", "len_", "(_", "w_", ")_", "<_", "3_", "or_", "w_", "._", "lower_", "(_", ")_", "in_", "ignore", "d\\u", "words_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "file_", "in_", "web", "text_", "._", "fileid", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "words_", "=_", "[_", "word_", "._", "lower_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "word_", "in_", "web", "text_", "._", "words_", "(_", "file_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "=_", "Big", "ram", "Coll", "ocation", "Finder_", "._", "from", "\\u", "words_", "(_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "appl", "y", "\\u", "freq", "\\u", "filter_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "appl", "y", "\\u", "word", "\\u", "filter_", "(_", "word", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "corr_", "=_", "spear", "man", "\\u", "correlation_", "(_", "ranks", "\\u", "from", "\\u", "scores_", "(_", "cf_", "._", "score", "\\u", "ngrams_", "(_", "scorer", "_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ranks", "\\u", "from", "\\u", "scores_", "(_", "cf_", "._", "score", "\\u", "ngrams_", "(_", "compare", "\\u", "scorer", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "t", "'_", ",_", "[_", "'", " ", "'_", "._", "join_", "(_", "tup_", ")_", "for_", "tup_", "in_", "cf_", "._", "nbe", "st_", "(_", "scorer", "_", ",_", "15_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "t", " ", "Correla", "tion", " ", "to", " ", "%", "s", ":", " ", "%", "0.", "4f", "'_", "%_", "(_", "compare", "\\u", "scorer", "_", "._", "\\u\\u", "name\\u\\u_", ",_", "corr_", ")_", ")_", "\\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,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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 ]
Unnecessary pass
STIXProject/python-stix/stix/bindings/ttp.py
[ { "content": " def exportAttributes(self, lwrite, level, already_processed, namespace_='ttp:', name_='ExploitTargetsType'):\n super(ExploitTargetsType, self).exportAttributes(lwrite, level, already_processed, namespace_, name_)\n pass", "metadata": "root.ExploitTargetsType.exportAttributes", "header": "['class', 'ExploitTargetsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 1519 }, { "content": " def buildAttributes(self, node, attrs, already_processed):\n super(ExploitTargetsType, self).buildAttributes(node, attrs, already_processed)\n pass", "metadata": "root.ExploitTargetsType.buildAttributes", "header": "['class', 'ExploitTargetsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 1536 } ]
[ { "span": "pass", "start_line": 1521, "start_column": 8, "end_line": 1521, "end_column": 12 }, { "span": "pass", "start_line": 1538, "start_column": 8, "end_line": 1538, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Explo", "it", "Target", "s", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Attributes_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "alr", "ead", "y", "\\u", "processed_", ",_", "namespace\\u_", "=_", "'", "ttp", ":'_", ",_", "name\\u_", "=_", "'", "Explo", "it", "Target", "s", "Type", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Explo", "it", "Target", "s", "Type_", ",_", "self_", ")_", "._", "export", "Attributes_", "(_", "lw", "rite_", ",_", "level_", ",_", "alr", "ead", "y", "\\u", "processed_", ",_", "namespace\\u_", ",_", "name\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Explo", "it", "Target", "s", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "Attributes_", "(_", "self_", ",_", "node_", ",_", "attrs_", ",_", "alr", "ead", "y", "\\u", "processed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Explo", "it", "Target", "s", "Type_", ",_", "self_", ")_", "._", "build", "Attributes_", "(_", "node_", ",_", "attrs_", ",_", "alr", "ead", "y", "\\u", "processed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\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, 0, 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, 0, 2 ]
Unused local variable
openstack/oslo.concurrency/oslo_concurrency/tests/unit/test_lockutils.py
[ { "content": " def test_contextlock_unlocks(self):\n lock_dir = tempfile.mkdtemp()\n self.config(lock_path=lock_dir, group='oslo_concurrency')\n\n sem = None\n\n try:\n with lockutils.lock(\"test\") as sem:\n if six.PY2:\n self.assertTrue(isinstance(sem, threading._Semaphore))\n else:\n self.assertTrue(isinstance(sem, threading.Semaphore))\n\n with lockutils.lock(\"test2\", external=True) as lock:\n self.assertTrue(lock.exists())\n\n # NOTE(flaper87): Lock should be free\n with lockutils.lock(\"test2\", external=True) as lock:\n self.assertTrue(lock.exists())\n\n # NOTE(flaper87): Lock should be free\n # but semaphore should already exist.\n with lockutils.lock(\"test\") as sem2:\n self.assertEqual(sem, sem2)\n finally:\n if os.path.exists(lock_dir):\n shutil.rmtree(lock_dir, ignore_errors=True)", "metadata": "root.LockTestCase.test_contextlock_unlocks", "header": "['class', 'LockTestCase', '(', 'test_base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 269 } ]
[ { "span": "sem ", "start_line": 273, "start_column": 8, "end_line": 273, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Lock", "Test", "Case_", "(_", "test\\u", "base_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "context", "lock", "\\u", "unlock", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "dir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "(_", "lock", "\\u", "path_", "=_", "lock", "\\u", "dir_", ",_", "group_", "=_", "'", "oslo", "\\u", "concurrency", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sem_", "=_", "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 ", " _", "with_", "lock", "utils_", "._", "lock_", "(_", "\"", "test", "\"_", ")_", "as_", "sem_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "sem_", ",_", "threading_", "._", "\\u", "Semaphore", "_", ")_", ")_", "\\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_", "._", "assert", "True_", "(_", "isinstance_", "(_", "sem_", ",_", "threading_", "._", "Semaphore", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "lock", "utils_", "._", "lock_", "(_", "\"", "test", "2", "\"_", ",_", "external_", "=_", "True_", ")_", "as_", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "lock_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "fla", "per", "87", "):", " ", "Lock", " ", "shou", "ld", " ", "be", " ", "free_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "lock", "utils_", "._", "lock_", "(_", "\"", "test", "2", "\"_", ",_", "external_", "=_", "True_", ")_", "as_", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "lock_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "fla", "per", "87", "):", " ", "Lock", " ", "shou", "ld", " ", "be", " ", "free_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "semaphore", " ", "shou", "ld", " ", "alr", "ead", "y", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "lock", "utils_", "._", "lock_", "(_", "\"", "test", "\"_", ")_", "as_", "sem", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "sem_", ",_", "sem", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "lock", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "lock", "\\u", "dir_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
scipy/scipy/doc/source/scipyoptdoc.py
[ { "content": "\"\"\"\n===========\nscipyoptdoc\n===========\n\nProper docstrings for scipy.optimize.minimize et al.\n\nUsage::\n\n .. scipy-optimize:function:: scipy.optimize.minimize\n :impl: scipy.optimize.optimize._minimize_nelder_mead\n :method: Nelder-Mead\n\nProduces output similar to autodoc, except\n\n- The docstring is obtained from the 'impl' function\n- The call signature is mangled so that the default values for method keyword\n and options dict are substituted\n- 'Parameters' section is replaced by 'Options' section\n- See Also link to the actual function documentation is inserted\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n\nimport os, sys, re, pydoc\nimport sphinx\nimport inspect\nimport collections\nimport textwrap\n\nif sphinx.__version__ < '1.0.1':\n raise RuntimeError(\"Sphinx 1.0.1 or newer is required\")\n\nfrom numpydoc.numpydoc import mangle_docstrings\nfrom docutils.parsers.rst import Directive\nfrom docutils.statemachine import ViewList\nfrom sphinx.domains.python import PythonDomain\n\n\nif sys.version_info[0] >= 3:\n sixu = lambda s: s\nelse:\n sixu = lambda s: unicode(s, 'unicode_escape')\n\n\n\n\n\n\n\n\n\n\nBLURB = \"\"\"\n.. seealso:: For documentation for the rest of the parameters, see `%s`\n\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup(app):\n app.add_domain(ScipyOptimizeInterfaceDomain)", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def _option_required_str(x):\n if not x:\n raise ValueError(\"value is required\")\n return str(x)", "metadata": "root._option_required_str", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def _import_object(name):\n parts = name.split('.')\n module_name = '.'.join(parts[:-1])\n __import__(module_name)\n obj = getattr(sys.modules[module_name], parts[-1])\n return obj", "metadata": "root._import_object", "header": "['module', '___EOS___']", "index": 55 }, { "content": "class ScipyOptimizeInterfaceDomain(PythonDomain):\n name = 'scipy-optimize'\n", "metadata": "root.ScipyOptimizeInterfaceDomain", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def __init__(self, *a, **kw):\n super(ScipyOptimizeInterfaceDomain, self).__init__(*a, **kw)\n self.directives = dict(self.directives)\n self.directives['function'] = wrap_mangling_directive(self.directives['function'])", "metadata": "root.ScipyOptimizeInterfaceDomain.__init__", "header": "['class', 'ScipyOptimizeInterfaceDomain', '(', 'PythonDomain', ')', ':', '___EOS___']", "index": 66 }, { "content": "def wrap_mangling_directive(base_directive):\n class directive(base_directive):\n def run(self):\n env = self.state.document.settings.env\n\n # Interface function\n name = self.arguments[0].strip()\n obj = _import_object(name)\n args, varargs, keywords, defaults = inspect.getargspec(obj)\n\n # Implementation function\n impl_name = self.options['impl']\n impl_obj = _import_object(impl_name)\n impl_args, impl_varargs, impl_keywords, impl_defaults = inspect.getargspec(impl_obj)\n\n # Format signature taking implementation into account\n args = list(args)\n defaults = list(defaults)\n\n def set_default(arg, value):\n j = args.index(arg)\n defaults[len(defaults) - (len(args) - j)] = value\n\n def remove_arg(arg):\n if arg not in args:\n return\n j = args.index(arg)\n if j < len(args) - len(defaults):\n del args[j]\n else:\n del defaults[len(defaults) - (len(args) - j)]\n del args[j]\n\n options = []\n for j, opt_name in enumerate(impl_args):\n if opt_name in args:\n continue\n if j >= len(impl_args) - len(impl_defaults):\n options.append((opt_name, impl_defaults[len(impl_defaults) - (len(impl_args) - j)]))\n else:\n options.append((opt_name, None))\n set_default('options', dict(options))\n set_default('method', self.options['method'].strip())\n\n for arg in list(args):\n if arg not in impl_args and arg not in ('fun', 'x0', 'args', 'tol',\n 'callback', 'method', 'options'):\n remove_arg(arg)\n\n signature = inspect.formatargspec(args, varargs, keywords, defaults)\n\n # Produce output\n self.options['noindex'] = True\n self.arguments[0] = name + signature\n lines = textwrap.dedent(pydoc.getdoc(impl_obj)).splitlines()\n new_lines = []\n for line in lines:\n if line.strip() == 'Options':\n new_lines.append(\"Other Parameters\")\n elif line.strip() == \"-\"*len('Options'):\n new_lines.append(\"-\"*len(\"Other Parameters\"))\n else:\n new_lines.append(line)\n mangle_docstrings(env.app, 'function', name, None, None, new_lines)\n lines = new_lines\n new_lines = []\n for line in lines:\n if line.strip() == ':Other Parameters:':\n new_lines.extend((BLURB % (name,)).splitlines())\n new_lines.append(':Options:')\n else:\n new_lines.append(line)\n self.content = ViewList(new_lines, self.content.parent)\n return base_directive.run(self)\n\n option_spec = dict(base_directive.option_spec)\n option_spec['impl'] = _option_required_str\n option_spec['method'] = _option_required_str\n\n return directive", "metadata": "root.wrap_mangling_directive", "header": "['module', '___EOS___']", "index": 76 } ]
[ { "span": "import os, sys, re, pydoc", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 25 }, { "span": "import collections", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 18 }, { "span": "from docutils.parsers.rst import Directive", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "=========", "==", "\\", "10", ";", "sci", "pyo", "pt", "doc", "\\", "10", ";", "=========", "==", "\\", "10", ";", "\\", "10", ";", "Proper", " ", "docstrings", " ", "for", " ", "sci", "py", ".", "optimize", ".", "minimize", " ", "et", " ", "al", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "sci", "py", "-", "optimize", ":", "function", "::", " ", "sci", "py", ".", "optimize", ".", "minimize", "\\", "10", ";", " ", " ", " ", ":", "impl", ":", " ", "sci", "py", ".", "optimize", ".", "optimize", ".\\u", "minimize", "\\u", "nel", "der", "\\u", "mea", "d", "\\", "10", ";", " ", " ", " ", ":", "method", ":", " ", "Ne", "lder", "-", "Mea", "d", "\\", "10", ";", "\\", "10", ";", "Produce", "s", " ", "output", " ", "similar", " ", "to", " ", "autod", "oc", ",", " ", "except", "\\", "10", ";", "\\", "10", ";", "-", " ", "The", " ", "docstr", "ing", " ", "is", " ", "obtain", "ed", " ", "from", " ", "the", " ", "'", "impl", "'", " ", "function", "\\", "10", ";", "-", " ", "The", " ", "call", " ", "signa", "ture", " ", "is", " ", "mangle", "d", " ", "so", " ", "tha", "t", " ", "the", " ", "default", " ", "values", " ", "for", " ", "method", " ", "keyw", "ord", "\\", "10", ";", " ", " ", "and", " ", "options", " ", "dict", " ", "are", " ", "substitute", "d", "\\", "10", ";", "-", " ", "'", "Parameter", "s", "'", " ", "section", " ", "is", " ", "replaced", " ", "by", " ", "'", "Optio", "ns", "'", " ", "section", "\\", "10", ";", "-", " ", "See", " ", "Al", "so", " ", "link", " ", "to", " ", "the", " ", "actual", " ", "function", " ", "documentation", " ", "is", " ", "inserted", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", ",_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "re_", ",_", "pydo", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sphinx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sphinx_", "._", "\\u\\u", "version\\u\\u_", "<_", "'", "1.0", ".1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Sph", "inx", " ", "1.0", ".1", " ", "or", " ", "newe", "r", " ", "is", " ", "require", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "nump", "ydo", "c_", "._", "nump", "ydo", "c_", "import_", "mangle", "\\u", "docstrings", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "._", "parsers_", "._", "rst_", "import_", "Directive", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "._", "statem", "achi", "ne_", "import_", "View", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sphinx_", "._", "domains_", "._", "python_", "import_", "Pyth", "on", "Domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "si", "xu", "_", "=_", "lambda_", "s_", ":_", "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 ", " _", "si", "xu", "_", "=_", "lambda_", "s_", ":_", "unicode_", "(_", "s_", ",_", "'", "unicode", "\\u", "escape", "'_", ")_", "\\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_", "BL", "UR", "B_", "=_", "\"\"\"", "\\", "10", ";", "..", " ", "see", "als", "o", "::", " ", "For", " ", "documentation", " ", "for", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "parameter", "s", ",", " ", "see", " ", "`", "%", "s", "`", "\\", "10", ";\"\"\"_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "add", "\\u", "domain_", "(_", "Sci", "py", "Optimize", "Interface", "Domain_", ")_", "\\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", "option", "\\u", "require", "d\\u", "str_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "value", " ", "is", " ", "require", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "x_", ")_", "\\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", "import", "\\u", "object_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "name_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "name_", "=_", "'.'_", "._", "join_", "(_", "parts_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "import\\u\\u_", "(_", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "getattr_", "(_", "sys_", "._", "modules_", "[_", "module", "\\u", "name_", "]_", ",_", "parts_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\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_", "Sci", "py", "Optimize", "Interface", "Domain_", "(_", "Pyth", "on", "Domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "sci", "py", "-", "optimize", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sci", "py", "Optimize", "Interface", "Domain_", "(_", "Pyth", "on", "Domain_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "a_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Sci", "py", "Optimize", "Interface", "Domain_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "a_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "directives_", "=_", "dict_", "(_", "self_", "._", "directives_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "directives_", "[_", "'", "function", "'_", "]_", "=_", "wrap", "\\u", "mang", "ling", "\\u", "directive_", "(_", "self_", "._", "directives_", "[_", "'", "function", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "wrap", "\\u", "mang", "ling", "\\u", "directive_", "(_", "base", "\\u", "directive_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "directive_", "(_", "base", "\\u", "directive_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "self_", "._", "state_", "._", "document_", "._", "settings_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Interface", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "arguments_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "\\u", "import", "\\u", "object_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", ",_", "varargs", "_", ",_", "keywords_", ",_", "defaults_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Implementation", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "impl", "\\u", "name_", "=_", "self_", "._", "options_", "[_", "'", "impl", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "impl", "\\u", "obj_", "=_", "\\u", "import", "\\u", "object_", "(_", "impl", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "impl", "\\u", "args_", ",_", "impl", "\\u", "varargs", "_", ",_", "impl", "\\u", "keywords_", ",_", "impl", "\\u", "defaults_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "impl", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Format", " ", "signa", "ture", " ", "tak", "ing", " ", "implementation", " ", "int", "o", " ", "account_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defaults_", "=_", "list_", "(_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "default_", "(_", "arg_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "args_", "._", "index_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defaults_", "[_", "len_", "(_", "defaults_", ")_", "-_", "(_", "len_", "(_", "args_", ")_", "-_", "j_", ")_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "arg_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "not_", "in_", "args_", ":_", "\\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_", "j_", "=_", "args_", "._", "index_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "j_", "<_", "len_", "(_", "args_", ")_", "-_", "len_", "(_", "defaults_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "args_", "[_", "j_", "]_", "\\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 ", " ", "_", "del_", "defaults_", "[_", "len_", "(_", "defaults_", ")_", "-_", "(_", "len_", "(_", "args_", ")_", "-_", "j_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "args_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", ",_", "opt", "\\u", "name_", "in_", "enumerate_", "(_", "impl", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt", "\\u", "name_", "in_", "args_", ":_", "\\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_", "if_", "j_", ">=_", "len_", "(_", "impl", "\\u", "args_", ")_", "-_", "len_", "(_", "impl", "\\u", "defaults_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "options_", "._", "append_", "(_", "(_", "opt", "\\u", "name_", ",_", "impl", "\\u", "defaults_", "[_", "len_", "(_", "impl", "\\u", "defaults_", ")_", "-_", "(_", "len_", "(_", "impl", "\\u", "args_", ")_", "-_", "j_", ")_", "]_", ")_", ")_", "\\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 ", " ", "_", "options_", "._", "append_", "(_", "(_", "opt", "\\u", "name_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "default_", "(_", "'", "options", "'_", ",_", "dict_", "(_", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "default_", "(_", "'", "method", "'_", ",_", "self_", "._", "options_", "[_", "'", "method", "'_", "]_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "arg_", "in_", "list_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "not_", "in_", "impl", "\\u", "args_", "and_", "arg_", "not_", "in_", "(_", "'", "fun", "'_", ",_", "'", "x0", "'_", ",_", "'", "args", "'_", ",_", "'", "tol", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ",_", "'", "method", "'_", ",_", "'", "options", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "remove", "\\u", "arg_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signature_", "=_", "inspect_", "._", "format", "argspec_", "(_", "args_", ",_", "varargs", "_", ",_", "keywords_", ",_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Produce", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "options_", "[_", "'", "noin", "dex", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "arguments_", "[_", "0_", "]_", "=_", "name_", "+_", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "textwrap_", "._", "dedent_", "(_", "pydo", "c_", "._", "getd", "oc_", "(_", "impl", "\\u", "obj_", ")_", ")_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "strip_", "(_", ")_", "==_", "'", "Optio", "ns", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "lines_", "._", "append_", "(_", "\"", "Ot", "her", " ", "Parameter", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "strip_", "(_", ")_", "==_", "\"-\"_", "*_", "len_", "(_", "'", "Optio", "ns", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "lines_", "._", "append_", "(_", "\"-\"_", "*_", "len_", "(_", "\"", "Ot", "her", " ", "Parameter", "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 ", " ", "_", "new", "\\u", "lines_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mangle", "\\u", "docstrings", "_", "(_", "env_", "._", "app_", ",_", "'", "function", "'_", ",_", "name_", ",_", "None_", ",_", "None_", ",_", "new", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "new", "\\u", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "strip_", "(_", ")_", "==_", "':", "Ot", "her", " ", "Parameter", "s", ":'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "lines_", "._", "extend_", "(_", "(_", "BL", "UR", "B_", "%_", "(_", "name_", ",_", ")_", ")_", "._", "splitlines_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "lines_", "._", "append_", "(_", "':", "Optio", "ns", ":'_", ")_", "\\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 ", " ", "_", "new", "\\u", "lines_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "content_", "=_", "View", "List_", "(_", "new", "\\u", "lines_", ",_", "self_", "._", "content_", "._", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "base", "\\u", "directive_", "._", "run_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "option", "\\u", "spec_", "=_", "dict_", "(_", "base", "\\u", "directive_", "._", "option", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "spec_", "[_", "'", "impl", "'_", "]_", "=_", "\\u", "option", "\\u", "require", "d\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "spec_", "[_", "'", "method", "'_", "]_", "=_", "\\u", "option", "\\u", "require", "d\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "directive_" ]
[ 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,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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
ContinuumIO/ashiba/enaml/enaml/web/drop_down.py
[ { "content": "\nfrom atom.api import Unicode, List, Dict\n\nfrom enaml.core.declarative import d_\n\nfrom html_object import HTMLObject\nfrom lxml.html import builder as E\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Dropdown(HTMLObject):\n\n tag = E.SELECT\n text = d_(Unicode())\n id = d_(Unicode())\n options = d_(Dict())\n\n", "metadata": "root.Dropdown", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def initialize(self):\n super(Dropdown, self).initialize()", "metadata": "root.Dropdown.initialize", "header": "['class', 'Dropdown', '(', 'HTMLObject', ')', ':', '___EOS___']", "index": 15 }, { "content": " def buildHTML(self, *args):\n for key, value in self.options.iteritems():\n self.addTags(E.OPTION(value, value = key))\n self.addText(self.text)\n if self.id:\n self.addAttributes(id = self.id)\n\n return super(Dropdown, self).buildHTML(*args)", "metadata": "root.Dropdown.buildHTML", "header": "['class', 'Dropdown', '(', 'HTMLObject', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "from atom.api import Unicode, List, Dict", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "atom_", "._", "api_", "import_", "Unicode_", ",_", "List_", ",_", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ena", "ml_", "._", "core_", "._", "declarative", "_", "import_", "d\\u", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "html", "\\u", "object_", "import_", "HTM", "LO", "bject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "._", "html_", "import_", "builder_", "as_", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Drop", "down_", "(_", "HTM", "LO", "bject_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "E_", "._", "SELECT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "d\\u", "_", "(_", "Unicode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "d\\u", "_", "(_", "Unicode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "d\\u", "_", "(_", "Dict_", "(_", ")_", ")_", "\\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_", "Drop", "down_", "(_", "HTM", "LO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Drop", "down_", ",_", "self_", ")_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Drop", "down_", "(_", "HTM", "LO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "HTML_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "self_", "._", "options_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Tags_", "(_", "E_", "._", "OPTION", "_", "(_", "value_", ",_", "value_", "=_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "Text_", "(_", "self_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "Attributes_", "(_", "id_", "=_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Drop", "down_", ",_", "self_", ")_", "._", "build", "HTML_", "(_", "*_", "args_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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 ]
Unused import
iskandr/parakeet/test/algorithms/test_harris_corner.py
[ { "content": "import numpy as np\nimport time \n\nimport parakeet \nfrom parakeet.testing_helpers import expect_each, run_local_tests\n\n\nsize = (5,5)\nfloat_mat = np.random.uniform(0,1,size=size)\nint_mat = np.random.random_integers(0,255,size=size)\n\nmatrices = [float_mat, int_mat]\n\n\n\n\n\n \nif __name__ == '__main__':\n run_local_tests()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def harris(I):\n m,n = I.shape \n dx = (I[1:, :] - I[:m-1, :])[:, 1:]\n dy = (I[:, 1:] - I[:, :n-1])[1:, :]\n #\n # At each point we build a matrix\n # of derivative products\n # M =\n # | A = dx^2 C = dx * dy |\n # | C = dy * dx B = dy * dy |\n #\n # and the score at that point is:\n # det(M) - k*trace(M)^2\n #\n A = dx * dx\n B = dy * dy\n C = dx * dy\n tr = A + B\n det = A * B - C * C\n k = 0.05\n return det - k * tr * tr", "metadata": "root.harris", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def test_harris():\n expect_each(harris, harris, matrices)", "metadata": "root.test_harris", "header": "['module', '___EOS___']", "index": 36 } ]
[ { "span": "import time ", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 11 }, { "span": "import parakeet ", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "para", "ke", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "para", "ke", "et_", "._", "testi", "ng", "\\u", "helpers_", "import_", "expect", "\\u", "each_", ",_", "run", "\\u", "local", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "float", "\\u", "mat_", "=_", "np_", "._", "random_", "._", "uniform_", "(_", "0_", ",_", "1_", ",_", "size_", "=_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "mat_", "=_", "np_", "._", "random_", "._", "random", "\\u", "integers_", "(_", "0_", ",_", "255_", ",_", "size_", "=_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "matrices_", "=_", "[_", "float", "\\u", "mat_", ",_", "int\\u", "mat_", "]_", "\\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\\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 ", " _", "run", "\\u", "local", "\\u", "tests_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "har", "ris_", "(_", "I_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "I_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dx_", "=_", "(_", "I_", "[_", "1_", ":_", ",_", ":_", "]_", "-_", "I_", "[_", ":_", "m_", "-_", "1_", ",_", ":_", "]_", ")_", "[_", ":_", ",_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "(_", "I_", "[_", ":_", ",_", "1_", ":_", "]_", "-_", "I_", "[_", ":_", ",_", ":_", "n_", "-_", "1_", "]_", ")_", "[_", "1_", ":_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "At", " ", "each", " ", "point", " ", "we", " ", "build", " ", "a", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "of", " ", "deriv", "ative", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "M", " ", "=_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "|", " ", "A", " ", "=", " ", "dx", "^", "2", " ", "C", " ", "=", " ", "dx", " ", "*", " ", "dy", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "|", " ", "C", " ", "=", " ", "dy", " ", "*", " ", "dx", " ", " ", "B", " ", "=", " ", "dy", " ", "*", " ", "dy", " ", "|_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "and", " ", "the", " ", "score", " ", "at", " ", "tha", "t", " ", "point", " ", "is", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "det", "(", "M", ")", " ", "-", " ", "k", "*", "trace", "(", "M", ")", "^", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "=_", "dx_", "*_", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "=_", "dy_", "*_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "C_", "=_", "dx_", "*_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "=_", "A_", "+_", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "det_", "=_", "A_", "*_", "B_", "-_", "C_", "*_", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "det_", "-_", "k_", "*_", "tr_", "*_", "tr_", "\\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_", "test\\u", "har", "ris_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expect", "\\u", "each_", "(_", "har", "ris_", ",_", "har", "ris_", ",_", "matrices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Suspicious unused loop iteration variable
GrahamDumpleton/wrapt/src/wrapt/wrappers.py
[ { "content": "def resolve_path(module, name):\n if isinstance(module, string_types):\n __import__(module)\n module = sys.modules[module]\n\n parent = module\n\n path = name.split('.')\n attribute = path[0]\n\n original = getattr(parent, attribute)\n for attribute in path[1:]:\n parent = original\n\n # We can't just always use getattr() because in doing\n # that on a class it will cause binding to occur which\n # will complicate things later and cause some things not\n # to work. For the case of a class we therefore access\n # the __dict__ directly. To cope though with the wrong\n # class being given to us, or a method being moved into\n # a base class, we need to walk the class heirarchy to\n # work out exactly which __dict__ the method was defined\n # in, as accessing it from __dict__ will fail if it was\n # not actually on the class given. Fallback to using\n # getattr() if we can't find it. If it truly doesn't\n # exist, then that will fail.\n\n if inspect.isclass(original):\n for cls in inspect.getmro(original):\n if attribute in vars(original):\n original = vars(original)[attribute]\n break\n else:\n original = getattr(original, attribute)\n\n else:\n original = getattr(original, attribute)\n\n return (parent, attribute, original)", "metadata": "root.resolve_path", "header": "['module', '___EOS___']", "index": 684 } ]
[ { "span": "for cls in inspect.getmro(original):", "start_line": 712, "start_column": 12, "end_line": 712, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "path_", "(_", "module_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "module_", ",_", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "import\\u\\u_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "sys_", "._", "modules_", "[_", "module_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent_", "=_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "name_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attribute_", "=_", "path_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "original_", "=_", "getattr_", "(_", "parent_", ",_", "attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attribute_", "in_", "path_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "just", " ", "alw", "ay", "s", " ", "use", " ", "getattr", "()", " ", "bec", "aus", "e", " ", "in", " ", "doi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "on", " ", "a", " ", "class", " ", "it", " ", "will", " ", "caus", "e", " ", "bindi", "ng", " ", "to", " ", "occur", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "compli", "cate", " ", "thing", "s", " ", "late", "r", " ", "and", " ", "caus", "e", " ", "some", " ", "thing", "s", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "work", ".", " ", "For", " ", "the", " ", "case", " ", "of", " ", "a", " ", "class", " ", "we", " ", "there", "fore", " ", "access_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "\\u\\u", "dict", "\\u\\u", " ", "direct", "ly", ".", " ", "To", " ", "cope", " ", "tho", "ugh", " ", "with", " ", "the", " ", "wrong", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "bei", "ng", " ", "give", "n", " ", "to", " ", "us", ",", " ", "or", " ", "a", " ", "method", " ", "bei", "ng", " ", "moved", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "base", " ", "class", ",", " ", "we", " ", "need", " ", "to", " ", "walk", " ", "the", " ", "class", " ", "hei", "rar", "chy", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "work", " ", "out", " ", "exact", "ly", " ", "whi", "ch", " ", "\\u\\u", "dict", "\\u\\u", " ", "the", " ", "method", " ", "was", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", ",", " ", "as", " ", "accessi", "ng", " ", "it", " ", "from", " ", "\\u\\u", "dict", "\\u\\u", " ", "will", " ", "fail", " ", "if", " ", "it", " ", "was", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "actual", "ly", " ", "on", " ", "the", " ", "class", " ", "give", "n", ".", " ", "Fallback", " ", "to", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "getattr", "()", " ", "if", " ", "we", " ", "can", "'", "t", " ", "find", " ", "it", ".", " ", "If", " ", "it", " ", "tru", "ly", " ", "doe", "sn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", ",", " ", "then", " ", "tha", "t", " ", "will", " ", "fail", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "inspect_", "._", "iscl", "ass_", "(_", "original_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cls_", "in_", "inspect_", "._", "getm", "ro_", "(_", "original_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attribute_", "in_", "vars_", "(_", "original_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "original_", "=_", "vars_", "(_", "original_", ")_", "[_", "attribute_", "]_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "original_", "=_", "getattr_", "(_", "original_", ",_", "attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "original_", "=_", "getattr_", "(_", "original_", ",_", "attribute_", ")_", "\\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_", "(_", "parent_", ",_", "attribute_", ",_", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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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 ]
Unused local variable
SmartTeleMax/iktomi/iktomi/unstable/db/sqla/replication.py
[ { "content": "def replicate_attributes(source, target, cache=None):\n '''Replicates common SQLAlchemy attributes from the `source` object to the\n `target` object.'''\n target_manager = manager_of_class(type(target))\n column_attrs = set()\n relationship_attrs = set()\n relationship_columns = set()\n for attr in manager_of_class(type(source)).attributes:\n if attr.key not in target_manager:\n # It's not common attribute\n continue\n target_attr = target_manager[attr.key]\n if isinstance(attr.property, ColumnProperty):\n assert isinstance(target_attr.property, ColumnProperty)\n column_attrs.add(attr)\n elif isinstance(attr.property, RelationshipProperty):\n assert isinstance(target_attr.property, RelationshipProperty)\n relationship_attrs.add(attr)\n if attr.property.direction is MANYTOONE:\n relationship_columns.update(attr.property.local_columns)\n for attr in column_attrs:\n if _column_property_in_registry(attr.property, _excluded):\n continue\n elif (not _column_property_in_registry(attr.property, _included) and\n all(column in relationship_columns\n for column in attr.property.columns)):\n continue\n setattr(target, attr.key, getattr(source, attr.key))\n for attr in relationship_attrs:\n target_attr_model = target_manager[attr.key].property.argument\n if not is_relation_replicatable(attr):\n continue\n replicate_relation(source, target, attr, target_manager[attr.key],\n cache=cache)", "metadata": "root.replicate_attributes", "header": "['module', '___EOS___']", "index": 137 } ]
[ { "span": "target_attr_model ", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 25 } ]
[]
1
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_", "replicate", "\\u", "attributes_", "(_", "source_", ",_", "target_", ",_", "cache_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replica", "tes", " ", "common", " ", "SQL", "Al", "chem", "y", " ", "attribute", "s", " ", "from", " ", "the", " ", "`", "source", "`", " ", "object", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "`", "target", "`", " ", "object", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "manager_", "=_", "manage", "r", "\\u", "of", "\\u", "class_", "(_", "type_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "attrs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "ship", "\\u", "attrs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "ship", "\\u", "columns_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "manage", "r", "\\u", "of", "\\u", "class_", "(_", "type_", "(_", "source_", ")_", ")_", "._", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr_", "._", "key_", "not_", "in_", "target", "\\u", "manager_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "not", " ", "common", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "attr_", "=_", "target", "\\u", "manager_", "[_", "attr_", "._", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "attr_", "._", "property_", ",_", "Colum", "n", "Property_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "target", "\\u", "attr_", "._", "property_", ",_", "Colum", "n", "Property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "attrs_", "._", "add_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "attr_", "._", "property_", ",_", "Relationship", "Property_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "target", "\\u", "attr_", "._", "property_", ",_", "Relationship", "Property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "ship", "\\u", "attrs_", "._", "add_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attr_", "._", "property_", "._", "direction_", "is_", "MAN", "YT", "OO", "NE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relation", "ship", "\\u", "columns_", "._", "update_", "(_", "attr_", "._", "property_", "._", "local", "\\u", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "attr_", "in_", "column", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "column", "\\u", "property", "\\u", "in", "\\u", "registry_", "(_", "attr_", "._", "property_", ",_", "\\u", "excluded_", ")_", ":_", "\\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_", "elif_", "(_", "not_", "\\u", "column", "\\u", "property", "\\u", "in", "\\u", "registry_", "(_", "attr_", "._", "property_", ",_", "\\u", "included_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "all_", "(_", "column_", "in_", "relation", "ship", "\\u", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "column_", "in_", "attr_", "._", "property_", "._", "columns_", ")_", ")_", ":_", "\\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_", "setattr_", "(_", "target_", ",_", "attr_", "._", "key_", ",_", "getattr_", "(_", "source_", ",_", "attr_", "._", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "attr_", "in_", "relation", "ship", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "attr", "\\u", "model_", "=_", "target", "\\u", "manager_", "[_", "attr_", "._", "key_", "]_", "._", "property_", "._", "argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "relation", "\\u", "replica", "table_", "(_", "attr_", ")_", ":_", "\\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_", "replicate", "\\u", "relation_", "(_", "source_", ",_", "target_", ",_", "attr_", ",_", "target", "\\u", "manager_", "[_", "attr_", "._", "key_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "cache_", ")_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
datastax/python-driver/cassandra/protocol.py
[ { "content": "# Copyright 2013-2016 DataStax, 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\nfrom __future__ import absolute_import # to enable import io from stdlib\nfrom collections import namedtuple\nimport logging\nimport socket\nfrom uuid import UUID\n\nimport six\nfrom six.moves import range\nimport io\n\nfrom cassandra import type_codes, DriverException\nfrom cassandra import (Unavailable, WriteTimeout, ReadTimeout,\n WriteFailure, ReadFailure, FunctionFailure,\n AlreadyExists, InvalidRequest, Unauthorized,\n UnsupportedOperation, UserFunctionDescriptor,\n UserAggregateDescriptor, SchemaTargetType)\nfrom cassandra.marshal import (int32_pack, int32_unpack, uint16_pack, uint16_unpack,\n int8_pack, int8_unpack, uint64_pack, header_pack,\n v3_header_pack)\nfrom cassandra.cqltypes import (AsciiType, BytesType, BooleanType,\n CounterColumnType, DateType, DecimalType,\n DoubleType, FloatType, Int32Type,\n InetAddressType, IntegerType, ListType,\n LongType, MapType, SetType, TimeUUIDType,\n UTF8Type, VarcharType, UUIDType, UserType,\n TupleType, lookup_casstype, SimpleDateType,\n TimeType, ByteType, ShortType)\nfrom cassandra.policies import WriteType\nfrom cassandra.cython_deps import HAVE_CYTHON, HAVE_NUMPY\nfrom cassandra import util\n\nlog = logging.getLogger(__name__)\n\n\n\n\n\nColumnMetadata = namedtuple(\"ColumnMetadata\", ['keyspace_name', 'table_name', 'name', 'type'])\n\nMIN_SUPPORTED_VERSION = 1\nMAX_SUPPORTED_VERSION = 4\n\nHEADER_DIRECTION_TO_CLIENT = 0x80\nHEADER_DIRECTION_MASK = 0x80\n\nCOMPRESSED_FLAG = 0x01\nTRACING_FLAG = 0x02\nCUSTOM_PAYLOAD_FLAG = 0x04\nWARNING_FLAG = 0x08\n\n_message_types_by_opcode = {}\n\n_UNSET_VALUE = object()\n\n\n\n\n\n\n\n\n\n\n\n\nerror_classes = {}\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\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\n\n\n\n\n\n\n\n\n\n\n\n\n# used for QueryMessage and ExecuteMessage\n_VALUES_FLAG = 0x01\n_SKIP_METADATA_FLAG = 0x01\n_PAGE_SIZE_FLAG = 0x04\n_WITH_PAGING_STATE_FLAG = 0x08\n_WITH_SERIAL_CONSISTENCY_FLAG = 0x10\n_PROTOCOL_TIMESTAMP = 0x20\n\n\n\nCUSTOM_TYPE = object()\n\nRESULT_KIND_VOID = 0x0001\nRESULT_KIND_ROWS = 0x0002\nRESULT_KIND_SET_KEYSPACE = 0x0003\nRESULT_KIND_PREPARED = 0x0004\nRESULT_KIND_SCHEMA_CHANGE = 0x0005\n\n\n\n\n\n\n\n\n\nknown_event_types = frozenset((\n 'TOPOLOGY_CHANGE',\n 'STATUS_CHANGE',\n 'SCHEMA_CHANGE'\n))\n\n\n\n\n\n\n\n\n\nif HAVE_CYTHON:\n from cassandra.obj_parser import ListParser, LazyParser\n ProtocolHandler = cython_protocol_handler(ListParser())\n LazyProtocolHandler = cython_protocol_handler(LazyParser())\nelse:\n # Use Python-based ProtocolHandler\n ProtocolHandler = _ProtocolHandler\n LazyProtocolHandler = None\n\n\nif HAVE_CYTHON and HAVE_NUMPY:\n from cassandra.numpy_parser import NumpyParser\n NumpyProtocolHandler = cython_protocol_handler(NumpyParser())\nelse:\n NumpyProtocolHandler = None\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\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\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NotSupportedError(Exception):\n pass", "metadata": "root.NotSupportedError", "header": "['module', '___EOS___']", "index": 48 }, { "content": "class InternalError(Exception):\n pass", "metadata": "root.InternalError", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def register_class(cls):\n _message_types_by_opcode[cls.opcode] = cls", "metadata": "root.register_class", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def get_registered_classes():\n return _message_types_by_opcode.copy()", "metadata": "root.get_registered_classes", "header": "['module', '___EOS___']", "index": 77 }, { "content": "class _RegisterMessageType(type):", "metadata": "root._RegisterMessageType", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def __init__(cls, name, bases, dct):\n if not name.startswith('_'):\n register_class(cls)", "metadata": "root._RegisterMessageType.__init__", "header": "['class', '_RegisterMessageType', '(', 'type', ')', ':', '___EOS___']", "index": 82 }, { "content": "@six.add_metaclass(_RegisterMessageType)\nclass _MessageType(object):\n\n tracing = False\n custom_payload = None\n warnings = None\n\n", "metadata": "root._MessageType", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def update_custom_payload(self, other):\n if other:\n if not self.custom_payload:\n self.custom_payload = {}\n self.custom_payload.update(other)\n if len(self.custom_payload) > 65535:\n raise ValueError(\"Custom payload map exceeds max count allowed by protocol (65535)\")", "metadata": "root._MessageType.update_custom_payload", "header": "['class', '_MessageType', '(', 'object', ')', ':', '___EOS___']", "index": 94 }, { "content": " def __repr__(self):\n return '<%s(%s)>' % (self.__class__.__name__, ', '.join('%s=%r' % i for i in _get_params(self)))", "metadata": "root._MessageType.__repr__", "header": "['class', '_MessageType', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": "def _get_params(message_obj):\n base_attrs = dir(_MessageType)\n return (\n (n, a) for n, a in message_obj.__dict__.items()\n if n not in base_attrs and not n.startswith('_') and not callable(a)\n )", "metadata": "root._get_params", "header": "['module', '___EOS___']", "index": 106 }, { "content": "class ErrorMessage(_MessageType, Exception):\n opcode = 0x00\n name = 'ERROR'\n summary = 'Unknown'\n\n\n\n\n __repr__ = __str__\n\n", "metadata": "root.ErrorMessage", "header": "['module', '___EOS___']", "index": 117 }, { "content": " def __init__(self, code, message, info):\n self.code = code\n self.message = message\n self.info = info", "metadata": "root.ErrorMessage.__init__", "header": "['class', 'ErrorMessage', '(', '_MessageType', ',', 'Exception', ')', ':', '___EOS___']", "index": 122 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n code = read_int(f)\n msg = read_string(f)\n subcls = error_classes.get(code, cls)\n extra_info = subcls.recv_error_info(f)\n return subcls(code=code, message=msg, info=extra_info)", "metadata": "root.ErrorMessage.recv_body", "header": "['class', 'ErrorMessage', '(', '_MessageType', ',', 'Exception', ')', ':', '___EOS___']", "index": 127 }, { "content": " def summary_msg(self):\n msg = 'code=%04x [%s] message=\"%s\"' \\\n % (self.code, self.summary, self.message)\n return msg", "metadata": "root.ErrorMessage.summary_msg", "header": "['class', 'ErrorMessage', '(', '_MessageType', ',', 'Exception', ')', ':', '___EOS___']", "index": 135 }, { "content": " def __str__(self):\n return '<ErrorMessage %s>' % self.summary_msg()", "metadata": "root.ErrorMessage.__str__", "header": "['class', 'ErrorMessage', '(', '_MessageType', ',', 'Exception', ')', ':', '___EOS___']", "index": 140 }, { "content": " @staticmethod\n def recv_error_info(f):\n pass", "metadata": "root.ErrorMessage.recv_error_info", "header": "['class', 'ErrorMessage', '(', '_MessageType', ',', 'Exception', ')', ':', '___EOS___']", "index": 144 }, { "content": " def to_exception(self):\n return self", "metadata": "root.ErrorMessage.to_exception", "header": "['class', 'ErrorMessage', '(', '_MessageType', ',', 'Exception', ')', ':', '___EOS___']", "index": 148 }, { "content": "class ErrorMessageSubclass(_RegisterMessageType):", "metadata": "root.ErrorMessageSubclass", "header": "['module', '___EOS___']", "index": 152 }, { "content": " def __init__(cls, name, bases, dct):\n if cls.error_code is not None: # Server has an error code of 0.\n error_classes[cls.error_code] = cls", "metadata": "root.ErrorMessageSubclass.__init__", "header": "['class', 'ErrorMessageSubclass', '(', '_RegisterMessageType', ')', ':', '___EOS___']", "index": 153 }, { "content": "@six.add_metaclass(ErrorMessageSubclass)\nclass ErrorMessageSub(ErrorMessage):\n error_code = None", "metadata": "root.ErrorMessageSub", "header": "['module', '___EOS___']", "index": 158 }, { "content": "class RequestExecutionException(ErrorMessageSub):\n pass", "metadata": "root.RequestExecutionException", "header": "['module', '___EOS___']", "index": 163 }, { "content": "class RequestValidationException(ErrorMessageSub):\n pass", "metadata": "root.RequestValidationException", "header": "['module', '___EOS___']", "index": 167 }, { "content": "class ServerError(ErrorMessageSub):\n summary = 'Server error'\n error_code = 0x0000", "metadata": "root.ServerError", "header": "['module', '___EOS___']", "index": 171 }, { "content": "class ProtocolException(ErrorMessageSub):\n summary = 'Protocol error'\n error_code = 0x000A", "metadata": "root.ProtocolException", "header": "['module', '___EOS___']", "index": 176 }, { "content": "class BadCredentials(ErrorMessageSub):\n summary = 'Bad credentials'\n error_code = 0x0100", "metadata": "root.BadCredentials", "header": "['module', '___EOS___']", "index": 181 }, { "content": "class UnavailableErrorMessage(RequestExecutionException):\n summary = 'Unavailable exception'\n error_code = 0x1000\n\n", "metadata": "root.UnavailableErrorMessage", "header": "['module', '___EOS___']", "index": 186 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'consistency': read_consistency_level(f),\n 'required_replicas': read_int(f),\n 'alive_replicas': read_int(f),\n }", "metadata": "root.UnavailableErrorMessage.recv_error_info", "header": "['class', 'UnavailableErrorMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 190 }, { "content": " def to_exception(self):\n return Unavailable(self.summary_msg(), **self.info)", "metadata": "root.UnavailableErrorMessage.to_exception", "header": "['class', 'UnavailableErrorMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 198 }, { "content": "class OverloadedErrorMessage(RequestExecutionException):\n summary = 'Coordinator node overloaded'\n error_code = 0x1001", "metadata": "root.OverloadedErrorMessage", "header": "['module', '___EOS___']", "index": 202 }, { "content": "class IsBootstrappingErrorMessage(RequestExecutionException):\n summary = 'Coordinator node is bootstrapping'\n error_code = 0x1002", "metadata": "root.IsBootstrappingErrorMessage", "header": "['module', '___EOS___']", "index": 207 }, { "content": "class TruncateError(RequestExecutionException):\n summary = 'Error during truncate'\n error_code = 0x1003", "metadata": "root.TruncateError", "header": "['module', '___EOS___']", "index": 212 }, { "content": "class WriteTimeoutErrorMessage(RequestExecutionException):\n summary = \"Coordinator node timed out waiting for replica nodes' responses\"\n error_code = 0x1100\n\n", "metadata": "root.WriteTimeoutErrorMessage", "header": "['module', '___EOS___']", "index": 217 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'consistency': read_consistency_level(f),\n 'received_responses': read_int(f),\n 'required_responses': read_int(f),\n 'write_type': WriteType.name_to_value[read_string(f)],\n }", "metadata": "root.WriteTimeoutErrorMessage.recv_error_info", "header": "['class', 'WriteTimeoutErrorMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 221 }, { "content": " def to_exception(self):\n return WriteTimeout(self.summary_msg(), **self.info)", "metadata": "root.WriteTimeoutErrorMessage.to_exception", "header": "['class', 'WriteTimeoutErrorMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 230 }, { "content": "class ReadTimeoutErrorMessage(RequestExecutionException):\n summary = \"Coordinator node timed out waiting for replica nodes' responses\"\n error_code = 0x1200\n\n", "metadata": "root.ReadTimeoutErrorMessage", "header": "['module', '___EOS___']", "index": 234 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'consistency': read_consistency_level(f),\n 'received_responses': read_int(f),\n 'required_responses': read_int(f),\n 'data_retrieved': bool(read_byte(f)),\n }", "metadata": "root.ReadTimeoutErrorMessage.recv_error_info", "header": "['class', 'ReadTimeoutErrorMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 238 }, { "content": " def to_exception(self):\n return ReadTimeout(self.summary_msg(), **self.info)", "metadata": "root.ReadTimeoutErrorMessage.to_exception", "header": "['class', 'ReadTimeoutErrorMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 247 }, { "content": "class ReadFailureMessage(RequestExecutionException):\n summary = \"Replica(s) failed to execute read\"\n error_code = 0x1300\n\n", "metadata": "root.ReadFailureMessage", "header": "['module', '___EOS___']", "index": 251 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'consistency': read_consistency_level(f),\n 'received_responses': read_int(f),\n 'required_responses': read_int(f),\n 'failures': read_int(f),\n 'data_retrieved': bool(read_byte(f)),\n }", "metadata": "root.ReadFailureMessage.recv_error_info", "header": "['class', 'ReadFailureMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 255 }, { "content": " def to_exception(self):\n return ReadFailure(self.summary_msg(), **self.info)", "metadata": "root.ReadFailureMessage.to_exception", "header": "['class', 'ReadFailureMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 265 }, { "content": "class FunctionFailureMessage(RequestExecutionException):\n summary = \"User Defined Function failure\"\n error_code = 0x1400\n\n", "metadata": "root.FunctionFailureMessage", "header": "['module', '___EOS___']", "index": 269 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'keyspace': read_string(f),\n 'function': read_string(f),\n 'arg_types': [read_string(f) for _ in range(read_short(f))],\n }", "metadata": "root.FunctionFailureMessage.recv_error_info", "header": "['class', 'FunctionFailureMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 273 }, { "content": " def to_exception(self):\n return FunctionFailure(self.summary_msg(), **self.info)", "metadata": "root.FunctionFailureMessage.to_exception", "header": "['class', 'FunctionFailureMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 281 }, { "content": "class WriteFailureMessage(RequestExecutionException):\n summary = \"Replica(s) failed to execute write\"\n error_code = 0x1500\n\n", "metadata": "root.WriteFailureMessage", "header": "['module', '___EOS___']", "index": 285 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'consistency': read_consistency_level(f),\n 'received_responses': read_int(f),\n 'required_responses': read_int(f),\n 'failures': read_int(f),\n 'write_type': WriteType.name_to_value[read_string(f)],\n }", "metadata": "root.WriteFailureMessage.recv_error_info", "header": "['class', 'WriteFailureMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 289 }, { "content": " def to_exception(self):\n return WriteFailure(self.summary_msg(), **self.info)", "metadata": "root.WriteFailureMessage.to_exception", "header": "['class', 'WriteFailureMessage', '(', 'RequestExecutionException', ')', ':', '___EOS___']", "index": 299 }, { "content": "class SyntaxException(RequestValidationException):\n summary = 'Syntax error in CQL query'\n error_code = 0x2000", "metadata": "root.SyntaxException", "header": "['module', '___EOS___']", "index": 303 }, { "content": "class UnauthorizedErrorMessage(RequestValidationException):\n summary = 'Unauthorized'\n error_code = 0x2100\n", "metadata": "root.UnauthorizedErrorMessage", "header": "['module', '___EOS___']", "index": 308 }, { "content": " def to_exception(self):\n return Unauthorized(self.summary_msg())", "metadata": "root.UnauthorizedErrorMessage.to_exception", "header": "['class', 'UnauthorizedErrorMessage', '(', 'RequestValidationException', ')', ':', '___EOS___']", "index": 312 }, { "content": "class InvalidRequestException(RequestValidationException):\n summary = 'Invalid query'\n error_code = 0x2200\n", "metadata": "root.InvalidRequestException", "header": "['module', '___EOS___']", "index": 316 }, { "content": " def to_exception(self):\n return InvalidRequest(self.summary_msg())", "metadata": "root.InvalidRequestException.to_exception", "header": "['class', 'InvalidRequestException', '(', 'RequestValidationException', ')', ':', '___EOS___']", "index": 320 }, { "content": "class ConfigurationException(RequestValidationException):\n summary = 'Query invalid because of configuration issue'\n error_code = 0x2300", "metadata": "root.ConfigurationException", "header": "['module', '___EOS___']", "index": 324 }, { "content": "class PreparedQueryNotFound(RequestValidationException):\n summary = 'Matching prepared statement not found on this node'\n error_code = 0x2500\n", "metadata": "root.PreparedQueryNotFound", "header": "['module', '___EOS___']", "index": 329 }, { "content": " @staticmethod\n def recv_error_info(f):\n # return the query ID\n return read_binary_string(f)", "metadata": "root.PreparedQueryNotFound.recv_error_info", "header": "['class', 'PreparedQueryNotFound', '(', 'RequestValidationException', ')', ':', '___EOS___']", "index": 333 }, { "content": "class AlreadyExistsException(ConfigurationException):\n summary = 'Item already exists'\n error_code = 0x2400\n\n", "metadata": "root.AlreadyExistsException", "header": "['module', '___EOS___']", "index": 339 }, { "content": " @staticmethod\n def recv_error_info(f):\n return {\n 'keyspace': read_string(f),\n 'table': read_string(f),\n }", "metadata": "root.AlreadyExistsException.recv_error_info", "header": "['class', 'AlreadyExistsException', '(', 'ConfigurationException', ')', ':', '___EOS___']", "index": 343 }, { "content": " def to_exception(self):\n return AlreadyExists(**self.info)", "metadata": "root.AlreadyExistsException.to_exception", "header": "['class', 'AlreadyExistsException', '(', 'ConfigurationException', ')', ':', '___EOS___']", "index": 350 }, { "content": "class StartupMessage(_MessageType):\n opcode = 0x01\n name = 'STARTUP'\n\n KNOWN_OPTION_KEYS = set((\n 'CQL_VERSION',\n 'COMPRESSION',\n ))\n\n", "metadata": "root.StartupMessage", "header": "['module', '___EOS___']", "index": 354 }, { "content": " def __init__(self, cqlversion, options):\n self.cqlversion = cqlversion\n self.options = options", "metadata": "root.StartupMessage.__init__", "header": "['class', 'StartupMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 363 }, { "content": " def send_body(self, f, protocol_version):\n optmap = self.options.copy()\n optmap['CQL_VERSION'] = self.cqlversion\n write_stringmap(f, optmap)", "metadata": "root.StartupMessage.send_body", "header": "['class', 'StartupMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 367 }, { "content": "class ReadyMessage(_MessageType):\n opcode = 0x02\n name = 'READY'\n", "metadata": "root.ReadyMessage", "header": "['module', '___EOS___']", "index": 373 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n return cls()", "metadata": "root.ReadyMessage.recv_body", "header": "['class', 'ReadyMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 377 }, { "content": "class AuthenticateMessage(_MessageType):\n opcode = 0x03\n name = 'AUTHENTICATE'\n\n", "metadata": "root.AuthenticateMessage", "header": "['module', '___EOS___']", "index": 382 }, { "content": " def __init__(self, authenticator):\n self.authenticator = authenticator", "metadata": "root.AuthenticateMessage.__init__", "header": "['class', 'AuthenticateMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 386 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n authname = read_string(f)\n return cls(authenticator=authname)", "metadata": "root.AuthenticateMessage.recv_body", "header": "['class', 'AuthenticateMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 389 }, { "content": "class CredentialsMessage(_MessageType):\n opcode = 0x04\n name = 'CREDENTIALS'\n\n", "metadata": "root.CredentialsMessage", "header": "['module', '___EOS___']", "index": 395 }, { "content": " def __init__(self, creds):\n self.creds = creds", "metadata": "root.CredentialsMessage.__init__", "header": "['class', 'CredentialsMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 399 }, { "content": " def send_body(self, f, protocol_version):\n if protocol_version > 1:\n raise UnsupportedOperation(\n \"Credentials-based authentication is not supported with \"\n \"protocol version 2 or higher. Use the SASL authentication \"\n \"mechanism instead.\")\n write_short(f, len(self.creds))\n for credkey, credval in self.creds.items():\n write_string(f, credkey)\n write_string(f, credval)", "metadata": "root.CredentialsMessage.send_body", "header": "['class', 'CredentialsMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 402 }, { "content": "class AuthChallengeMessage(_MessageType):\n opcode = 0x0E\n name = 'AUTH_CHALLENGE'\n\n", "metadata": "root.AuthChallengeMessage", "header": "['module', '___EOS___']", "index": 414 }, { "content": " def __init__(self, challenge):\n self.challenge = challenge", "metadata": "root.AuthChallengeMessage.__init__", "header": "['class', 'AuthChallengeMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 418 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n return cls(read_binary_longstring(f))", "metadata": "root.AuthChallengeMessage.recv_body", "header": "['class', 'AuthChallengeMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 421 }, { "content": "class AuthResponseMessage(_MessageType):\n opcode = 0x0F\n name = 'AUTH_RESPONSE'\n\n", "metadata": "root.AuthResponseMessage", "header": "['module', '___EOS___']", "index": 426 }, { "content": " def __init__(self, response):\n self.response = response", "metadata": "root.AuthResponseMessage.__init__", "header": "['class', 'AuthResponseMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 430 }, { "content": " def send_body(self, f, protocol_version):\n write_longstring(f, self.response)", "metadata": "root.AuthResponseMessage.send_body", "header": "['class', 'AuthResponseMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 433 }, { "content": "class AuthSuccessMessage(_MessageType):\n opcode = 0x10\n name = 'AUTH_SUCCESS'\n\n", "metadata": "root.AuthSuccessMessage", "header": "['module', '___EOS___']", "index": 437 }, { "content": " def __init__(self, token):\n self.token = token", "metadata": "root.AuthSuccessMessage.__init__", "header": "['class', 'AuthSuccessMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 441 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n return cls(read_longstring(f))", "metadata": "root.AuthSuccessMessage.recv_body", "header": "['class', 'AuthSuccessMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 444 }, { "content": "class OptionsMessage(_MessageType):\n opcode = 0x05\n name = 'OPTIONS'\n", "metadata": "root.OptionsMessage", "header": "['module', '___EOS___']", "index": 449 }, { "content": " def send_body(self, f, protocol_version):\n pass", "metadata": "root.OptionsMessage.send_body", "header": "['class', 'OptionsMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 453 }, { "content": "class SupportedMessage(_MessageType):\n opcode = 0x06\n name = 'SUPPORTED'\n\n", "metadata": "root.SupportedMessage", "header": "['module', '___EOS___']", "index": 457 }, { "content": " def __init__(self, cql_versions, options):\n self.cql_versions = cql_versions\n self.options = options", "metadata": "root.SupportedMessage.__init__", "header": "['class', 'SupportedMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 461 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n options = read_stringmultimap(f)\n cql_versions = options.pop('CQL_VERSION')\n return cls(cql_versions=cql_versions, options=options)", "metadata": "root.SupportedMessage.recv_body", "header": "['class', 'SupportedMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 465 }, { "content": "class QueryMessage(_MessageType):\n opcode = 0x07\n name = 'QUERY'\n\n", "metadata": "root.QueryMessage", "header": "['module', '___EOS___']", "index": 481 }, { "content": " def __init__(self, query, consistency_level, serial_consistency_level=None,\n fetch_size=None, paging_state=None, timestamp=None):\n self.query = query\n self.consistency_level = consistency_level\n self.serial_consistency_level = serial_consistency_level\n self.fetch_size = fetch_size\n self.paging_state = paging_state\n self.timestamp = timestamp\n self._query_params = None # only used internally. May be set to a list of native-encoded values to have them sent with the request.", "metadata": "root.QueryMessage.__init__", "header": "['class', 'QueryMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 485 }, { "content": " def send_body(self, f, protocol_version):\n write_longstring(f, self.query)\n write_consistency_level(f, self.consistency_level)\n flags = 0x00\n if self._query_params is not None:\n flags |= _VALUES_FLAG # also v2+, but we're only setting params internally right now\n\n if self.serial_consistency_level:\n if protocol_version >= 2:\n flags |= _WITH_SERIAL_CONSISTENCY_FLAG\n else:\n raise UnsupportedOperation(\n \"Serial consistency levels require the use of protocol version \"\n \"2 or higher. Consider setting Cluster.protocol_version to 2 \"\n \"to support serial consistency levels.\")\n\n if self.fetch_size:\n if protocol_version >= 2:\n flags |= _PAGE_SIZE_FLAG\n else:\n raise UnsupportedOperation(\n \"Automatic query paging may only be used with protocol version \"\n \"2 or higher. Consider setting Cluster.protocol_version to 2.\")\n\n if self.paging_state:\n if protocol_version >= 2:\n flags |= _WITH_PAGING_STATE_FLAG\n else:\n raise UnsupportedOperation(\n \"Automatic query paging may only be used with protocol version \"\n \"2 or higher. Consider setting Cluster.protocol_version to 2.\")\n\n if self.timestamp is not None:\n flags |= _PROTOCOL_TIMESTAMP\n\n write_byte(f, flags)\n\n if self._query_params is not None:\n write_short(f, len(self._query_params))\n for param in self._query_params:\n write_value(f, param)\n\n if self.fetch_size:\n write_int(f, self.fetch_size)\n if self.paging_state:\n write_longstring(f, self.paging_state)\n if self.serial_consistency_level:\n write_consistency_level(f, self.serial_consistency_level)\n if self.timestamp is not None:\n write_long(f, self.timestamp)", "metadata": "root.QueryMessage.send_body", "header": "['class', 'QueryMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 495 }, { "content": "class ResultMessage(_MessageType):\n opcode = 0x08\n name = 'RESULT'\n\n kind = None\n results = None\n paging_state = None\n\n # Names match type name in module scope. Most are imported from cassandra.cqltypes (except CUSTOM_TYPE)\n type_codes = _cqltypes_by_code = dict((v, globals()[k]) for k, v in type_codes.__dict__.items() if not k.startswith('_'))\n\n _FLAGS_GLOBAL_TABLES_SPEC = 0x0001\n _HAS_MORE_PAGES_FLAG = 0x0002\n _NO_METADATA_FLAG = 0x0004\n\n\n\n\n\n\n\n\n", "metadata": "root.ResultMessage", "header": "['module', '___EOS___']", "index": 554 }, { "content": " def __init__(self, kind, results, paging_state=None):\n self.kind = kind\n self.results = results\n self.paging_state = paging_state", "metadata": "root.ResultMessage.__init__", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 569 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n kind = read_int(f)\n paging_state = None\n if kind == RESULT_KIND_VOID:\n results = None\n elif kind == RESULT_KIND_ROWS:\n paging_state, results = cls.recv_results_rows(\n f, protocol_version, user_type_map)\n elif kind == RESULT_KIND_SET_KEYSPACE:\n ksname = read_string(f)\n results = ksname\n elif kind == RESULT_KIND_PREPARED:\n results = cls.recv_results_prepared(f, protocol_version, user_type_map)\n elif kind == RESULT_KIND_SCHEMA_CHANGE:\n results = cls.recv_results_schema_change(f, protocol_version)\n else:\n raise DriverException(\"Unknown RESULT kind: %d\" % kind)\n return cls(kind, results, paging_state)", "metadata": "root.ResultMessage.recv_body", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 574 }, { "content": " @classmethod\n def recv_results_rows(cls, f, protocol_version, user_type_map):\n paging_state, column_metadata = cls.recv_results_metadata(f, user_type_map)\n rowcount = read_int(f)\n rows = [cls.recv_row(f, len(column_metadata)) for _ in range(rowcount)]\n colnames = [c[2] for c in column_metadata]\n coltypes = [c[3] for c in column_metadata]\n parsed_rows = [\n tuple(ctype.from_binary(val, protocol_version)\n for ctype, val in zip(coltypes, row))\n for row in rows]\n return (paging_state, (colnames, parsed_rows))", "metadata": "root.ResultMessage.recv_results_rows", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 594 }, { "content": " @classmethod\n def recv_results_prepared(cls, f, protocol_version, user_type_map):\n query_id = read_binary_string(f)\n column_metadata, pk_indexes = cls.recv_prepared_metadata(f, protocol_version, user_type_map)\n return (query_id, column_metadata, pk_indexes)", "metadata": "root.ResultMessage.recv_results_prepared", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 607 }, { "content": " @classmethod\n def recv_results_metadata(cls, f, user_type_map):\n flags = read_int(f)\n glob_tblspec = bool(flags & cls._FLAGS_GLOBAL_TABLES_SPEC)\n colcount = read_int(f)\n\n if flags & cls._HAS_MORE_PAGES_FLAG:\n paging_state = read_binary_longstring(f)\n else:\n paging_state = None\n if glob_tblspec:\n ksname = read_string(f)\n cfname = read_string(f)\n column_metadata = []\n for _ in range(colcount):\n if glob_tblspec:\n colksname = ksname\n colcfname = cfname\n else:\n colksname = read_string(f)\n colcfname = read_string(f)\n colname = read_string(f)\n coltype = cls.read_type(f, user_type_map)\n column_metadata.append((colksname, colcfname, colname, coltype))\n return paging_state, column_metadata", "metadata": "root.ResultMessage.recv_results_metadata", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 613 }, { "content": " @classmethod\n def recv_prepared_metadata(cls, f, protocol_version, user_type_map):\n flags = read_int(f)\n glob_tblspec = bool(flags & cls._FLAGS_GLOBAL_TABLES_SPEC)\n colcount = read_int(f)\n pk_indexes = None\n if protocol_version >= 4:\n num_pk_indexes = read_int(f)\n pk_indexes = [read_short(f) for _ in range(num_pk_indexes)]\n\n if glob_tblspec:\n ksname = read_string(f)\n cfname = read_string(f)\n column_metadata = []\n for _ in range(colcount):\n if glob_tblspec:\n colksname = ksname\n colcfname = cfname\n else:\n colksname = read_string(f)\n colcfname = read_string(f)\n colname = read_string(f)\n coltype = cls.read_type(f, user_type_map)\n column_metadata.append(ColumnMetadata(colksname, colcfname, colname, coltype))\n return column_metadata, pk_indexes", "metadata": "root.ResultMessage.recv_prepared_metadata", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 639 }, { "content": " @classmethod\n def recv_results_schema_change(cls, f, protocol_version):\n return EventMessage.recv_schema_change(f, protocol_version)", "metadata": "root.ResultMessage.recv_results_schema_change", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 665 }, { "content": " @classmethod\n def read_type(cls, f, user_type_map):\n optid = read_short(f)\n try:\n typeclass = cls.type_codes[optid]\n except KeyError:\n raise NotSupportedError(\"Unknown data type code 0x%04x. Have to skip\"\n \" entire result set.\" % (optid,))\n if typeclass in (ListType, SetType):\n subtype = cls.read_type(f, user_type_map)\n typeclass = typeclass.apply_parameters((subtype,))\n elif typeclass == MapType:\n keysubtype = cls.read_type(f, user_type_map)\n valsubtype = cls.read_type(f, user_type_map)\n typeclass = typeclass.apply_parameters((keysubtype, valsubtype))\n elif typeclass == TupleType:\n num_items = read_short(f)\n types = tuple(cls.read_type(f, user_type_map) for _ in range(num_items))\n typeclass = typeclass.apply_parameters(types)\n elif typeclass == UserType:\n ks = read_string(f)\n udt_name = read_string(f)\n num_fields = read_short(f)\n names, types = zip(*((read_string(f), cls.read_type(f, user_type_map))\n for _ in range(num_fields)))\n specialized_type = typeclass.make_udt_class(ks, udt_name, names, types)\n specialized_type.mapped_class = user_type_map.get(ks, {}).get(udt_name)\n typeclass = specialized_type\n elif typeclass == CUSTOM_TYPE:\n classname = read_string(f)\n typeclass = lookup_casstype(classname)\n\n return typeclass", "metadata": "root.ResultMessage.read_type", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 669 }, { "content": " @staticmethod\n def recv_row(f, colcount):\n return [read_value(f) for _ in range(colcount)]", "metadata": "root.ResultMessage.recv_row", "header": "['class', 'ResultMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 703 }, { "content": "class PrepareMessage(_MessageType):\n opcode = 0x09\n name = 'PREPARE'\n\n", "metadata": "root.PrepareMessage", "header": "['module', '___EOS___']", "index": 708 }, { "content": " def __init__(self, query):\n self.query = query", "metadata": "root.PrepareMessage.__init__", "header": "['class', 'PrepareMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 712 }, { "content": " def send_body(self, f, protocol_version):\n write_longstring(f, self.query)", "metadata": "root.PrepareMessage.send_body", "header": "['class', 'PrepareMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 715 }, { "content": "class ExecuteMessage(_MessageType):\n opcode = 0x0A\n name = 'EXECUTE'\n\n", "metadata": "root.ExecuteMessage", "header": "['module', '___EOS___']", "index": 719 }, { "content": " def __init__(self, query_id, query_params, consistency_level,\n serial_consistency_level=None, fetch_size=None,\n paging_state=None, timestamp=None):\n self.query_id = query_id\n self.query_params = query_params\n self.consistency_level = consistency_level\n self.serial_consistency_level = serial_consistency_level\n self.fetch_size = fetch_size\n self.paging_state = paging_state\n self.timestamp = timestamp", "metadata": "root.ExecuteMessage.__init__", "header": "['class', 'ExecuteMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 723 }, { "content": " def send_body(self, f, protocol_version):\n write_string(f, self.query_id)\n if protocol_version == 1:\n if self.serial_consistency_level:\n raise UnsupportedOperation(\n \"Serial consistency levels require the use of protocol version \"\n \"2 or higher. Consider setting Cluster.protocol_version to 2 \"\n \"to support serial consistency levels.\")\n if self.fetch_size or self.paging_state:\n raise UnsupportedOperation(\n \"Automatic query paging may only be used with protocol version \"\n \"2 or higher. Consider setting Cluster.protocol_version to 2.\")\n write_short(f, len(self.query_params))\n for param in self.query_params:\n write_value(f, param)\n write_consistency_level(f, self.consistency_level)\n else:\n write_consistency_level(f, self.consistency_level)\n flags = _VALUES_FLAG\n if self.serial_consistency_level:\n flags |= _WITH_SERIAL_CONSISTENCY_FLAG\n if self.fetch_size:\n flags |= _PAGE_SIZE_FLAG\n if self.paging_state:\n flags |= _WITH_PAGING_STATE_FLAG\n if self.timestamp is not None:\n if protocol_version >= 3:\n flags |= _PROTOCOL_TIMESTAMP\n else:\n raise UnsupportedOperation(\n \"Protocol-level timestamps may only be used with protocol version \"\n \"3 or higher. Consider setting Cluster.protocol_version to 3.\")\n write_byte(f, flags)\n write_short(f, len(self.query_params))\n for param in self.query_params:\n write_value(f, param)\n if self.fetch_size:\n write_int(f, self.fetch_size)\n if self.paging_state:\n write_longstring(f, self.paging_state)\n if self.serial_consistency_level:\n write_consistency_level(f, self.serial_consistency_level)\n if self.timestamp is not None:\n write_long(f, self.timestamp)", "metadata": "root.ExecuteMessage.send_body", "header": "['class', 'ExecuteMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 734 }, { "content": "class BatchMessage(_MessageType):\n opcode = 0x0D\n name = 'BATCH'\n\n", "metadata": "root.BatchMessage", "header": "['module', '___EOS___']", "index": 780 }, { "content": " def __init__(self, batch_type, queries, consistency_level,\n serial_consistency_level=None, timestamp=None):\n self.batch_type = batch_type\n self.queries = queries\n self.consistency_level = consistency_level\n self.serial_consistency_level = serial_consistency_level\n self.timestamp = timestamp", "metadata": "root.BatchMessage.__init__", "header": "['class', 'BatchMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 784 }, { "content": " def send_body(self, f, protocol_version):\n write_byte(f, self.batch_type.value)\n write_short(f, len(self.queries))\n for prepared, string_or_query_id, params in self.queries:\n if not prepared:\n write_byte(f, 0)\n write_longstring(f, string_or_query_id)\n else:\n write_byte(f, 1)\n write_short(f, len(string_or_query_id))\n f.write(string_or_query_id)\n write_short(f, len(params))\n for param in params:\n write_value(f, param)\n\n write_consistency_level(f, self.consistency_level)\n if protocol_version >= 3:\n flags = 0\n if self.serial_consistency_level:\n flags |= _WITH_SERIAL_CONSISTENCY_FLAG\n if self.timestamp is not None:\n flags |= _PROTOCOL_TIMESTAMP\n write_byte(f, flags)\n\n if self.serial_consistency_level:\n write_consistency_level(f, self.serial_consistency_level)\n if self.timestamp is not None:\n write_long(f, self.timestamp)", "metadata": "root.BatchMessage.send_body", "header": "['class', 'BatchMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 792 }, { "content": "class RegisterMessage(_MessageType):\n opcode = 0x0B\n name = 'REGISTER'\n\n", "metadata": "root.RegisterMessage", "header": "['module', '___EOS___']", "index": 829 }, { "content": " def __init__(self, event_list):\n self.event_list = event_list", "metadata": "root.RegisterMessage.__init__", "header": "['class', 'RegisterMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 833 }, { "content": " def send_body(self, f, protocol_version):\n write_stringlist(f, self.event_list)", "metadata": "root.RegisterMessage.send_body", "header": "['class', 'RegisterMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 836 }, { "content": "class EventMessage(_MessageType):\n opcode = 0x0C\n name = 'EVENT'\n\n\n\n\n", "metadata": "root.EventMessage", "header": "['module', '___EOS___']", "index": 840 }, { "content": " def __init__(self, event_type, event_args):\n self.event_type = event_type\n self.event_args = event_args", "metadata": "root.EventMessage.__init__", "header": "['class', 'EventMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 844 }, { "content": " @classmethod\n def recv_body(cls, f, protocol_version, user_type_map):\n event_type = read_string(f).upper()\n if event_type in known_event_types:\n read_method = getattr(cls, 'recv_' + event_type.lower())\n return cls(event_type=event_type, event_args=read_method(f, protocol_version))\n raise NotSupportedError('Unknown event type %r' % event_type)", "metadata": "root.EventMessage.recv_body", "header": "['class', 'EventMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 848 }, { "content": " @classmethod\n def recv_topology_change(cls, f, protocol_version):\n # \"NEW_NODE\" or \"REMOVED_NODE\"\n change_type = read_string(f)\n address = read_inet(f)\n return dict(change_type=change_type, address=address)", "metadata": "root.EventMessage.recv_topology_change", "header": "['class', 'EventMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 856 }, { "content": " @classmethod\n def recv_status_change(cls, f, protocol_version):\n # \"UP\" or \"DOWN\"\n change_type = read_string(f)\n address = read_inet(f)\n return dict(change_type=change_type, address=address)", "metadata": "root.EventMessage.recv_status_change", "header": "['class', 'EventMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 863 }, { "content": " @classmethod\n def recv_schema_change(cls, f, protocol_version):\n # \"CREATED\", \"DROPPED\", or \"UPDATED\"\n change_type = read_string(f)\n if protocol_version >= 3:\n target = read_string(f)\n keyspace = read_string(f)\n event = {'target_type': target, 'change_type': change_type, 'keyspace': keyspace}\n if target != SchemaTargetType.KEYSPACE:\n target_name = read_string(f)\n if target == SchemaTargetType.FUNCTION:\n event['function'] = UserFunctionDescriptor(target_name, [read_string(f) for _ in range(read_short(f))])\n elif target == SchemaTargetType.AGGREGATE:\n event['aggregate'] = UserAggregateDescriptor(target_name, [read_string(f) for _ in range(read_short(f))])\n else:\n event[target.lower()] = target_name\n else:\n keyspace = read_string(f)\n table = read_string(f)\n if table:\n event = {'target_type': SchemaTargetType.TABLE, 'change_type': change_type, 'keyspace': keyspace, 'table': table}\n else:\n event = {'target_type': SchemaTargetType.KEYSPACE, 'change_type': change_type, 'keyspace': keyspace}\n return event", "metadata": "root.EventMessage.recv_schema_change", "header": "['class', 'EventMessage', '(', '_MessageType', ')', ':', '___EOS___']", "index": 870 }, { "content": "class _ProtocolHandler(object):\n \"\"\"\n _ProtocolHander handles encoding and decoding messages.\n\n This class can be specialized to compose Handlers which implement alternative\n result decoding or type deserialization. Class definitions are passed to :class:`cassandra.cluster.Cluster`\n on initialization.\n\n Contracted class methods are :meth:`_ProtocolHandler.encode_message` and :meth:`_ProtocolHandler.decode_message`.\n \"\"\"\n\n message_types_by_opcode = _message_types_by_opcode.copy()\n \"\"\"\n Default mapping of opcode to Message implementation. The default ``decode_message`` implementation uses\n this to instantiate a message and populate using ``recv_body``. This mapping can be updated to inject specialized\n result decoding implementations.\n \"\"\"\n\n\n", "metadata": "root._ProtocolHandler", "header": "['module', '___EOS___']", "index": 896 }, { "content": " @classmethod\n def encode_message(cls, msg, stream_id, protocol_version, compressor):\n \"\"\"\n Encodes a message using the specified frame parameters, and compressor\n\n :param msg: the message, typically of cassandra.protocol._MessageType, generated by the driver\n :param stream_id: protocol stream id for the frame header\n :param protocol_version: version for the frame header, and used encoding contents\n :param compressor: optional compression function to be used on the body\n \"\"\"\n flags = 0\n body = io.BytesIO()\n if msg.custom_payload:\n if protocol_version < 4:\n raise UnsupportedOperation(\"Custom key/value payloads can only be used with protocol version 4 or higher\")\n flags |= CUSTOM_PAYLOAD_FLAG\n write_bytesmap(body, msg.custom_payload)\n msg.send_body(body, protocol_version)\n body = body.getvalue()\n\n if compressor and len(body) > 0:\n body = compressor(body)\n flags |= COMPRESSED_FLAG\n\n if msg.tracing:\n flags |= TRACING_FLAG\n\n buff = io.BytesIO()\n cls._write_header(buff, protocol_version, flags, stream_id, msg.opcode, len(body))\n buff.write(body)\n\n return buff.getvalue()", "metadata": "root._ProtocolHandler.encode_message", "header": "['class', '_ProtocolHandler', '(', 'object', ')', ':', '___EOS___']", "index": 914 }, { "content": " @staticmethod\n def _write_header(f, version, flags, stream_id, opcode, length):\n \"\"\"\n Write a CQL protocol frame header.\n \"\"\"\n pack = v3_header_pack if version >= 3 else header_pack\n f.write(pack(version, flags, stream_id, opcode))\n write_int(f, length)", "metadata": "root._ProtocolHandler._write_header", "header": "['class', '_ProtocolHandler', '(', 'object', ')', ':', '___EOS___']", "index": 947 }, { "content": " @classmethod\n def decode_message(cls, protocol_version, user_type_map, stream_id, flags, opcode, body,\n decompressor):\n \"\"\"\n Decodes a native protocol message body\n\n :param protocol_version: version to use decoding contents\n :param user_type_map: map[keyspace name] = map[type name] = custom type to instantiate when deserializing this type\n :param stream_id: native protocol stream id from the frame header\n :param flags: native protocol flags bitmap from the header\n :param opcode: native protocol opcode from the header\n :param body: frame body\n :param decompressor: optional decompression function to inflate the body\n :return: a message decoded from the body and frame attributes\n \"\"\"\n if flags & COMPRESSED_FLAG:\n if decompressor is None:\n raise RuntimeError(\"No de-compressor available for compressed frame!\")\n body = decompressor(body)\n flags ^= COMPRESSED_FLAG\n\n body = io.BytesIO(body)\n if flags & TRACING_FLAG:\n trace_id = UUID(bytes=body.read(16))\n flags ^= TRACING_FLAG\n else:\n trace_id = None\n\n if flags & WARNING_FLAG:\n warnings = read_stringlist(body)\n flags ^= WARNING_FLAG\n else:\n warnings = None\n\n if flags & CUSTOM_PAYLOAD_FLAG:\n custom_payload = read_bytesmap(body)\n flags ^= CUSTOM_PAYLOAD_FLAG\n else:\n custom_payload = None\n\n if flags:\n log.warning(\"Unknown protocol flags set: %02x. May cause problems.\", flags)\n\n msg_class = cls.message_types_by_opcode[opcode]\n msg = msg_class.recv_body(body, protocol_version, user_type_map)\n msg.stream_id = stream_id\n msg.trace_id = trace_id\n msg.custom_payload = custom_payload\n msg.warnings = warnings\n\n if msg.warnings:\n for w in msg.warnings:\n log.warning(\"Server warning: %s\", w)\n\n return msg", "metadata": "root._ProtocolHandler.decode_message", "header": "['class', '_ProtocolHandler', '(', 'object', ')', ':', '___EOS___']", "index": 956 }, { "content": "def cython_protocol_handler(colparser):\n \"\"\"\n Given a column parser to deserialize ResultMessages, return a suitable\n Cython-based protocol handler.\n\n There are three Cython-based protocol handlers:\n\n - obj_parser.ListParser\n decodes result messages into a list of tuples\n\n - obj_parser.LazyParser\n decodes result messages lazily by returning an iterator\n\n - numpy_parser.NumPyParser\n decodes result messages into NumPy arrays\n\n The default is to use obj_parser.ListParser\n \"\"\"\n from cassandra.row_parser import make_recv_results_rows\n\n class FastResultMessage(ResultMessage):\n \"\"\"\n Cython version of Result Message that has a faster implementation of\n recv_results_row.\n \"\"\"\n # type_codes = ResultMessage.type_codes.copy()\n code_to_type = dict((v, k) for k, v in ResultMessage.type_codes.items())\n recv_results_rows = classmethod(make_recv_results_rows(colparser))\n\n class CythonProtocolHandler(_ProtocolHandler):\n \"\"\"\n Use FastResultMessage to decode query result message messages.\n \"\"\"\n\n my_opcodes = _ProtocolHandler.message_types_by_opcode.copy()\n my_opcodes[FastResultMessage.opcode] = FastResultMessage\n message_types_by_opcode = my_opcodes\n\n col_parser = colparser\n\n return CythonProtocolHandler", "metadata": "root.cython_protocol_handler", "header": "['module', '___EOS___']", "index": 1012 }, { "content": "def read_byte(f):\n return int8_unpack(f.read(1))", "metadata": "root.read_byte", "header": "['module', '___EOS___']", "index": 1072 }, { "content": "def write_byte(f, b):\n f.write(int8_pack(b))", "metadata": "root.write_byte", "header": "['module', '___EOS___']", "index": 1076 }, { "content": "def read_int(f):\n return int32_unpack(f.read(4))", "metadata": "root.read_int", "header": "['module', '___EOS___']", "index": 1080 }, { "content": "def write_int(f, i):\n f.write(int32_pack(i))", "metadata": "root.write_int", "header": "['module', '___EOS___']", "index": 1084 }, { "content": "def write_long(f, i):\n f.write(uint64_pack(i))", "metadata": "root.write_long", "header": "['module', '___EOS___']", "index": 1088 }, { "content": "def read_short(f):\n return uint16_unpack(f.read(2))", "metadata": "root.read_short", "header": "['module', '___EOS___']", "index": 1092 }, { "content": "def write_short(f, s):\n f.write(uint16_pack(s))", "metadata": "root.write_short", "header": "['module', '___EOS___']", "index": 1096 }, { "content": "def read_consistency_level(f):\n return read_short(f)", "metadata": "root.read_consistency_level", "header": "['module', '___EOS___']", "index": 1100 }, { "content": "def write_consistency_level(f, cl):\n write_short(f, cl)", "metadata": "root.write_consistency_level", "header": "['module', '___EOS___']", "index": 1104 }, { "content": "def read_string(f):\n size = read_short(f)\n contents = f.read(size)\n return contents.decode('utf8')", "metadata": "root.read_string", "header": "['module', '___EOS___']", "index": 1108 }, { "content": "def read_binary_string(f):\n size = read_short(f)\n contents = f.read(size)\n return contents", "metadata": "root.read_binary_string", "header": "['module', '___EOS___']", "index": 1114 }, { "content": "def write_string(f, s):\n if isinstance(s, six.text_type):\n s = s.encode('utf8')\n write_short(f, len(s))\n f.write(s)", "metadata": "root.write_string", "header": "['module', '___EOS___']", "index": 1120 }, { "content": "def read_binary_longstring(f):\n size = read_int(f)\n contents = f.read(size)\n return contents", "metadata": "root.read_binary_longstring", "header": "['module', '___EOS___']", "index": 1127 }, { "content": "def read_longstring(f):\n return read_binary_longstring(f).decode('utf8')", "metadata": "root.read_longstring", "header": "['module', '___EOS___']", "index": 1133 }, { "content": "def write_longstring(f, s):\n if isinstance(s, six.text_type):\n s = s.encode('utf8')\n write_int(f, len(s))\n f.write(s)", "metadata": "root.write_longstring", "header": "['module', '___EOS___']", "index": 1137 }, { "content": "def read_stringlist(f):\n numstrs = read_short(f)\n return [read_string(f) for _ in range(numstrs)]", "metadata": "root.read_stringlist", "header": "['module', '___EOS___']", "index": 1144 }, { "content": "def write_stringlist(f, stringlist):\n write_short(f, len(stringlist))\n for s in stringlist:\n write_string(f, s)", "metadata": "root.write_stringlist", "header": "['module', '___EOS___']", "index": 1149 }, { "content": "def read_stringmap(f):\n numpairs = read_short(f)\n strmap = {}\n for _ in range(numpairs):\n k = read_string(f)\n strmap[k] = read_string(f)\n return strmap", "metadata": "root.read_stringmap", "header": "['module', '___EOS___']", "index": 1155 }, { "content": "def write_stringmap(f, strmap):\n write_short(f, len(strmap))\n for k, v in strmap.items():\n write_string(f, k)\n write_string(f, v)", "metadata": "root.write_stringmap", "header": "['module', '___EOS___']", "index": 1164 }, { "content": "def read_bytesmap(f):\n numpairs = read_short(f)\n bytesmap = {}\n for _ in range(numpairs):\n k = read_string(f)\n bytesmap[k] = read_value(f)\n return bytesmap", "metadata": "root.read_bytesmap", "header": "['module', '___EOS___']", "index": 1171 }, { "content": "def write_bytesmap(f, bytesmap):\n write_short(f, len(bytesmap))\n for k, v in bytesmap.items():\n write_string(f, k)\n write_value(f, v)", "metadata": "root.write_bytesmap", "header": "['module', '___EOS___']", "index": 1180 }, { "content": "def read_stringmultimap(f):\n numkeys = read_short(f)\n strmmap = {}\n for _ in range(numkeys):\n k = read_string(f)\n strmmap[k] = read_stringlist(f)\n return strmmap", "metadata": "root.read_stringmultimap", "header": "['module', '___EOS___']", "index": 1187 }, { "content": "def write_stringmultimap(f, strmmap):\n write_short(f, len(strmmap))\n for k, v in strmmap.items():\n write_string(f, k)\n write_stringlist(f, v)", "metadata": "root.write_stringmultimap", "header": "['module', '___EOS___']", "index": 1196 }, { "content": "def read_value(f):\n size = read_int(f)\n if size < 0:\n return None\n return f.read(size)", "metadata": "root.read_value", "header": "['module', '___EOS___']", "index": 1203 }, { "content": "def write_value(f, v):\n if v is None:\n write_int(f, -1)\n elif v is _UNSET_VALUE:\n write_int(f, -2)\n else:\n write_int(f, len(v))\n f.write(v)", "metadata": "root.write_value", "header": "['module', '___EOS___']", "index": 1210 }, { "content": "def read_inet(f):\n size = read_byte(f)\n addrbytes = f.read(size)\n port = read_int(f)\n if size == 4:\n addrfam = socket.AF_INET\n elif size == 16:\n addrfam = socket.AF_INET6\n else:\n raise InternalError(\"bad inet address: %r\" % (addrbytes,))\n return (util.inet_ntop(addrfam, addrbytes), port)", "metadata": "root.read_inet", "header": "['module', '___EOS___']", "index": 1220 }, { "content": "def write_inet(f, addrtuple):\n addr, port = addrtuple\n if ':' in addr:\n addrfam = socket.AF_INET6\n else:\n addrfam = socket.AF_INET\n addrbytes = util.inet_pton(addrfam, addr)\n write_byte(f, len(addrbytes))\n f.write(addrbytes)\n write_int(f, port)", "metadata": "root.write_inet", "header": "['module', '___EOS___']", "index": 1233 } ]
[ { "span": "from cassandra.cqltypes import (AsciiType, BytesType, BooleanType,\n CounterColumnType, DateType, DecimalType,\n DoubleType, FloatType, Int32Type,\n InetAddressType, IntegerType, ListType,\n LongType, MapType, SetType, TimeUUIDType,\n UTF8Type, VarcharType, UUIDType, UserType,\n TupleType, lookup_casstype, SimpleDateType,\n TimeType, ByteType, ShortType)", "start_line": 33, "start_column": 0, "end_line": 40, "end_column": 62 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", "-", "2016", " ", "Data", "Sta", "x", ",", " ", "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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "#", " ", "to", " ", "enable", " ", "import", " ", "io", " ", "from", " ", "stdlib", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "uuid_", "import_", "UUID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cassandra_", "import_", "type", "\\u", "codes_", ",_", "Drive", "r", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "import_", "(_", "Una", "vail", "able_", ",_", "Write", "Timeout_", ",_", "Read", "Timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Write", "Failure_", ",_", "Read", "Failure_", ",_", "Function", "Failure_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Al", "read", "y", "Exists_", ",_", "Inva", "lid", "Request_", ",_", "Unauthorized_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Unsu", "ppo", "rted", "Operation_", ",_", "User", "Function", "Descriptor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "User", "Aggregate", "Descriptor_", ",_", "Schema", "Target", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "._", "marshal_", "import_", "(_", "int", "32", "\\u", "pack_", ",_", "int", "32", "\\u", "unpack_", ",_", "uint", "16", "\\u", "pack_", ",_", "uint", "16", "\\u", "unpack_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int", "8", "\\u", "pack_", ",_", "int", "8", "\\u", "unpack_", ",_", "uint", "64", "\\u", "pack_", ",_", "header", "\\u", "pack_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v", "3", "\\u", "header", "\\u", "pack_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "._", "cql", "types_", "import_", "(_", "Asc", "ii", "Type_", ",_", "Byte", "s", "Type_", ",_", "Boo", "lean", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Counter", "Colum", "n", "Type_", ",_", "Date", "Type_", ",_", "Deci", "mal", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Doub", "le", "Type_", ",_", "Float", "Type_", ",_", "Int", "32", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Inet", "Address", "Type_", ",_", "Integer", "Type_", ",_", "List", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Long", "Type_", ",_", "Map", "Type_", ",_", "Set", "Type_", ",_", "Time", "UU", "ID", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UT", "F8", "Type_", ",_", "Var", "char", "Type_", ",_", "UU", "ID", "Type_", ",_", "User", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tup", "le", "Type_", ",_", "look", "up", "\\u", "cass", "type_", ",_", "Simple", "Date", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Time", "Type_", ",_", "Byte", "Type_", ",_", "Short", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "._", "policies_", "import_", "Write", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "._", "cython", "\\u", "deps_", "import_", "HA", "VE", "\\u", "CY", "THO", "N_", ",_", "HA", "VE", "\\u", "NUMP", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "import_", "util_", "\\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\\uDEDENT\\u\\u\\u_", "Colum", "n", "Metadata_", "=_", "namedtuple_", "(_", "\"", "Colum", "n", "Meta", "data", "\"_", ",_", "[_", "'", "keyspace", "\\u", "name", "'_", ",_", "'", "table", "\\u", "name", "'_", ",_", "'", "name", "'_", ",_", "'", "type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIN", "\\u", "SUPPORTED", "\\u", "VERSION_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "SUPPORTED", "\\u", "VERSION_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HEAD", "ER", "\\u", "DIRECTION", "\\u", "TO", "\\u", "CLIENT_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HEAD", "ER", "\\u", "DIRECTION", "\\u", "MASK_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COMPRESS", "ED", "\\u", "FLAG_", "=_", "0x01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TRA", "CIN", "G", "\\u", "FLAG_", "=_", "0x02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CUSTOM", "\\u", "PAYLOAD", "\\u", "FLAG_", "=_", "0x04_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WARN", "ING", "\\u", "FLAG_", "=_", "0x08_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "UNS", "ET", "\\u", "VALUE_", "=_", "object_", "(_", ")_", "\\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_", "error", "\\u", "classes_", "=_", "{_", "}_", "\\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\\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", "\\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_", "#", " ", "used", " ", "for", " ", "Query", "Messag", "e", " ", "and", " ", "Execut", "e", "Message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "VALU", "ES", "\\u", "FLAG_", "=_", "0x01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "SKIP", "\\u", "METAD", "ATA", "\\u", "FLAG_", "=_", "0x01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PAGE", "\\u", "SIZE", "\\u", "FLAG_", "=_", "0x04_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "WITH", "\\u", "PA", "GING", "\\u", "STATE", "\\u", "FLAG_", "=_", "0x08_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "WITH", "\\u", "SERIAL", "\\u", "CONS", "ISTE", "NCY", "\\u", "FLAG_", "=_", "0x10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PROTOCOL", "\\u", "TIMESTAMP_", "=_", "0x20_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "CUSTOM", "\\u", "TYPE_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RESU", "LT", "\\u", "KIND", "\\u", "VOID", "_", "=_", "0x0001", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RESU", "LT", "\\u", "KIND", "\\u", "ROWS", "_", "=_", "0x000", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RESU", "LT", "\\u", "KIND", "\\u", "SET", "\\u", "KEYS", "PACE", "_", "=_", "0x000", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RESU", "LT", "\\u", "KIND", "\\u", "PREP", "ARE", "D_", "=_", "0x000", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RESU", "LT", "\\u", "KIND", "\\u", "SCHE", "MA", "\\u", "CHANGE", "_", "=_", "0x000", "5_", "\\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\\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_", "know", "n", "\\u", "event", "\\u", "types_", "=_", "frozenset_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TOP", "OLO", "GY", "\\u", "CHANGE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "STATUS", "\\u", "CHANGE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SCHE", "MA", "\\u", "CHANGE", "'_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "HA", "VE", "\\u", "CY", "THO", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "cassandra_", "._", "obj", "\\u", "parser_", "import_", "List", "Parser_", ",_", "La", "zy", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Proto", "col", "Handler_", "=_", "cython", "\\u", "protoc", "ol", "\\u", "handler_", "(_", "List", "Parser_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "La", "zy", "Proto", "col", "Handler_", "=_", "cython", "\\u", "protoc", "ol", "\\u", "handler_", "(_", "La", "zy", "Parser_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "Pyth", "on", "-", "based", " ", "Proto", "col", "Handler_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Proto", "col", "Handler_", "=_", "\\u", "Proto", "col", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "La", "zy", "Proto", "col", "Handler_", "=_", "None_", "\\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_", "HA", "VE", "\\u", "CY", "THO", "N_", "and_", "HA", "VE", "\\u", "NUMP", "Y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "cassandra_", "._", "nump", "y", "\\u", "parser_", "import_", "Num", "py", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Num", "py", "Proto", "col", "Handler_", "=_", "cython", "\\u", "protoc", "ol", "\\u", "handler_", "(_", "Num", "py", "Parser_", "(_", ")_", ")_", "\\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 ", " _", "Num", "py", "Proto", "col", "Handler_", "=_", "None_", "\\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_", "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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_", "Not", "Supp", "orte", "d", "Error_", "(_", "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_", "Intern", "al", "Error_", "(_", "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_", "def_", "register", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "[_", "cls_", "._", "opcode_", "]_", "=_", "cls_", "\\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", "register", "ed", "\\u", "classes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "._", "copy_", "(_", ")_", "\\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_", "\\u", "Register", "Messag", "e", "Type_", "(_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Register", "Messag", "e", "Type_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "dct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "name_", "._", "startswith_", "(_", "'\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "register", "\\u", "class_", "(_", "cls_", ")_", "\\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_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "\\u", "Register", "Messag", "e", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "\\u", "Messag", "e", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tracing", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "payload_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "=_", "None_", "\\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_", "\\u", "Messag", "e", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update", "\\u", "custom", "\\u", "payload_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "other_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "custom", "\\u", "payload_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "custom", "\\u", "payload_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "custom", "\\u", "payload_", "._", "update_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "custom", "\\u", "payload_", ")_", ">_", "65535_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Custom", " ", "payload", " ", "map", " ", "exceed", "s", " ", "max", " ", "count", " ", "allow", "ed", " ", "by", " ", "protoc", "ol", " ", "(", "6553", "5", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Messag", "e", "Type_", "(_", "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_", "\\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 ", " _", "return_", "'<", "%", "s", "(%", "s", ")>", "'_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "',", " ", "'_", "._", "join_", "(_", "'%", "s", "=", "%", "r", "'_", "%_", "i_", "for_", "i_", "in_", "\\u", "get", "\\u", "params_", "(_", "self_", ")_", ")_", ")_", "\\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", "get", "\\u", "params_", "(_", "message", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "attrs_", "=_", "dir_", "(_", "\\u", "Messag", "e", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "n_", ",_", "a_", ")_", "for_", "n_", ",_", "a_", "in_", "message", "\\u", "obj_", "._", "\\u\\u", "dict\\u\\u_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "n_", "not_", "in_", "base", "\\u", "attrs_", "and_", "not_", "n_", "._", "startswith_", "(_", "'\\u'_", ")_", "and_", "not_", "callable_", "(_", "a_", ")_", "\\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_", "class_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "ERROR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "=_", "'", "Un", "know", "n", "'_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u", "repr\\u\\u_", "=_", "\\u\\u", "str\\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_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "code_", ",_", "message_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "code_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subc", "ls_", "=_", "error", "\\u", "classes_", "._", "get_", "(_", "code_", ",_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "info_", "=_", "subc", "ls_", "._", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "subc", "ls_", "(_", "code_", "=_", "code_", ",_", "message_", "=_", "msg_", ",_", "info_", "=_", "extra", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "summar", "y", "\\u", "msg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "code", "=", "%", "04", "x", " ", "[", "%", "s", "]", " ", "message", "=\"", "%", "s", "\"'_", "%_", "(_", "self_", "._", "code_", ",_", "self_", "._", "summary_", ",_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\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 ", " _", "return_", "'<", "Error", "Messag", "e", " ", "%", "s", ">'_", "%_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Message_", "(_", "\\u", "Messag", "e", "Type_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\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_", "Error", "Messag", "e", "Subc", "lass_", "(_", "\\u", "Register", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Messag", "e", "Subc", "lass_", "(_", "\\u", "Register", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "dct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "error", "\\u", "code_", "is_", "not_", "None_", ":_", "#", " ", "Server", " ", "has", " ", "an", " ", "error", " ", "code", " ", "of", " ", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "classes_", "[_", "cls_", "._", "error", "\\u", "code_", "]_", "=_", "cls_", "\\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_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "Error", "Messag", "e", "Subc", "lass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Error", "Messag", "e", "Sub_", "(_", "Error", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "code_", "=_", "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_", "class_", "Request", "Execut", "ion", "Exception_", "(_", "Error", "Messag", "e", "Sub_", ")_", ":_", "\\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_", "Request", "Validat", "ion", "Exception_", "(_", "Error", "Messag", "e", "Sub_", ")_", ":_", "\\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_", "Server", "Error_", "(_", "Error", "Messag", "e", "Sub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Server", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x0000_", "\\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_", "Proto", "col", "Exception_", "(_", "Error", "Messag", "e", "Sub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Proto", "col", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x000", "A_", "\\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_", "Ba", "d", "Credentials_", "(_", "Error", "Messag", "e", "Sub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Ba", "d", " ", "cred", "ential", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x010", "0_", "\\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_", "Una", "vail", "able", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Una", "vail", "able", " ", "exception", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x1000", "_", "\\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_", "Una", "vail", "able", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "consiste", "nc", "y", "'_", ":_", "read", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d\\u", "replica", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alive", "\\u", "replica", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Una", "vail", "able", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Una", "vail", "able_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ",_", "**_", "self_", "._", "info_", ")_", "\\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_", "Over", "load", "ed", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Coordinat", "or", " ", "node", " ", "overload", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x100", "1_", "\\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_", "Is", "Boots", "trap", "ping", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Coordinat", "or", " ", "node", " ", "is", " ", "bootstrapp", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x100", "2_", "\\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_", "Truncate", "Error_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Error", " ", "dur", "ing", " ", "truncat", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x100", "3_", "\\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_", "Write", "Time", "out", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "\"", "Coordinat", "or", " ", "node", " ", "timed", " ", "out", " ", "wait", "ing", " ", "for", " ", "replica", " ", "nodes", "'", " ", "response", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x11", "00_", "\\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_", "Write", "Time", "out", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "consiste", "nc", "y", "'_", ":_", "read", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "receive", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "\\u", "type", "'_", ":_", "Write", "Type_", "._", "name", "\\u", "to", "\\u", "value_", "[_", "read", "\\u", "string_", "(_", "f_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Write", "Time", "out", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Write", "Timeout_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ",_", "**_", "self_", "._", "info_", ")_", "\\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_", "Read", "Time", "out", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "\"", "Coordinat", "or", " ", "node", " ", "timed", " ", "out", " ", "wait", "ing", " ", "for", " ", "replica", " ", "nodes", "'", " ", "response", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x12", "00_", "\\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_", "Read", "Time", "out", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "consiste", "nc", "y", "'_", ":_", "read", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "receive", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data\\u", "retrieved", "'_", ":_", "bool_", "(_", "read", "\\u", "byte_", "(_", "f_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Read", "Time", "out", "Error", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Read", "Timeout_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ",_", "**_", "self_", "._", "info_", ")_", "\\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_", "Read", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "\"", "Replica", "(", "s", ")", " ", "fail", "ed", " ", "to", " ", "execute", " ", "read", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x13", "00_", "\\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_", "Read", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "consiste", "nc", "y", "'_", ":_", "read", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "receive", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fail", "ure", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data\\u", "retrieved", "'_", ":_", "bool_", "(_", "read", "\\u", "byte_", "(_", "f_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Read", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Read", "Failure_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ",_", "**_", "self_", "._", "info_", ")_", "\\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_", "Function", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "\"", "User", " ", "Define", "d", " ", "Function", " ", "fail", "ure", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x14", "00_", "\\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_", "Function", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keyspace", "'_", ":_", "read", "\\u", "string_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "function", "'_", ":_", "read", "\\u", "string_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "arg", "\\u", "types", "'_", ":_", "[_", "read", "\\u", "string_", "(_", "f_", ")_", "for_", "\\u_", "in_", "range_", "(_", "read", "\\u", "short_", "(_", "f_", ")_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Function", "Failure_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ",_", "**_", "self_", "._", "info_", ")_", "\\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_", "Write", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "\"", "Replica", "(", "s", ")", " ", "fail", "ed", " ", "to", " ", "execute", " ", "write", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x15", "00_", "\\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_", "Write", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "consiste", "nc", "y", "'_", ":_", "read", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "receive", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d\\u", "response", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fail", "ure", "s", "'_", ":_", "read", "\\u", "int_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "\\u", "type", "'_", ":_", "Write", "Type_", "._", "name", "\\u", "to", "\\u", "value_", "[_", "read", "\\u", "string_", "(_", "f_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Write", "Fail", "ure", "Message_", "(_", "Request", "Execut", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Write", "Failure_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ",_", "**_", "self_", "._", "info_", ")_", "\\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_", "Syntax", "Exception_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Syntax", " ", "error", " ", "in", " ", "CQ", "L", " ", "query", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x2000", "_", "\\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_", "Una", "uthor", "ize", "d", "Error", "Message_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Una", "uthor", "ize", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x21", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Una", "uthor", "ize", "d", "Error", "Message_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Unauthorized_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ")_", "\\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_", "Inva", "lid", "Request", "Exception_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Inva", "lid", " ", "query", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x22", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Inva", "lid", "Request", "Exception_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Inva", "lid", "Request_", "(_", "self_", "._", "summar", "y", "\\u", "msg_", "(_", ")_", ")_", "\\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_", "Configura", "tion", "Exception_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Query", " ", "invalid", " ", "bec", "aus", "e", " ", "of", " ", "configura", "tion", " ", "issue", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x23", "00_", "\\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_", "Prepare", "d", "Query", "Not", "Found_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Match", "ing", " ", "prepared", " ", "statem", "ent", " ", "not", " ", "found", " ", "on", " ", "this", " ", "node", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x25", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Prepare", "d", "Query", "Not", "Found_", "(_", "Request", "Validat", "ion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "query", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "read", "\\u", "binar", "y", "\\u", "string_", "(_", "f_", ")_", "\\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_", "Al", "read", "y", "Exist", "s", "Exception_", "(_", "Configura", "tion", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "'", "Item", " ", "alr", "ead", "y", " ", "exist", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "code_", "=_", "0x24", "00_", "\\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_", "Al", "read", "y", "Exist", "s", "Exception_", "(_", "Configura", "tion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "error", "\\u", "info_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "keyspace", "'_", ":_", "read", "\\u", "string_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", "'_", ":_", "read", "\\u", "string_", "(_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Exist", "s", "Exception_", "(_", "Configura", "tion", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Al", "read", "y", "Exists_", "(_", "**_", "self_", "._", "info_", ")_", "\\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_", "Start", "up", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "START", "UP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "KNOWN", "\\u", "OPTION", "\\u", "KEYS_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CQ", "L", "\\u", "VERSI", "ON", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "COMPRESS", "ION", "'_", ",_", "\\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_", "Start", "up", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cql", "version_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cql", "version_", "=_", "cql", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "up", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "map_", "=_", "self_", "._", "options_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "map_", "[_", "'", "CQ", "L", "\\u", "VERSI", "ON", "'_", "]_", "=_", "self_", "._", "cql", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "string", "map_", "(_", "f_", ",_", "opt", "map_", ")_", "\\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_", "Read", "y", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "READY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Read", "y", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", ")_", "\\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_", "Auth", "entica", "te", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "AUTH", "ENTI", "CATE", "'_", "\\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_", "Auth", "entica", "te", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "authenticator", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "authenticator", "_", "=_", "authenticator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "entica", "te", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "authenticator", "_", "=_", "auth", "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_", "class_", "Cred", "ential", "s", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x04_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "CREDENTIALS", "'_", "\\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_", "Cred", "ential", "s", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "creds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "creds_", "=_", "creds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cred", "ential", "s", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "protoc", "ol", "\\u", "version_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cred", "ential", "s", "-", "based", " ", "authenticat", "ion", " ", "is", " ", "not", " ", "support", "ed", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "protoc", "ol", " ", "version", " ", "2", " ", "or", " ", "higher", ".", " ", " ", "Us", "e", " ", "the", " ", "SAS", "L", " ", "authenticat", "ion", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mechanism", " ", "inst", "ead", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "self_", "._", "creds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cred", "key_", ",_", "cred", "val_", "in_", "self_", "._", "creds_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "f_", ",_", "cred", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "string_", "(_", "f_", ",_", "cred", "val_", ")_", "\\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_", "Auth", "Chall", "enge", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x0", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "AUTH", "\\u", "CHA", "LLE", "NGE", "'_", "\\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_", "Auth", "Chall", "enge", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "challenge_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "challenge_", "=_", "challenge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Chall", "enge", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "read", "\\u", "binar", "y", "\\u", "long", "string_", "(_", "f_", ")_", ")_", "\\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_", "Auth", "Respons", "e", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x0F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "AUTH", "\\u", "RESPONSE", "'_", "\\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_", "Auth", "Respons", "e", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Respons", "e", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long", "string_", "(_", "f_", ",_", "self_", "._", "response_", ")_", "\\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_", "Auth", "Success", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "AUTH", "\\u", "SUCCESS", "'_", "\\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_", "Auth", "Success", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "token_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Success", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "read", "\\u", "long", "string_", "(_", "f_", ")_", ")_", "\\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_", "Optio", "ns", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "OPTION", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Optio", "ns", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\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_", "Supp", "orte", "d", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x06_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "SUPPORTED", "'_", "\\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_", "Supp", "orte", "d", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cql", "\\u", "versions_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cql", "\\u", "versions_", "=_", "cql", "\\u", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Supp", "orte", "d", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "read", "\\u", "string", "multim", "ap_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cql", "\\u", "versions_", "=_", "options_", "._", "pop_", "(_", "'", "CQ", "L", "\\u", "VERSI", "ON", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "cql", "\\u", "versions_", "=_", "cql", "\\u", "versions_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Query", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x07_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "QUE", "RY", "'_", "\\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_", "Query", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "query_", ",_", "consiste", "nc", "y", "\\u", "level_", ",_", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "\\u", "size_", "=_", "None_", ",_", "paging", "\\u", "state_", "=_", "None_", ",_", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", "=_", "consiste", "nc", "y", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "=_", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fetch", "\\u", "size_", "=_", "fetch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "paging", "\\u", "state_", "=_", "paging", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "query", "\\u", "params_", "=_", "None_", "#", " ", "only", " ", "used", " ", "internal", "ly", ".", " ", "Ma", "y", " ", "be", " ", "set", " ", "to", " ", "a", " ", "list", " ", "of", " ", "nativ", "e-", "encode", "d", " ", "values", " ", "to", " ", "have", " ", "them", " ", "sent", " ", "with", " ", "the", " ", "request", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long", "string_", "(_", "f_", ",_", "self_", "._", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "query", "\\u", "params_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "VALU", "ES", "\\u", "FLAG_", "#", " ", "als", "o", " ", "v2", "+,", " ", "but", " ", "we", "'", "re", " ", "only", " ", "setti", "ng", " ", "params", " ", "internal", "ly", " ", "right", " ", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "protoc", "ol", "\\u", "version_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "WITH", "\\u", "SERIAL", "\\u", "CONS", "ISTE", "NCY", "\\u", "FLAG_", "\\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_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ser", "ial", " ", "consiste", "nc", "y", " ", "level", "s", " ", "require", " ", "the", " ", "use", " ", "of", " ", "protoc", "ol", " ", "version", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", " ", "or", " ", "higher", ".", " ", "Consider", " ", "setti", "ng", " ", "Cluster", ".", "protoc", "ol", "\\u", "version", " ", "to", " ", "2", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", " ", "support", " ", "serial", " ", "consiste", "nc", "y", " ", "level", "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_", "if_", "self_", "._", "fetch", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "protoc", "ol", "\\u", "version_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "PAGE", "\\u", "SIZE", "\\u", "FLAG_", "\\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_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Automat", "ic", " ", "query", " ", "paging", " ", "may", " ", "only", " ", "be", " ", "used", " ", "with", " ", "protoc", "ol", " ", "version", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", " ", "or", " ", "higher", ".", " ", "Consider", " ", "setti", "ng", " ", "Cluster", ".", "protoc", "ol", "\\u", "version", " ", "to", " ", "2", ".\"_", ")_", "\\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_", "self_", "._", "paging", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "protoc", "ol", "\\u", "version_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "WITH", "\\u", "PA", "GING", "\\u", "STATE", "\\u", "FLAG_", "\\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_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Automat", "ic", " ", "query", " ", "paging", " ", "may", " ", "only", " ", "be", " ", "used", " ", "with", " ", "protoc", "ol", " ", "version", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", " ", "or", " ", "higher", ".", " ", "Consider", " ", "setti", "ng", " ", "Cluster", ".", "protoc", "ol", "\\u", "version", " ", "to", " ", "2", ".\"_", ")_", "\\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_", "self_", "._", "timestamp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "PROTOCOL", "\\u", "TIMESTAMP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "byte_", "(_", "f_", ",_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "query", "\\u", "params_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "self_", "._", "\\u", "query", "\\u", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "self_", "._", "\\u", "query", "\\u", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "value_", "(_", "f_", ",_", "param_", ")_", "\\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_", "self_", "._", "fetch", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "int_", "(_", "f_", ",_", "self_", "._", "fetch", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "paging", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long", "string_", "(_", "f_", ",_", "self_", "._", "paging", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "timestamp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long_", "(_", "f_", ",_", "self_", "._", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x08_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "RESU", "LT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paging", "\\u", "state_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Names", " ", "match", " ", "type", " ", "name", " ", "in", " ", "module", " ", "scope", ".", " ", "Mos", "t", " ", "are", " ", "import", "ed", " ", "from", " ", "cass", "andra", ".", "cql", "types", " ", "(", "except", " ", "CUSTOM", "\\u", "TYPE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "type", "\\u", "codes_", "=_", "\\u", "cql", "types", "\\u", "by", "\\u", "code_", "=_", "dict_", "(_", "(_", "v_", ",_", "globals_", "(_", ")_", "[_", "k_", "]_", ")_", "for_", "k_", ",_", "v_", "in_", "type", "\\u", "codes_", "._", "\\u\\u", "dict\\u\\u_", "._", "items_", "(_", ")_", "if_", "not_", "k_", "._", "startswith_", "(_", "'\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "FLAG", "S", "\\u", "GLOB", "AL", "\\u", "TABLES", "\\u", "SPEC", "_", "=_", "0x0001", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "HAS", "\\u", "MOR", "E", "\\u", "PAGE", "S", "\\u", "FLAG_", "=_", "0x000", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "NO", "\\u", "METAD", "ATA", "\\u", "FLAG_", "=_", "0x000", "4_", "\\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_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kind_", ",_", "results_", ",_", "paging", "\\u", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kind_", "=_", "kind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "=_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "paging", "\\u", "state_", "=_", "paging", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paging", "\\u", "state_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kind_", "==_", "RESU", "LT", "\\u", "KIND", "\\u", "VOID", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "RESU", "LT", "\\u", "KIND", "\\u", "ROWS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paging", "\\u", "state_", ",_", "results_", "=_", "cls_", "._", "recv", "\\u", "results", "\\u", "rows_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "RESU", "LT", "\\u", "KIND", "\\u", "SET", "\\u", "KEYS", "PACE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ks", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "ks", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "RESU", "LT", "\\u", "KIND", "\\u", "PREP", "ARE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "cls_", "._", "recv", "\\u", "results", "\\u", "prepared", "_", "(_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "RESU", "LT", "\\u", "KIND", "\\u", "SCHE", "MA", "\\u", "CHANGE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "cls_", "._", "recv", "\\u", "results", "\\u", "schema", "\\u", "change_", "(_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", "\\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_", "Drive", "r", "Exception_", "(_", "\"", "Un", "know", "n", " ", "RESU", "LT", " ", "kind", ":", " ", "%", "d", "\"_", "%_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "kind_", ",_", "results_", ",_", "paging", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "results", "\\u", "rows_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paging", "\\u", "state_", ",_", "column", "\\u", "metadata_", "=_", "cls_", "._", "recv", "\\u", "results", "\\u", "metadata_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rowcount_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "[_", "cls_", "._", "recv", "\\u", "row_", "(_", "f_", ",_", "len_", "(_", "column", "\\u", "metadata_", ")_", ")_", "for_", "\\u_", "in_", "range_", "(_", "rowcount_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colnames_", "=_", "[_", "c_", "[_", "2_", "]_", "for_", "c_", "in_", "column", "\\u", "metadata_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "types_", "=_", "[_", "c_", "[_", "3_", "]_", "for_", "c_", "in_", "column", "\\u", "metadata_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed", "\\u", "rows_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "tuple_", "(_", "ctype_", "._", "from", "\\u", "binary_", "(_", "val_", ",_", "protoc", "ol", "\\u", "version_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ctype_", ",_", "val_", "in_", "zip_", "(_", "col", "types_", ",_", "row_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "rows_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "paging", "\\u", "state_", ",_", "(_", "colnames_", ",_", "parsed", "\\u", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "results", "\\u", "prepared", "_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "id_", "=_", "read", "\\u", "binar", "y", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "metadata_", ",_", "pk", "\\u", "indexes_", "=_", "cls_", "._", "recv", "\\u", "prepared", "\\u", "metadata_", "(_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "query", "\\u", "id_", ",_", "column", "\\u", "metadata_", ",_", "pk", "\\u", "indexes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "results", "\\u", "metadata_", "(_", "cls_", ",_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glob", "\\u", "tbl", "spec_", "=_", "bool_", "(_", "flags_", "&_", "cls_", "._", "\\u", "FLAG", "S", "\\u", "GLOB", "AL", "\\u", "TABLES", "\\u", "SPEC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "count_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "flags_", "&_", "cls_", "._", "\\u", "HAS", "\\u", "MOR", "E", "\\u", "PAGE", "S", "\\u", "FLAG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paging", "\\u", "state_", "=_", "read", "\\u", "binar", "y", "\\u", "long", "string_", "(_", "f_", ")_", "\\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 ", " _", "paging", "\\u", "state_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "glob", "\\u", "tbl", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ks", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfn", "ame_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column", "\\u", "metadata_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "col", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glob", "\\u", "tbl", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "ks", "name_", "=_", "ks", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "cfn", "ame_", "=_", "cfn", "ame_", "\\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 ", " _", "col", "ks", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "cfn", "ame_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "colname_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "type_", "=_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "metadata_", "._", "append_", "(_", "(_", "col", "ks", "name_", ",_", "col", "cfn", "ame_", ",_", "colname_", ",_", "col", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "paging", "\\u", "state_", ",_", "column", "\\u", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "prepared", "\\u", "metadata_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glob", "\\u", "tbl", "spec_", "=_", "bool_", "(_", "flags_", "&_", "cls_", "._", "\\u", "FLAG", "S", "\\u", "GLOB", "AL", "\\u", "TABLES", "\\u", "SPEC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "count_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk", "\\u", "indexes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "protoc", "ol", "\\u", "version_", ">=_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "pk", "\\u", "indexes_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pk", "\\u", "indexes_", "=_", "[_", "read", "\\u", "short_", "(_", "f_", ")_", "for_", "\\u_", "in_", "range_", "(_", "num", "\\u", "pk", "\\u", "indexes_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "glob", "\\u", "tbl", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ks", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfn", "ame_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column", "\\u", "metadata_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "col", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "glob", "\\u", "tbl", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "ks", "name_", "=_", "ks", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "cfn", "ame_", "=_", "cfn", "ame_", "\\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 ", " _", "col", "ks", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "cfn", "ame_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "colname_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "type_", "=_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "metadata_", "._", "append_", "(_", "Colum", "n", "Metadata_", "(_", "col", "ks", "name_", ",_", "col", "cfn", "ame_", ",_", "colname_", ",_", "col", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "column", "\\u", "metadata_", ",_", "pk", "\\u", "indexes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "results", "\\u", "schema", "\\u", "change_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Event", "Message_", "._", "recv", "\\u", "schema", "\\u", "change_", "(_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "read", "\\u", "type_", "(_", "cls_", ",_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opti", "d_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typec", "lass_", "=_", "cls_", "._", "type", "\\u", "codes_", "[_", "opti", "d_", "]_", "\\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 ", " _", "raise_", "Not", "Supp", "orte", "d", "Error_", "(_", "\"", "Un", "know", "n", " ", "data", " ", "type", " ", "code", " ", "0", "x", "%", "04", "x", ".", " ", "Ha", "ve", " ", "to", " ", "skip", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "entire", " ", "result", " ", "set", ".\"_", "%_", "(_", "opti", "d_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typec", "lass_", "in_", "(_", "List", "Type_", ",_", "Set", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subtype_", "=_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "lass_", "=_", "typec", "lass_", "._", "appl", "y", "\\u", "parameters_", "(_", "(_", "subtype_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typec", "lass_", "==_", "Map", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys", "ub", "type_", "=_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals", "ub", "type_", "=_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "lass_", "=_", "typec", "lass_", "._", "appl", "y", "\\u", "parameters_", "(_", "(_", "keys", "ub", "type_", ",_", "vals", "ub", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typec", "lass_", "==_", "Tup", "le", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "items_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types_", "=_", "tuple_", "(_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "for_", "\\u_", "in_", "range_", "(_", "num", "\\u", "items_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "lass_", "=_", "typec", "lass_", "._", "appl", "y", "\\u", "parameters_", "(_", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typec", "lass_", "==_", "User", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ks_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ud", "t", "\\u", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "fields_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", ",_", "types_", "=_", "zip_", "(_", "*_", "(_", "(_", "read", "\\u", "string_", "(_", "f_", ")_", ",_", "cls_", "._", "read", "\\u", "type_", "(_", "f_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "num", "\\u", "fields_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "specialize", "d\\u", "type_", "=_", "typec", "lass_", "._", "make", "\\u", "ud", "t", "\\u", "class_", "(_", "ks_", ",_", "ud", "t", "\\u", "name_", ",_", "names_", ",_", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "specialize", "d\\u", "type_", "._", "mapp", "ed", "\\u", "class_", "=_", "user", "\\u", "type", "\\u", "map_", "._", "get_", "(_", "ks_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "ud", "t", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "lass_", "=_", "specialize", "d\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "typec", "lass_", "==_", "CUSTOM", "\\u", "TYPE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classname_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typec", "lass_", "=_", "look", "up", "\\u", "cass", "type_", "(_", "classname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "typec", "lass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Result", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\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_", "recv", "\\u", "row_", "(_", "f_", ",_", "col", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "read", "\\u", "value_", "(_", "f_", ")_", "for_", "\\u_", "in_", "range_", "(_", "col", "count_", ")_", "]_", "\\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_", "Prepare", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x09", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "PREP", "ARE", "'_", "\\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_", "Prepare", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prepare", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long", "string_", "(_", "f_", ",_", "self_", "._", "query_", ")_", "\\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_", "Execut", "e", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x0", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "EXECUTE", "'_", "\\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_", "Execut", "e", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "query", "\\u", "id_", ",_", "query", "\\u", "params_", ",_", "consiste", "nc", "y", "\\u", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "=_", "None_", ",_", "fetch", "\\u", "size_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "paging", "\\u", "state_", "=_", "None_", ",_", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "query", "\\u", "id_", "=_", "query", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query", "\\u", "params_", "=_", "query", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", "=_", "consiste", "nc", "y", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "=_", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fetch", "\\u", "size_", "=_", "fetch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "paging", "\\u", "state_", "=_", "paging", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Execut", "e", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "f_", ",_", "self_", "._", "query", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "protoc", "ol", "\\u", "version_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ser", "ial", " ", "consiste", "nc", "y", " ", "level", "s", " ", "require", " ", "the", " ", "use", " ", "of", " ", "protoc", "ol", " ", "version", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", " ", "or", " ", "higher", ".", " ", "Consider", " ", "setti", "ng", " ", "Cluster", ".", "protoc", "ol", "\\u", "version", " ", "to", " ", "2", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", " ", "support", " ", "serial", " ", "consiste", "nc", "y", " ", "level", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "fetch", "\\u", "size_", "or_", "self_", "._", "paging", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Automat", "ic", " ", "query", " ", "paging", " ", "may", " ", "only", " ", "be", " ", "used", " ", "with", " ", "protoc", "ol", " ", "version", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "2", " ", "or", " ", "higher", ".", " ", "Consider", " ", "setti", "ng", " ", "Cluster", ".", "protoc", "ol", "\\u", "version", " ", "to", " ", "2", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "self_", "._", "query", "\\u", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "self_", "._", "query", "\\u", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "value_", "(_", "f_", ",_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", ")_", "\\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 ", " _", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "\\u", "VALU", "ES", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "WITH", "\\u", "SERIAL", "\\u", "CONS", "ISTE", "NCY", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "fetch", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "PAGE", "\\u", "SIZE", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "paging", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "WITH", "\\u", "PA", "GING", "\\u", "STATE", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "timestamp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "protoc", "ol", "\\u", "version_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "flags_", "|=_", "\\u", "PROTOCOL", "\\u", "TIMESTAMP_", "\\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_", "Unsu", "ppo", "rted", "Operation_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Proto", "col", "-", "level", " ", "timestamp", "s", " ", "may", " ", "only", " ", "be", " ", "used", " ", "with", " ", "protoc", "ol", " ", "version", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "3", " ", "or", " ", "higher", ".", " ", "Consider", " ", "setti", "ng", " ", "Cluster", ".", "protoc", "ol", "\\u", "version", " ", "to", " ", "3", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "byte_", "(_", "f_", ",_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "self_", "._", "query", "\\u", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "self_", "._", "query", "\\u", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "value_", "(_", "f_", ",_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "fetch", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "int_", "(_", "f_", ",_", "self_", "._", "fetch", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "paging", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long", "string_", "(_", "f_", ",_", "self_", "._", "paging", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "timestamp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long_", "(_", "f_", ",_", "self_", "._", "timestamp_", ")_", "\\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_", "class_", "Bat", "ch", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x0", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "BATCH", "'_", "\\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_", "Bat", "ch", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "batch", "\\u", "type_", ",_", "queries_", ",_", "consiste", "nc", "y", "\\u", "level_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "=_", "None_", ",_", "timestamp_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "batch", "\\u", "type_", "=_", "batch", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queries_", "=_", "queries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", "=_", "consiste", "nc", "y", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "=_", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bat", "ch", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "byte_", "(_", "f_", ",_", "self_", "._", "batch", "\\u", "type_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "self_", "._", "queries_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prepared", "_", ",_", "string", "\\u", "or", "\\u", "query", "\\u", "id_", ",_", "params_", "in_", "self_", "._", "queries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "prepared", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "byte_", "(_", "f_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "long", "string_", "(_", "f_", ",_", "string", "\\u", "or", "\\u", "query", "\\u", "id_", ")_", "\\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 ", " _", "write", "\\u", "byte_", "(_", "f_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "string", "\\u", "or", "\\u", "query", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "string", "\\u", "or", "\\u", "query", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param_", "in_", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "value_", "(_", "f_", ",_", "param_", ")_", "\\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", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "consiste", "nc", "y", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "protoc", "ol", "\\u", "version_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "WITH", "\\u", "SERIAL", "\\u", "CONS", "ISTE", "NCY", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "timestamp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "\\u", "PROTOCOL", "\\u", "TIMESTAMP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "byte_", "(_", "f_", ",_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "self_", "._", "serial", "\\u", "consiste", "nc", "y", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "timestamp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "long_", "(_", "f_", ",_", "self_", "._", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Register", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x0", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "REGISTER", "'_", "\\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_", "Register", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "event", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "event", "\\u", "list_", "=_", "event", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Register", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "body_", "(_", "self_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string", "list_", "(_", "f_", ",_", "self_", "._", "event", "\\u", "list_", ")_", "\\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_", "Event", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opcode_", "=_", "0x0", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "EVENT", "'_", "\\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_", "Event", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "event", "\\u", "type_", ",_", "event", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "event", "\\u", "type_", "=_", "event", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "event", "\\u", "args_", "=_", "event", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "body_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "type_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "type_", "in_", "know", "n", "\\u", "event", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "read", "\\u", "method_", "=_", "getattr_", "(_", "cls_", ",_", "'", "recv", "\\u'_", "+_", "event", "\\u", "type_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "event", "\\u", "type_", "=_", "event", "\\u", "type_", ",_", "event", "\\u", "args_", "=_", "read", "\\u", "method_", "(_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Not", "Supp", "orte", "d", "Error_", "(_", "'", "Un", "know", "n", " ", "event", " ", "type", " ", "%", "r", "'_", "%_", "event", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "topo", "log", "y", "\\u", "change_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "NEW", "\\u", "NODE", "\"", " ", "or", " ", "\"", "REMOVE", "D", "\\u", "NODE", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "\\u", "type_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address_", "=_", "read", "\\u", "inet", "_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "change", "\\u", "type_", "=_", "change", "\\u", "type_", ",_", "address_", "=_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "status", "\\u", "change_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "UP", "\"", " ", "or", " ", "\"", "DOWN", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "\\u", "type_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address_", "=_", "read", "\\u", "inet", "_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "change", "\\u", "type_", "=_", "change", "\\u", "type_", ",_", "address_", "=_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event", "Message_", "(_", "\\u", "Messag", "e", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "recv", "\\u", "schema", "\\u", "change_", "(_", "cls_", ",_", "f_", ",_", "protoc", "ol", "\\u", "version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "CREATE", "D", "\",", " ", "\"", "DROP", "PED", "\",", " ", "or", " ", "\"", "UPDATE", "D", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "\\u", "type_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "protoc", "ol", "\\u", "version_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyspace_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "{_", "'", "target", "\\u", "type", "'_", ":_", "target_", ",_", "'", "change", "\\u", "type", "'_", ":_", "change", "\\u", "type_", ",_", "'", "keyspace", "'_", ":_", "keyspace_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target_", "!=_", "Schema", "Target", "Type_", "._", "KEYS", "PACE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "name_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target_", "==_", "Schema", "Target", "Type_", "._", "FUNCTION_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "event_", "[_", "'", "function", "'_", "]_", "=_", "User", "Function", "Descriptor_", "(_", "target", "\\u", "name_", ",_", "[_", "read", "\\u", "string_", "(_", "f_", ")_", "for_", "\\u_", "in_", "range_", "(_", "read", "\\u", "short_", "(_", "f_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "target_", "==_", "Schema", "Target", "Type_", "._", "AGG", "REG", "ATE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "event_", "[_", "'", "aggre", "gate", "'_", "]_", "=_", "User", "Aggregate", "Descriptor_", "(_", "target", "\\u", "name_", ",_", "[_", "read", "\\u", "string_", "(_", "f_", ")_", "for_", "\\u_", "in_", "range_", "(_", "read", "\\u", "short_", "(_", "f_", ")_", ")_", "]_", ")_", "\\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 ", " ", "_", "event_", "[_", "target_", "._", "lower_", "(_", ")_", "]_", "=_", "target", "\\u", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyspace_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "=_", "{_", "'", "target", "\\u", "type", "'_", ":_", "Schema", "Target", "Type_", "._", "TABLE_", ",_", "'", "change", "\\u", "type", "'_", ":_", "change", "\\u", "type_", ",_", "'", "keyspace", "'_", ":_", "keyspace_", ",_", "'", "table", "'_", ":_", "table_", "}_", "\\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 ", " _", "event_", "=_", "{_", "'", "target", "\\u", "type", "'_", ":_", "Schema", "Target", "Type_", "._", "KEYS", "PACE", "_", ",_", "'", "change", "\\u", "type", "'_", ":_", "change", "\\u", "type_", ",_", "'", "keyspace", "'_", ":_", "keyspace_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "event_", "\\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_", "\\u", "Proto", "col", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\u", "Proto", "col", "Hand", "er", " ", "handle", "s", " ", "encoding", " ", "and", " ", "deco", "ding", " ", "message", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "can", " ", "be", " ", "specialize", "d", " ", "to", " ", "compose", " ", "Handle", "rs", " ", "whi", "ch", " ", "implement", " ", "alternative", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "deco", "ding", " ", "or", " ", "type", " ", "deser", "iali", "zatio", "n", ".", " ", "Class", " ", "definit", "ion", "s", " ", "are", " ", "pass", "ed", " ", "to", " ", ":", "class", ":`", "cass", "andra", ".", "cluster", ".", "Cluster", "`", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "initialization", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Contract", "ed", " ", "class", " ", "method", "s", " ", "are", " ", ":", "meth", ":`", "\\u", "Proto", "col", "Handle", "r", ".", "encode", "\\u", "message", "`", " ", "and", " ", ":", "meth", ":`", "\\u", "Proto", "col", "Handle", "r", ".", "decode", "\\u", "message", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "=_", "\\u", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "mapping", " ", "of", " ", "opcode", " ", "to", " ", "Messag", "e", " ", "implementation", ".", " ", "The", " ", "default", " ", "``", "decode", "\\u", "message", "``", " ", "implementation", " ", "use", "s", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "to", " ", "instantiate", " ", "a", " ", "message", " ", "and", " ", "populate", " ", "usi", "ng", " ", "``", "recv", "\\u", "body", "``.", " ", "Thi", "s", " ", "mapping", " ", "can", " ", "be", " ", "update", "d", " ", "to", " ", "inject", " ", "specialize", "d", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "deco", "ding", " ", "implementation", "s", ".", "\\", "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_", "[SEP]_", "class_", "\\u", "Proto", "col", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "encode", "\\u", "message_", "(_", "cls_", ",_", "msg_", ",_", "stream", "\\u", "id_", ",_", "protoc", "ol", "\\u", "version_", ",_", "compressor", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Encode", "s", " ", "a", " ", "message", " ", "usi", "ng", " ", "the", " ", "specified", " ", "frame", " ", "parameter", "s", ",", " ", "and", " ", "compressor", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "msg", ":", " ", "the", " ", "message", ",", " ", "typical", "ly", " ", "of", " ", "cass", "andra", ".", "protoc", "ol", ".\\u", "Messag", "e", "Type", ",", " ", "generat", "ed", " ", "by", " ", "the", " ", "driver", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "stream", "\\u", "id", ":", " ", "protoc", "ol", " ", "stream", " ", "id", " ", "for", " ", "the", " ", "frame", " ", "header", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "protoc", "ol", "\\u", "version", ":", " ", "version", " ", "for", " ", "the", " ", "frame", " ", "header", ",", " ", "and", " ", "used", " ", "encoding", " ", "content", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "compressor", ":", " ", "option", "al", " ", "compress", "ion", " ", "function", " ", "to", " ", "be", " ", "used", " ", "on", " ", "the", " ", "body", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "._", "custom", "\\u", "payload_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "protoc", "ol", "\\u", "version_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "Operation_", "(_", "\"", "Custom", " ", "key", "/", "value", " ", "payload", "s", " ", "can", " ", "only", " ", "be", " ", "used", " ", "with", " ", "protoc", "ol", " ", "version", " ", "4", " ", "or", " ", "higher", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flags_", "|=_", "CUSTOM", "\\u", "PAYLOAD", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "bytes", "map_", "(_", "body_", ",_", "msg_", "._", "custom", "\\u", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "._", "send", "\\u", "body_", "(_", "body_", ",_", "protoc", "ol", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "body_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compressor", "_", "and_", "len_", "(_", "body_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "compressor", "_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "|=_", "COMPRESS", "ED", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "msg_", "._", "tracing", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "|=_", "TRA", "CIN", "G", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buff_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "write", "\\u", "header_", "(_", "buff_", ",_", "protoc", "ol", "\\u", "version_", ",_", "flags_", ",_", "stream", "\\u", "id_", ",_", "msg_", "._", "opcode_", ",_", "len_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buff_", "._", "write_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "buff_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Proto", "col", "Handler_", "(_", "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_", "\\u", "write", "\\u", "header_", "(_", "f_", ",_", "version_", ",_", "flags_", ",_", "stream", "\\u", "id_", ",_", "opcode_", ",_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "a", " ", "CQ", "L", " ", "protoc", "ol", " ", "frame", " ", "header", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack_", "=_", "v", "3", "\\u", "header", "\\u", "pack_", "if_", "version_", ">=_", "3_", "else_", "header", "\\u", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "pack_", "(_", "version_", ",_", "flags_", ",_", "stream", "\\u", "id_", ",_", "opcode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "int_", "(_", "f_", ",_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Proto", "col", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decode", "\\u", "message_", "(_", "cls_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ",_", "stream", "\\u", "id_", ",_", "flags_", ",_", "opcode_", ",_", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "decompress", "or_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Decode", "s", " ", "a", " ", "nativ", "e", " ", "protoc", "ol", " ", "message", " ", "body", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "protoc", "ol", "\\u", "version", ":", " ", "version", " ", "to", " ", "use", " ", "deco", "ding", " ", "content", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "user", "\\u", "type", "\\u", "map", ":", " ", "map", "[", "keyspace", " ", "name", "]", " ", "=", " ", "map", "[", "type", " ", "name", "]", " ", "=", " ", "custom", " ", "type", " ", "to", " ", "instantiate", " ", "whe", "n", " ", "deser", "iali", "zin", "g", " ", "this", " ", "type", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "stream", "\\u", "id", ":", " ", "nativ", "e", " ", "protoc", "ol", " ", "stream", " ", "id", " ", "from", " ", "the", " ", "frame", " ", "header", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "flags", ":", " ", "nativ", "e", " ", "protoc", "ol", " ", "flags", " ", "bitmap", " ", "from", " ", "the", " ", "header", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "opcode", ":", " ", "nativ", "e", " ", "protoc", "ol", " ", "opcode", " ", "from", " ", "the", " ", "header", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "body", ":", " ", "frame", " ", "body", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "decompress", "or", ":", " ", "option", "al", " ", "decompress", "ion", " ", "function", " ", "to", " ", "infla", "te", " ", "the", " ", "body", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "a", " ", "message", " ", "decode", "d", " ", "from", " ", "the", " ", "body", " ", "and", " ", "frame", " ", "attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flags_", "&_", "COMPRESS", "ED", "\\u", "FLAG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "decompress", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "No", " ", "de", "-", "compressor", " ", "avail", "able", " ", "for", " ", "compress", "ed", " ", "frame", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "=_", "decompress", "or_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "^", "=_", "COMPRESS", "ED", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flags_", "&_", "TRA", "CIN", "G", "\\u", "FLAG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trace", "\\u", "id_", "=_", "UUID_", "(_", "bytes_", "=_", "body_", "._", "read_", "(_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "^", "=_", "TRA", "CIN", "G", "\\u", "FLAG_", "\\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 ", " _", "trace", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flags_", "&_", "WARN", "ING", "\\u", "FLAG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "=_", "read", "\\u", "string", "list_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "^", "=_", "WARN", "ING", "\\u", "FLAG_", "\\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 ", " _", "warnings_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flags_", "&_", "CUSTOM", "\\u", "PAYLOAD", "\\u", "FLAG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "custom", "\\u", "payload_", "=_", "read", "\\u", "bytes", "map_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "^", "=_", "CUSTOM", "\\u", "PAYLOAD", "\\u", "FLAG_", "\\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 ", " _", "custom", "\\u", "payload_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "\"", "Un", "know", "n", " ", "protoc", "ol", " ", "flags", " ", "set", ":", " ", "%", "02", "x", ".", " ", "Ma", "y", " ", "caus", "e", " ", "problem", "s", ".\"_", ",_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg", "\\u", "class_", "=_", "cls_", "._", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "[_", "opcode_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "msg", "\\u", "class_", "._", "recv", "\\u", "body_", "(_", "body_", ",_", "protoc", "ol", "\\u", "version_", ",_", "user", "\\u", "type", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "stream", "\\u", "id_", "=_", "stream", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "trace", "\\u", "id_", "=_", "trace", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "custom", "\\u", "payload_", "=_", "custom", "\\u", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "warnings_", "=_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "._", "warnings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "w_", "in_", "msg_", "._", "warnings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warning_", "(_", "\"", "Server", " ", "warn", "ing", ":", " ", "%", "s", "\"_", ",_", "w_", ")_", "\\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_", "msg_", "\\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_", "cython", "\\u", "protoc", "ol", "\\u", "handler_", "(_", "col", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "column", " ", "parser", " ", "to", " ", "deserialize", " ", "Result", "Messag", "es", ",", " ", "return", " ", "a", " ", "suit", "able", "\\", "10", ";", " ", " ", " ", " ", "Cython", "-", "based", " ", "protoc", "ol", " ", "handler", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "are", " ", "three", " ", "Cython", "-", "based", " ", "protoc", "ol", " ", "handler", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "obj", "\\u", "parser", ".", "List", "Parser", "\\", "10", ";", " ", " ", " ", " ", "decode", "s", " ", "result", " ", "message", "s", " ", "int", "o", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "obj", "\\u", "parser", ".", "La", "zy", "Parser", "\\", "10", ";", " ", " ", " ", " ", "decode", "s", " ", "result", " ", "message", "s", " ", "laz", "il", "y", " ", "by", " ", "return", "ing", " ", "an", " ", "iter", "ator", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "nump", "y", "\\u", "parser", ".", "Num", "Py", "Parser", "\\", "10", ";", " ", " ", " ", " ", "decode", "s", " ", "result", " ", "message", "s", " ", "int", "o", " ", "Num", "Py", " ", "arrays", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "to", " ", "use", " ", "obj", "\\u", "parser", ".", "List", "Parser", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cassandra_", "._", "row", "\\u", "parser_", "import_", "make", "\\u", "recv", "\\u", "results", "\\u", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Fast", "Result", "Message_", "(_", "Result", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Cython", " ", "version", " ", "of", " ", "Result", " ", "Messag", "e", " ", "tha", "t", " ", "has", " ", "a", " ", "faste", "r", " ", "implementation", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "recv", "\\u", "results", "\\u", "row", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "type", "\\u", "codes", " ", "=", " ", "Result", "Messag", "e", ".", "type", "\\u", "codes", ".", "copy", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "to", "\\u", "type_", "=_", "dict_", "(_", "(_", "v_", ",_", "k_", ")_", "for_", "k_", ",_", "v_", "in_", "Result", "Message_", "._", "type", "\\u", "codes_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recv", "\\u", "results", "\\u", "rows_", "=_", "classmethod_", "(_", "make", "\\u", "recv", "\\u", "results", "\\u", "rows_", "(_", "col", "parser_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cython", "Proto", "col", "Handler_", "(_", "\\u", "Proto", "col", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "Fast", "Result", "Messag", "e", " ", "to", " ", "decode", " ", "query", " ", "result", " ", "message", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "opcodes_", "=_", "\\u", "Proto", "col", "Handler_", "._", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "opcodes_", "[_", "Fast", "Result", "Message_", "._", "opcode_", "]_", "=_", "Fast", "Result", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "types", "\\u", "by", "\\u", "opcode_", "=_", "my", "\\u", "opcodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "col", "\\u", "parser_", "=_", "col", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Cython", "Proto", "col", "Handler_", "\\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_", "read", "\\u", "byte_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int", "8", "\\u", "unpack_", "(_", "f_", "._", "read_", "(_", "1_", ")_", ")_", "\\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_", "write", "\\u", "byte_", "(_", "f_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "int", "8", "\\u", "pack_", "(_", "b_", ")_", ")_", "\\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_", "read", "\\u", "int_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int", "32", "\\u", "unpack_", "(_", "f_", "._", "read_", "(_", "4_", ")_", ")_", "\\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_", "write", "\\u", "int_", "(_", "f_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "int", "32", "\\u", "pack_", "(_", "i_", ")_", ")_", "\\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_", "write", "\\u", "long_", "(_", "f_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "uint", "64", "\\u", "pack_", "(_", "i_", ")_", ")_", "\\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_", "read", "\\u", "short_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "uint", "16", "\\u", "unpack_", "(_", "f_", "._", "read_", "(_", "2_", ")_", ")_", "\\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_", "write", "\\u", "short_", "(_", "f_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "uint", "16", "\\u", "pack_", "(_", "s_", ")_", ")_", "\\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_", "read", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "read", "\\u", "short_", "(_", "f_", ")_", "\\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_", "write", "\\u", "consiste", "nc", "y", "\\u", "level_", "(_", "f_", ",_", "cl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "short_", "(_", "f_", ",_", "cl_", ")_", "\\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_", "read", "\\u", "string_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "f_", "._", "read_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "contents_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\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_", "read", "\\u", "binar", "y", "\\u", "string_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "f_", "._", "read_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "contents_", "\\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_", "write", "\\u", "string_", "(_", "f_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "s_", ")_", "\\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_", "read", "\\u", "binar", "y", "\\u", "long", "string_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "f_", "._", "read_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "contents_", "\\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_", "read", "\\u", "long", "string_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "read", "\\u", "binar", "y", "\\u", "long", "string_", "(_", "f_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\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_", "write", "\\u", "long", "string_", "(_", "f_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "\\u", "int_", "(_", "f_", ",_", "len_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "s_", ")_", "\\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_", "read", "\\u", "string", "list_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nums", "trs_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "read", "\\u", "string_", "(_", "f_", ")_", "for_", "\\u_", "in_", "range_", "(_", "nums", "trs_", ")_", "]_", "\\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_", "write", "\\u", "string", "list_", "(_", "f_", ",_", "string", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "string", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "string", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "f_", ",_", "s_", ")_", "\\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_", "read", "\\u", "string", "map_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nump", "airs", "_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strm", "ap_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "nump", "airs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strm", "ap_", "[_", "k_", "]_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "strm", "ap_", "\\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_", "write", "\\u", "string", "map_", "(_", "f_", ",_", "strm", "ap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "strm", "ap_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "strm", "ap_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "f_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "string_", "(_", "f_", ",_", "v_", ")_", "\\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_", "read", "\\u", "bytes", "map_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nump", "airs", "_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "nump", "airs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "map_", "[_", "k_", "]_", "=_", "read", "\\u", "value_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bytes", "map_", "\\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_", "write", "\\u", "bytes", "map_", "(_", "f_", ",_", "bytes", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "bytes", "map_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "bytes", "map_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "f_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "value_", "(_", "f_", ",_", "v_", ")_", "\\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_", "read", "\\u", "string", "multim", "ap_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "keys_", "=_", "read", "\\u", "short_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strm", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "num", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "read", "\\u", "string_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "strm", "map_", "[_", "k_", "]_", "=_", "read", "\\u", "string", "list_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "strm", "map_", "\\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_", "write", "\\u", "string", "multim", "ap_", "(_", "f_", ",_", "strm", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "short_", "(_", "f_", ",_", "len_", "(_", "strm", "map_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "strm", "map_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "f_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "string", "list_", "(_", "f_", ",_", "v_", ")_", "\\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_", "read", "\\u", "value_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", "<_", "0_", ":_", "\\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_", "f_", "._", "read_", "(_", "size_", ")_", "\\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_", "write", "\\u", "value_", "(_", "f_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "int_", "(_", "f_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", "is_", "\\u", "UNS", "ET", "\\u", "VALUE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "int_", "(_", "f_", ",_", "-_", "2_", ")_", "\\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 ", " _", "write", "\\u", "int_", "(_", "f_", ",_", "len_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "v_", ")_", "\\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_", "read", "\\u", "inet", "_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "read", "\\u", "byte_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr", "bytes_", "=_", "f_", "._", "read_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "read", "\\u", "int_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr", "fam", "_", "=_", "socket_", "._", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "size_", "==_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr", "fam", "_", "=_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", "\\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_", "Intern", "al", "Error_", "(_", "\"", "bad", " ", "inet", " ", "address", ":", " ", "%", "r", "\"_", "%_", "(_", "addr", "bytes_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "util_", "._", "inet", "\\u", "nto", "p_", "(_", "addr", "fam", "_", ",_", "addr", "bytes_", ")_", ",_", "port_", ")_", "\\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_", "write", "\\u", "inet", "_", "(_", "f_", ",_", "addr", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", ",_", "port_", "=_", "addr", "tuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "':'_", "in_", "addr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr", "fam", "_", "=_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", "\\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 ", " _", "addr", "fam", "_", "=_", "socket_", "._", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "addr", "bytes_", "=_", "util_", "._", "inet", "\\u", "pto", "n_", "(_", "addr", "fam", "_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "byte_", "(_", "f_", ",_", "len_", "(_", "addr", "bytes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "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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, 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 ]
Unused import
kumar303/jstestnet/jstestnet/system/management/commands/run_gevent.py
[ { "content": "import logging\n\nfrom django.conf import settings\nfrom django.core.handlers.wsgi import WSGIHandler\nfrom django.core.cache import cache\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom gevent import monkey\nfrom socketio import SocketIOServer\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(BaseCommand):\n args = '<port_number>'\n help = 'Start the chat server. Takes an optional arg (port #).'\n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def handle(self, *args, **options):\n \"\"\"Run gevent socketio server.\"\"\"\n logging.basicConfig()\n logging.getLogger().setLevel(logging.INFO)\n try:\n port = int(args[0])\n except:\n port = 8000\n\n # Make blocking calls in socket lib non-blocking:\n monkey.patch_all()\n\n # Start up gevent-socketio stuff\n application = WSGIHandler()\n print 'Listening on http://127.0.0.1:%s and on port 843 (flash policy server)' % port\n SocketIOServer(('', port), application,\n resource='socket.io').serve_forever()", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "from django.conf import settings", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 32 }, { "span": "from django.core.cache import cache", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 35 }, { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\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_", "._", "core_", "._", "handlers_", "._", "wsgi_", "import_", "WS", "GI", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "cache_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gevent_", "import_", "monkey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socketio", "_", "import_", "Sock", "et", "IO", "Server_", "\\u\\u\\uNEWLINE\\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_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "'<", "port", "\\u", "number", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help_", "=_", "'", "Start", " ", "the", " ", "chat", " ", "server", ".", " ", "Tak", "es", " ", "an", " ", "option", "al", " ", "arg", " ", "(", "port", " ", "#)", ".'_", "\\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 ", " _", "\"\"\"", "Run", " ", "gev", "ent", " ", "socketio", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "args_", "[_", "0_", "]_", ")_", "\\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 ", " _", "port_", "=_", "8000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "blockin", "g", " ", "calls", " ", "in", " ", "socket", " ", "lib", " ", "non", "-", "blockin", "g", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "monkey_", "._", "patch", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "up", " ", "gev", "ent", "-", "socketio", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "application_", "=_", "WS", "GI", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Listen", "ing", " ", "on", " ", "http", "://", "127", ".0", ".0", ".1", ":", "%", "s", " ", "and", " ", "on", " ", "port", " ", "843", " ", "(", "flash", " ", "policy", " ", "server", ")'_", "%_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sock", "et", "IO", "Server_", "(_", "(_", "''_", ",_", "port_", ")_", ",_", "application_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "'", "socket", ".", "io", "'_", ")_", "._", "serve", "\\u", "forever_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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 ]
Unused local variable
AppScale/appscale/AppServer/lib/django-1.5/django/forms/widgets.py
[ { "content": " def render(self, name=None, value=None, attrs=None, choices=()):\n name = name or self.name\n value = value or self.value\n attrs = attrs or self.attrs\n if 'id' in self.attrs:\n label_for = format_html(' for=\"{0}_{1}\"', self.attrs['id'], self.index)\n else:\n label_for = ''\n choice_label = force_text(self.choice_label)\n return format_html('<label{0}>{1} {2}</label>', label_for, self.tag(), choice_label)", "metadata": "root.RadioInput.render", "header": "['class', 'RadioInput', '(', 'SubWidget', ')', ':', '___EOS___']", "index": 669 } ]
[ { "span": "name ", "start_line": 670, "start_column": 8, "end_line": 670, "end_column": 12 }, { "span": "value ", "start_line": 671, "start_column": 8, "end_line": 671, "end_column": 13 }, { "span": "attrs ", "start_line": 672, "start_column": 8, "end_line": 672, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Radio", "Input_", "(_", "Sub", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "value_", "=_", "None_", ",_", "attrs_", "=_", "None_", ",_", "choices_", "=_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "or_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "value_", "or_", "self_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "attrs_", "or_", "self_", "._", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "id", "'_", "in_", "self_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label", "\\u", "for_", "=_", "format\\u", "html_", "(_", "'", " ", "for", "=\"", "{", "0", "}\\u", "{", "1", "}\"'_", ",_", "self_", "._", "attrs_", "[_", "'", "id", "'_", "]_", ",_", "self_", "._", "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 ", " _", "label", "\\u", "for_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "choice", "\\u", "label_", "=_", "force", "\\u", "text_", "(_", "self_", "._", "choice", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format\\u", "html_", "(_", "'<", "label", "{", "0", "}>", "{", "1", "}", " ", "{", "2", "}", "</", "label", ">'_", ",_", "label", "\\u", "for_", ",_", "self_", "._", "tag_", "(_", ")_", ",_", "choice", "\\u", "label_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jumoconnect/openjumo/jumodjango/org/admin.py
[ { "content": "from django import forms\nfrom django.contrib import admin\nfrom etc import cache\nfrom entity_items.admin import MediaItemInline, ActionInline, AdvocateInline, TimelineInline, CenterContentItemInline, LeftContentItemInline\nfrom issue.models import Issue\nfrom org.models import Org, RelatedOrg, OrgIssueRelationship, Alias\nfrom users.models import User, Location\nfrom cust_admin.views.main import ExtChangeList\nfrom cust_admin.widgets import ForeignKeyToObjWidget\n\n######## INLINES ########\n\n\n\n\n\n######## MODEL FORM AND ADMIN ########\n\n\n\n\nadmin.site.register(Org,OrgAdmin)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AliasInline(admin.TabularInline):\n model = Alias\n extra = 0\n classes = ('collapse closed',)\n verbose_name = \"Alias\"\n verbose_name_plural = \"Aliases\"", "metadata": "root.AliasInline", "header": "['module', '___EOS___']", "index": 11 }, { "content": "class AdminsInline(admin.TabularInline):\n model = Org.admins.through\n extra = 0\n classes = ('collapse closed',)\n related_field_lookups = {\n 'fk': ['user']\n }\n verbose_name = \"Admin\"\n verbose_name_plural = \"Admins\"", "metadata": "root.AdminsInline", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def formfield_for_dbfield(self, db_field, **kwargs):\n if db_field.name == 'user':\n kwargs['widget'] = ForeignKeyToObjWidget(rel=Org.admins.through._meta.get_field('user').rel)\n return super(AdminsInline,self).formfield_for_dbfield(db_field,**kwargs)", "metadata": "root.AdminsInline.formfield_for_dbfield", "header": "['class', 'AdminsInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 27 }, { "content": "class IssuesInlineForm(forms.ModelForm):\n class Meta:\n model = Org.issues.through\n widgets = {'rank':forms.HiddenInput}", "metadata": "root.IssuesInlineForm", "header": "['module', '___EOS___']", "index": 32 }, { "content": "class IssuesInline(admin.TabularInline):\n model = Org.issues.through\n extra = 0\n form = IssuesInlineForm\n classes = ('collapse closed',)\n sortable_field_name = \"rank\"\n related_field_lookups = {\n 'fk': ['issue']\n }\n verbose_name = \"\"\n verbose_name_plural = \"Working On\"", "metadata": "root.IssuesInline", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def formfield_for_dbfield(self, db_field, **kwargs):\n if db_field.name == 'issue':\n kwargs['widget'] = ForeignKeyToObjWidget(rel=Org.issues.through._meta.get_field('issue').rel)\n return super(IssuesInline,self).formfield_for_dbfield(db_field,**kwargs)", "metadata": "root.IssuesInline.formfield_for_dbfield", "header": "['class', 'IssuesInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 48 }, { "content": "class LocationsInline(admin.TabularInline):\n model = Org.working_locations.through\n extra = 0\n classes = ('collapse closed',)\n related_field_lookups = {\n 'fk': ['location']\n }\n\n verbose_name = ''\n verbose_name_plural = 'Working In'", "metadata": "root.LocationsInline", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def formfield_for_dbfield(self, db_field, **kwargs):\n if db_field.name == 'location':\n kwargs['widget'] = ForeignKeyToObjWidget(rel=Org.working_locations.through._meta.get_field('location').rel)\n return super(LocationsInline,self).formfield_for_dbfield(db_field,**kwargs)", "metadata": "root.LocationsInline.formfield_for_dbfield", "header": "['class', 'LocationsInline', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 63 }, { "content": "class OrgForm(forms.ModelForm):\n class Meta:\n model = Org\n widgets = {\n 'location': ForeignKeyToObjWidget(rel=Org._meta.get_field('location').rel),\n 'facebook_id' : forms.TextInput(attrs={'class':'vTextField'}),\n 'summary': forms.Textarea(),\n }\n\n class Media:\n js = ['cust_admin/js/widgets.js']\n css = {'all':('cust_admin/css/extend_admin.css',)}", "metadata": "root.OrgForm", "header": "['module', '___EOS___']", "index": 70 }, { "content": "class OrgAdmin(admin.ModelAdmin):\n form = OrgForm\n\n #Org List Page Values\n search_fields = ['name','email', 'handle']\n search_fields_verbose = ['Name', 'Email']\n list_display = ('name', 'date_updated','is_active', 'is_vetted')\n list_filter = ('is_active',)\n ordering = ('name',)\n\n change_list_template = \"cust_admin/change_list.html\"\n\n\n\n #Org Change Page Values\n fieldsets = (\n ('Org Profile', {\n 'fields': (('name','handle',),\n ('is_active', 'is_vetted', 'donation_enabled','is_claimed'),\n ('email', 'ein',),\n ('phone_number','year_founded','revenue','size',),\n ('site_url', 'blog_url',),\n 'img_small_url', 'img_large_url','summary','location',\n ('date_created','date_updated',),)\n }),\n ('Social Settings', {\n 'fields':(\n ('facebook_id', 'twitter_id', ),\n ('youtube_id', 'flickr_id',),\n )\n }),\n (\"Extra Nonsense\", {\n 'classes': ('collapse closed',),\n 'fields':('claim_token',),\n }),\n )\n\n readonly_fields = ['date_created','date_updated']\n inlines = [CenterContentItemInline, LeftContentItemInline, MediaItemInline, TimelineInline, ActionInline, AdvocateInline, AliasInline, AdminsInline, IssuesInline, LocationsInline, ]\n", "metadata": "root.OrgAdmin", "header": "['module', '___EOS___']", "index": 84 }, { "content": " def get_changelist(self, request, **kwargs):\n return ExtChangeList", "metadata": "root.OrgAdmin.get_changelist", "header": "['class', 'OrgAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___EOS___']", "index": 96 }, { "content": " def save_model(self, request, obj, form, change):\n cache.bust(obj, update=False)\n super(self.__class__, self).save_model(request, obj, form, change)", "metadata": "root.OrgAdmin.save_model", "header": "['class', 'OrgAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___EOS___']", "index": 126 } ]
[ { "span": "from issue.models import Issue", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 30 }, { "span": "from org.models import Org, RelatedOrg, OrgIssueRelationship, Alias", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 67 }, { "span": "from users.models import User, Location", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "etc", "_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "entity", "\\u", "items_", "._", "admin_", "import_", "Media", "Item", "Inline_", ",_", "Action", "Inline_", ",_", "Adv", "ocat", "e", "Inline_", ",_", "Time", "line", "Inline_", ",_", "Center", "Conten", "t", "Item", "Inline_", ",_", "Le", "ft", "Conten", "t", "Item", "Inline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "issue_", "._", "models_", "import_", "Issue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "models_", "import_", "Org", "_", ",_", "Rela", "ted", "Org", "_", ",_", "Org", "Issue", "Relationship", "_", ",_", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "users_", "._", "models_", "import_", "User_", ",_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cust", "\\u", "admin_", "._", "views_", "._", "main_", "import_", "Ext", "Change", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cust", "\\u", "admin_", "._", "widgets_", "import_", "Fore", "ign", "Key", "To", "Obj", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "######", "##", " ", "IN", "LINES", " ", "######", "##", "_", "\\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_", "######", "##", " ", "MODEL", " ", "FORM", " ", "AND", " ", "ADM", "IN", " ", "######", "##", "_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin_", "._", "site_", "._", "register_", "(_", "Org", "_", ",_", "Org", "Admin_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ali", "as", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "'", "collapse", " ", "close", "d", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Ali", "as", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Aliase", "s", "\"_", "\\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_", "Admi", "ns", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Org", "_", "._", "admins_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "'", "collapse", " ", "close", "d", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relate", "d\\u", "field", "\\u", "lookups", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fk", "'_", ":_", "[_", "'", "user", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"", "Admi", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Admi", "ns", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "ns", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "user", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "Fore", "ign", "Key", "To", "Obj", "Widget_", "(_", "rel_", "=_", "Org", "_", "._", "admins_", "._", "through_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "'", "user", "'_", ")_", "._", "rel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Admi", "ns", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "db", "\\u", "field_", ",_", "**_", "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_", "class_", "Issues", "In", "line", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Org", "_", "._", "issues_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "'", "rank", "'_", ":_", "forms_", "._", "Hi", "dde", "n", "Input_", "}_", "\\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_", "Issues", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Org", "_", "._", "issues_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Issues", "In", "line", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "'", "collapse", " ", "close", "d", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sortable", "\\u", "field", "\\u", "name_", "=_", "\"", "rank", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relate", "d\\u", "field", "\\u", "lookups", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fk", "'_", ":_", "[_", "'", "issue", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\"", "Work", "ing", " ", "On", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issues", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "issue", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "Fore", "ign", "Key", "To", "Obj", "Widget_", "(_", "rel_", "=_", "Org", "_", "._", "issues_", "._", "through_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "'", "issue", "'_", ")_", "._", "rel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Issues", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "db", "\\u", "field_", ",_", "**_", "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_", "class_", "Locat", "ion", "s", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Org", "_", "._", "working", "\\u", "locations_", "._", "through_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "(_", "'", "collapse", " ", "close", "d", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relate", "d\\u", "field", "\\u", "lookups", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fk", "'_", ":_", "[_", "'", "location", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "'", "Work", "ing", " ", "In", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "s", "Inline_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "self_", ",_", "db", "\\u", "field_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "field_", "._", "name_", "==_", "'", "location", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "widget", "'_", "]_", "=_", "Fore", "ign", "Key", "To", "Obj", "Widget_", "(_", "rel_", "=_", "Org", "_", "._", "working", "\\u", "locations_", "._", "through_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "'", "location", "'_", ")_", "._", "rel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Locat", "ion", "s", "Inline_", ",_", "self_", ")_", "._", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "db", "\\u", "field_", ",_", "**_", "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_", "class_", "Org", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Org", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "Fore", "ign", "Key", "To", "Obj", "Widget_", "(_", "rel_", "=_", "Org", "_", "._", "\\u", "meta_", "._", "get", "\\u", "field_", "(_", "'", "location", "'_", ")_", "._", "rel_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "facebook", "\\u", "id", "'_", ":_", "forms_", "._", "Text", "Input_", "(_", "attrs_", "=_", "{_", "'", "class", "'_", ":_", "'", "v", "Text", "Field", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "summar", "y", "'_", ":_", "forms_", "._", "Textarea_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Media_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "js_", "=_", "[_", "'", "cust", "\\u", "admin", "/", "js", "/", "widget", "s", ".", "js", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css_", "=_", "{_", "'", "all", "'_", ":_", "(_", "'", "cust", "\\u", "admin", "/", "css", "/", "extend", "\\u", "admin", ".", "css", "'_", ",_", ")_", "}_", "\\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_", "Org", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Org", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Org", " ", "List", " ", "Page", " ", "Values_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "email", "'_", ",_", "'", "handle", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "fields", "\\u", "verbose_", "=_", "[_", "'", "Name", "'_", ",_", "'", "Ema", "il", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'", "name", "'_", ",_", "'", "date", "\\u", "update", "d", "'_", ",_", "'", "is", "\\u", "active", "'_", ",_", "'", "is", "\\u", "vet", "ted", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "(_", "'", "is", "\\u", "active", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "(_", "'", "name", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "change", "\\u", "list", "\\u", "template_", "=_", "\"", "cust", "\\u", "admin", "/", "change", "\\u", "list", ".", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Org", " ", "Change", " ", "Page", " ", "Values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fieldsets_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Org", " ", "Profil", "e", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "(_", "(_", "'", "name", "'_", ",_", "'", "handle", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "is", "\\u", "active", "'_", ",_", "'", "is", "\\u", "vet", "ted", "'_", ",_", "'", "donation", "\\u", "enable", "d", "'_", ",_", "'", "is", "\\u", "claimed", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "email", "'_", ",_", "'", "ein", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "phone", "\\u", "number", "'_", ",_", "'", "year", "\\u", "found", "ed", "'_", ",_", "'", "revenu", "e", "'_", ",_", "'", "size", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "site", "\\u", "url", "'_", ",_", "'", "blog", "\\u", "url", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "img", "\\u", "small", "\\u", "url", "'_", ",_", "'", "img", "\\u", "large", "\\u", "url", "'_", ",_", "'", "summar", "y", "'_", ",_", "'", "location", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "\\u", "created", "'_", ",_", "'", "date", "\\u", "update", "d", "'_", ",_", ")_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Soci", "al", " ", "Sett", "ings", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "facebook", "\\u", "id", "'_", ",_", "'", "twit", "ter", "\\u", "id", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "youtu", "be", "\\u", "id", "'_", ",_", "'", "flickr", "\\u", "id", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Extra", " ", "Non", "sense", "\"_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "classe", "s", "'_", ":_", "(_", "'", "collapse", " ", "close", "d", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "(_", "'", "claim", "\\u", "token", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "[_", "'", "date", "\\u", "created", "'_", ",_", "'", "date", "\\u", "update", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inlines_", "=_", "[_", "Center", "Conten", "t", "Item", "Inline_", ",_", "Le", "ft", "Conten", "t", "Item", "Inline_", ",_", "Media", "Item", "Inline_", ",_", "Time", "line", "Inline_", ",_", "Action", "Inline_", ",_", "Adv", "ocat", "e", "Inline_", ",_", "Ali", "as", "Inline_", ",_", "Admi", "ns", "Inline_", ",_", "Issues", "Inline_", ",_", "Locat", "ion", "s", "Inline_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Org", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "changeli", "st_", "(_", "self_", ",_", "request_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ext", "Change", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Org", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "save", "\\u", "model_", "(_", "self_", ",_", "request_", ",_", "obj_", ",_", "form_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "bust", "_", "(_", "obj_", ",_", "update_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "self_", ")_", "._", "save", "\\u", "model_", "(_", "request_", ",_", "obj_", ",_", "form_", ",_", "change_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 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, 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 ]
Except block handles 'BaseException'
fp7-ofelia/ocf/vt_manager/src/python/vt_manager/controller/dispatchers/ui/PolicyDispatcher.py
[ { "content": "def rule_create(request,table_name=None):\n\n\terrors = list()\n\tformMode = request.POST.get(\"conditionMode\")\n\ttableName = request.POST.get(\"table\")\n\tPreviousPriority = request.POST.get(\"ppriority\")\n editing = request.POST.get(\"editing\")\n ruleid = request.POST.get(\"uuid\")\n ruleCondition = request.POST.get(\"condition\")\n ruleDesc = request.POST.get(\"description\")\n ruleError = request.POST.get(\"error_message\")\n ruleType = request.POST.get(\"type\")\n ruleAction = request.POST.get(\"action\")\n ruleValue = request.POST.get(\"value\")\n rulePriority = request.POST.get(\"priority\")\n ruleEnable = request.POST.get(\"enable\")\n previousTable = request.POST.get(\"hidden_name\")\n\texpertRule = request.POST.get(\"expertRule\")\n\tnewConditions = request.POST.get(\"conditionID\")\t\n\tsaved = request.POST.get(\"saved\")\n\n if rulePriority == 'Last' or rulePriority == '':\n priority = None\n else:\n priority = int(rulePriority)\n\n\tif formMode == \"easy\":\n\t#Avoid empty fields\n# \tif ruleDesc == \"\":\n# \terrors.append(\"Description Field is empty\")\n \tif ruleError == \"\":\n \terrors.append(\"Error Message field is empty\")\n \tif ruleCondition == \"\":\n \terrors.append(\"Condition field is empty\")\n\t\ttry:\n\t\t\tstr(ruleDesc)\n\t\texcept:\n\t\t\terrors.append(\"Only ascii characters are allowed in Description field\")\n\t\ttry:\n\t\t\tstr(ruleError)\n\t\texcept:\n\t\t\terrors.append(\"Only ascii characters are allowed in Error Message field\")\n\t\ttry:\n\t\t\tstr(ruleCondition)\n\t\texcept:\n\t\t\terrors.append(\"Only ascii characters are allowed in Conditions\")\n\n\t\n\n if request.POST.get(\"enable\") == 'enable':\n enable = True\n else:\n enable = False\n\tif ruleType == \"terminal\":\n\t\truleType = \"\"\n\t\n\tif saved == None:\n\t\tsaved = False\n\t#Rule String convertion required\n\tif formMode == \"easy\":\n\t\tif ruleAction != \"None\":\n\t\t\tstrings = \"if \" + ruleCondition + \" then \" + ruleValue + \" \" + ruleType + \" do \" + ruleAction + \" denyMessage \" + ruleError + \" #\" + ruleDesc\n\t\telse:\n\t\t\tstrings = \"if \" + ruleCondition + \" then \" + ruleValue + \" \" + ruleType + \" denyMessage \" + ruleError + \" #\" + ruleDesc\n\telse:\n\t\tstrings = expertRule\n\t\ttry:\n\t\t\tstr(expertRule)\n\t\texcept:\n\t\t\terrors.append(\"Only ascii characters are allowed in a Rule\")\n\t\n\ttry:\n\t\tif errors:\n raise Exception(\"\")\n\t\t\n\t\tif editing == '1':\n\t\t\t#Editing Rules Case:\n \tif previousTable == tableName:\n\t\t\t\ttry:\n\t\t\t\t\tRuleTableManager.editRule(strings,enable,priority,PreviousPriority,tableName)\n\t\t\t\texcept Exception as e:\n\t\t\t\t\traise e\n \t#else:\n\t\t\t\t#Moving a rule to a different RuleTable --> this is not possible yet \n \t#print 'Changing table...'\n \t#RuleTableManager.AddRule(strings,enable,priority,tableName=tableName)\n \t#print 'successful add to ' + tableName\n \t#RuleTableManager.RemoveRule(None,int(PreviousPriority),'oldTableName')\n \t#print 'remove from ' + previousTable + ' successful'\n \telse:\n \tRuleTableManager.AddRule(strings,enable,priority,tableName=tableName)\n\n return HttpResponseRedirect(\"/policies\")\t\t\n\n\texcept Exception as e:\n\n\t\terrors.append(e)\n\t\terrors.insert(0,\"The Rule cannot be generated. Reason(s):\")#Insterting the main message error in the first position of the table\n\t\tpriority = RuleTableManager.getPriorityList(tableName)\n\t\tpriority = RuleTableManager.getPriorityList(tableName)\n\t\t\n\t\t#if a rule index is the last, insert \"LAST\" in the rule priority instead the true index.\n\t\ttry:\n\t\t\tint(rulePriority)\n\t\t\tif int(rulePriority) in priority:\n\t\t\t\tpriority.pop(priority.index(int(rulePriority)))\n\t\texcept:\n\t\t\trulePriority = \"Last\"\n\n\t\tif ruleValue == \"accept\":\n\t\t\tvalue2 = [\"deny\"]\n\t\telse:\n\t\t\tvalue2 = [\"accept\"]\n\n\t\tif ruleType == \"nonterminal\":\n\t\t\ttype2 = [\"terminal\"]\n\t\telse:\n\t\t\truleType = \"terminal\"\n\t\t\ttype2 = [\"nonterminal\"]\n\n\n\t\tcontext = {'user': request.user,\n 'saved':True,\n 'CurrentTable':tableName,\n 'priority':PreviousPriority,\n 'enabled':ruleEnable,\n\t\t\t 'load':'True',\n 'valueS':ruleValue,\n 'valueD':value2,\n 'terminalS':ruleType,\n 'terminalD':type2,\n 'errorMsg':ruleError,\n 'description':ruleDesc,\n 'condition':\" \" + ruleCondition + \" \",\n 'ptable':tableName,\n\t\t\t 'edit': request.POST.get('edit'),\n 'action':ruleAction,\n 'PrioritySel':rulePriority,\n 'priorityList':priority,\n 'allMappings':RuleTableManager.GetResolverMappings(tableName),\n 'ConditionMappings':RuleTableManager.getConditionMappings(),\n 'ActionMappings':RuleTableManager.getActionMappings(),\n 'errors': errors,\n 'rule_uuid':ruleid,}\n\n\t\treturn simple.direct_to_template(request,\n \t \t\ttemplate = 'policyEngine/policy_create.html',\n \t\textra_context = context)", "metadata": "root.rule_create", "header": "['module', '___EOS___']", "index": 79 } ]
[ { "span": "except:", "start_line": 115, "start_column": 2, "end_line": 115, "end_column": 9 }, { "span": "except:", "start_line": 119, "start_column": 2, "end_line": 119, "end_column": 9 }, { "span": "except:", "start_line": 123, "start_column": 2, "end_line": 123, "end_column": 9 }, { "span": "except:", "start_line": 147, "start_column": 2, "end_line": 147, "end_column": 9 }, { "span": "except:", "start_line": 185, "start_column": 2, "end_line": 185, "end_column": 9 } ]
[]
1
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_", "rule", "\\u", "create_", "(_", "request_", ",_", "table", "\\u", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "errors_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "Mode_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "condition", "Mode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Name_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Prev", "ious", "Priority_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "ppr", "ior", "it", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "editin", "g_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "editin", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "id_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "uuid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Condition_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "condition", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Desc_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Error_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "error", "\\u", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Type_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Action_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "action", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Value_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Priority_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "priorit", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "Enable_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "enable", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previ", "ous", "Table_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "hidden", "\\u", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expert", "Rule_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "expert", "Rule", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Conditions", "_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "condition", "ID", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "saved", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rule", "Priority_", "==_", "'", "Las", "t", "'_", "or_", "rule", "Priority_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "priority_", "=_", "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 ", " _", "priority_", "=_", "int_", "(_", "rule", "Priority_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form", "Mode_", "==_", "\"", "easy", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Av", "oid", " ", "empty", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " \t", "if", " ", "rule", "Des", "c", " ", "==", " ", "\"\"", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\t", "error", "s", ".", "append", "(\"", "Descripti", "on", " ", "Field", " ", "is", " ", "empty", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "_", "if_", "rule", "Error_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " ", "\t_", "errors_", "._", "append_", "(_", "\"", "Error", " ", "Messag", "e", " ", "field", " ", "is", " ", "empty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule", "Condition_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " ", "\t_", "errors_", "._", "append_", "(_", "\"", "Cond", "ition", " ", "field", " ", "is", " ", "empty", "\"_", ")_", "\\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\t", "\t\t_", "str_", "(_", "rule", "Desc_", ")_", "\\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\t", "\t\t_", "errors_", "._", "append_", "(_", "\"", "On", "ly", " ", "ascii", " ", "character", "s", " ", "are", " ", "allow", "ed", " ", "in", " ", "Descripti", "on", " ", "field", "\"_", ")_", "\\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\t", "\t\t_", "str_", "(_", "rule", "Error_", ")_", "\\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\t", "\t\t_", "errors_", "._", "append_", "(_", "\"", "On", "ly", " ", "ascii", " ", "character", "s", " ", "are", " ", "allow", "ed", " ", "in", " ", "Error", " ", "Messag", "e", " ", "field", "\"_", ")_", "\\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\t", "\t\t_", "str_", "(_", "rule", "Condition_", ")_", "\\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\t", "\t\t_", "errors_", "._", "append_", "(_", "\"", "On", "ly", " ", "ascii", " ", "character", "s", " ", "are", " ", "allow", "ed", " ", "in", " ", "Conditions", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "enable", "\"_", ")_", "==_", "'", "enable", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enable_", "=_", "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 ", " _", "enable_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule", "Type_", "==_", "\"", "termina", "l", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "rule", "Type_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "saved_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "saved_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Rule", " ", "String", " ", "convert", "ion", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form", "Mode_", "==_", "\"", "easy", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "rule", "Action_", "!=_", "\"", "Non", "e", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "strings_", "=_", "\"", "if", " ", "\"_", "+_", "rule", "Condition_", "+_", "\"", " ", "then", " ", "\"_", "+_", "rule", "Value_", "+_", "\"", " ", "\"_", "+_", "rule", "Type_", "+_", "\"", " ", "do", " ", "\"_", "+_", "rule", "Action_", "+_", "\"", " ", "deny", "Messag", "e", " ", "\"_", "+_", "rule", "Error_", "+_", "\"", " ", "#\"_", "+_", "rule", "Desc_", "\\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", "\t\t_", "strings_", "=_", "\"", "if", " ", "\"_", "+_", "rule", "Condition_", "+_", "\"", " ", "then", " ", "\"_", "+_", "rule", "Value_", "+_", "\"", " ", "\"_", "+_", "rule", "Type_", "+_", "\"", " ", "deny", "Messag", "e", " ", "\"_", "+_", "rule", "Error_", "+_", "\"", " ", "#\"_", "+_", "rule", "Desc_", "\\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\t", "\t_", "strings_", "=_", "expert", "Rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "str_", "(_", "expert", "Rule_", ")_", "\\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\t", "\t\t_", "errors_", "._", "append_", "(_", "\"", "On", "ly", " ", "ascii", " ", "character", "s", " ", "are", " ", "allow", "ed", " ", "in", " ", "a", " ", "Rule", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Exception_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "editin", "g_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Editing", " ", "Rule", "s", " ", "Case", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " ", "\t_", "if_", "previ", "ous", "Table_", "==_", "table", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "Rule", "Table", "Manager_", "._", "edit", "Rule_", "(_", "strings_", ",_", "enable_", ",_", "priority_", ",_", "Prev", "ious", "Priority_", ",_", "table", "Name_", ")_", "\\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\t", "\t\t\t\t_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Movi", "ng", " ", "a", " ", "rule", " ", "to", " ", "a", " ", "different", " ", "Rule", "Table", " ", "-->", " ", "this", " ", "is", " ", "not", " ", "possib", "le", " ", "ye", "t", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "Chang", "ing", " ", "table", "...'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Rule", "Table", "Manager", ".", "Add", "Rule", "(", "string", "s", ",", "enable", ",", "priorit", "y", ",", "table", "Name", "=", "table", "Name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "success", "ful", " ", "add", " ", "to", " ", "'", " ", "+", " ", "table", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Rule", "Table", "Manager", ".", "Remove", "Rule", "(", "Non", "e", ",", "int", "(", "Prev", "ious", "Prior", "it", "y", "),", "'", "old", "Table", "Name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "remove", " ", "from", " ", "'", " ", "+", " ", " ", "previ", "ous", "Table", " ", "+", " ", "'", " ", "success", "ful", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " ", " ", " ", "\t_", "Rule", "Table", "Manager_", "._", "Add", "Rule_", "(_", "strings_", ",_", "enable_", ",_", "priority_", ",_", "table", "Name_", "=_", "table", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "\"/", "poli", "cies", "\"_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "errors_", "._", "append_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "._", "insert_", "(_", "0_", ",_", "\"", "The", " ", "Rule", " ", "cann", "ot", " ", "be", " ", "generat", "ed", ".", " ", "Rea", "son", "(", "s", "):\"_", ")_", "#", "Ins", "ter", "ting", " ", "the", " ", "main", " ", "message", " ", "error", " ", "in", " ", "the", " ", "first", " ", "position", " ", "of", " ", "the", " ", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "priority_", "=_", "Rule", "Table", "Manager_", "._", "get", "Prior", "it", "y", "List_", "(_", "table", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "priority_", "=_", "Rule", "Table", "Manager_", "._", "get", "Prior", "it", "y", "List_", "(_", "table", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "a", " ", "rule", " ", "index", " ", "is", " ", "the", " ", "last", ",", " ", "insert", " ", "\"", "LAS", "T", "\"", " ", "in", " ", "the", " ", "rule", " ", "priorit", "y", " ", "inst", "ead", " ", "the", " ", "true", " ", "index", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "int_", "(_", "rule", "Priority_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "rule", "Priority_", ")_", "in_", "priority_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "priority_", "._", "pop_", "(_", "priority_", "._", "index_", "(_", "int_", "(_", "rule", "Priority_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "rule", "Priority_", "=_", "\"", "Las", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule", "Value_", "==_", "\"", "accept", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "value2_", "=_", "[_", "\"", "deny", "\"_", "]_", "\\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", "\t\t_", "value2_", "=_", "[_", "\"", "accept", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rule", "Type_", "==_", "\"", "nont", "ermina", "l", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "type2_", "=_", "[_", "\"", "termina", "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\t", "\t\t_", "rule", "Type_", "=_", "\"", "termina", "l", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type2_", "=_", "[_", "\"", "nont", "ermina", "l", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "'", "user", "'_", ":_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "saved", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Curr", "ent", "Table", "'_", ":_", "table", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "'_", ":_", "Prev", "ious", "Priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enable", "d", "'_", ":_", "rule", "Enable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "load", "'_", ":_", "'", "Tru", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "S", "'_", ":_", "rule", "Value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "D", "'_", ":_", "value2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "termina", "l", "S", "'_", ":_", "rule", "Type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "termina", "l", "D", "'_", ":_", "type2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "Msg", "'_", ":_", "rule", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "rule", "Desc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "'_", ":_", "\"", " ", "\"_", "+_", "rule", "Condition_", "+_", "\"", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ptable", "'_", ":_", "table", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "edit", "'_", ":_", "request_", "._", "POST_", "._", "get_", "(_", "'", "edit", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "'_", ":_", "rule", "Action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prior", "it", "y", "Sel", "'_", ":_", "rule", "Priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "List", "'_", ":_", "priority_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "Mappings", "'_", ":_", "Rule", "Table", "Manager_", "._", "Get", "Resolv", "er", "Mappings", "_", "(_", "table", "Name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cond", "ition", "Mappings", "'_", ":_", "Rule", "Table", "Manager_", "._", "get", "Cond", "ition", "Mappings", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Action", "Mappings", "'_", ":_", "Rule", "Table", "Manager_", "._", "get", "Action", "Mappings", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rule", "\\u", "uuid", "'_", ":_", "rule", "id_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "simple_", "._", "direct", "\\u", "to", "\\u", "template_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "'", "policy", "Engine", "/", "policy", "\\u", "create", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "context_", ")_", "\\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,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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 ]
Imprecise assert
erkyrath/tworld/lib/twest/test_propcache.py
[ { "content": " @tornado.testing.gen_test\n def test_simple_ops(self):\n yield self.resetTables()\n \n # Fresh propcache for each test (don't use app.propcache).\n cache = two.propcache.PropCache(self.app)\n deps = set()\n\n instq = lambda key: ('instanceprop', self.exiid, self.exlocid, key)\n\n # Get some values.\n\n res = yield cache.get(instq('x'), dependencies=deps)\n self.assertEqual(res.val, 1)\n self.assertTrue(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'x')\n self.assertFalse(res.mutable)\n self.assertTrue(instq('x') in deps)\n self.assertTrue(cache.get_by_object(res.val) is None)\n \n res = yield cache.get(instq('qqq'), dependencies=deps)\n self.assertTrue(res is None)\n res = yield cache.get(instq('qqq'), dependencies=deps)\n self.assertTrue(res is None)\n self.assertTrue(instq('qqq') in deps)\n # Peek into cache internals for additional testing\n res = cache.propmap[instq('qqq')]\n self.assertFalse(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'qqq')\n \n res = yield cache.get(instq('ls'), dependencies=deps)\n self.assertEqual(res.val, [1,2,3])\n self.assertTrue(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'ls')\n self.assertTrue(res.mutable)\n self.assertTrue(instq('ls') in deps)\n self.assertTrue(cache.get_by_object(res.val) is res)\n\n res2 = yield cache.get(instq('ls'), dependencies=deps)\n self.assertTrue(res is res2)\n\n res = yield cache.get(instq('map'), dependencies=deps)\n self.assertEqual(res.val, {'one':1, 'two':2, 'three':3})\n self.assertTrue(res.found)\n self.assertFalse(res.dirty)\n self.assertFalse(res.haschanged())\n self.assertEqual(res.key, 'map')\n self.assertTrue(res.mutable)\n self.assertTrue(instq('map') in deps)\n self.assertTrue(cache.get_by_object(res.val) is res)\n\n self.assertEqual(cache.note_changed_entries(), [])\n self.assertEqual(cache.dirty_entries(), [])\n\n # Set some values.\n\n yield cache.set(instq('y'), 7)\n res = yield cache.get(instq('y'), dependencies=deps)\n self.assertEqual(res.val, 7)\n self.assertTrue(res.dirty)\n self.assertFalse(res.haschanged())\n \n res = yield self.get_db_prop(instq('y'))\n self.assertEqual(res, 2)\n\n yield cache.set(instq('z'), 3)\n res = yield cache.get(instq('z'), dependencies=deps)\n self.assertEqual(res.val, 3)\n self.assertTrue(res.dirty)\n self.assertFalse(res.haschanged())\n \n res = yield self.get_db_prop(instq('z'))\n self.assertEqual(res, NotFound)\n\n self.assertEqual(cache.note_changed_entries(), [])\n self.assertEqual(len(cache.dirty_entries()), 2)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res = yield cache.get(instq('y'), dependencies=deps)\n self.assertEqual(res.val, 7)\n res = yield self.get_db_prop(instq('y'))\n self.assertEqual(res, 7)\n \n res = yield cache.get(instq('z'), dependencies=deps)\n self.assertEqual(res.val, 3)\n res = yield self.get_db_prop(instq('z'))\n self.assertEqual(res, 3)\n\n yield cache.set(instq('listtuple'), (1,2,3))\n res = yield cache.get(instq('listtuple'), dependencies=deps)\n self.assertEqual(res.val, (1,2,3))\n \n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n\n res = yield self.get_db_prop(instq('listtuple'))\n self.assertEqual(res, [1,2,3])\n \n # Delete some values.\n\n yield cache.delete(instq('x'))\n res = yield cache.get(instq('x'), dependencies=deps)\n self.assertTrue(res is None)\n\n res = yield self.get_db_prop(instq('x'))\n self.assertEqual(res, 1)\n \n yield cache.delete(instq('qqqq'))\n res = yield cache.get(instq('qqqq'), dependencies=deps)\n self.assertTrue(res is None)\n \n yield cache.delete(instq('map'))\n res = yield cache.get(instq('map'), dependencies=deps)\n self.assertTrue(res is None)\n\n res = yield self.get_db_prop(instq('map'))\n self.assertEqual(res, {'one':1, 'two':2, 'three':3})\n \n self.assertEqual(cache.note_changed_entries(), [])\n self.assertEqual(len(cache.dirty_entries()), 3)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res = yield self.get_db_prop(instq('x'))\n self.assertEqual(res, NotFound)\n res = yield self.get_db_prop(instq('qqqq'))\n self.assertEqual(res, NotFound)\n res = yield self.get_db_prop(instq('map'))\n self.assertEqual(res, NotFound)\n \n yield cache.delete(instq('x'))\n res = yield cache.get(instq('x'), dependencies=deps)\n self.assertTrue(res is None)", "metadata": "root.TestPropcache.test_simple_ops", "header": "['class', 'TestPropcache', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " @tornado.testing.gen_test\n def test_mutable_values(self):\n yield self.resetTables()\n \n # Fresh propcache for each test (don't use app.propcache).\n cache = two.propcache.PropCache(self.app)\n\n instq = lambda key: ('instanceprop', self.exiid, self.exlocid, key)\n\n res = yield cache.get(instq('ls'))\n self.assertFalse(res.haschanged())\n\n ls = res.val\n ls.append(4)\n \n self.assertFalse(res.dirty)\n self.assertTrue(res.haschanged())\n \n res2 = yield cache.get(instq('ls'))\n self.assertEqual(res2.val, [1,2,3,4])\n \n res = yield self.get_db_prop(instq('ls'))\n self.assertEqual(res, [1,2,3])\n\n self.assertEqual(len(cache.note_changed_entries()), 1)\n self.assertEqual(len(cache.dirty_entries()), 1)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res = yield self.get_db_prop(instq('ls'))\n self.assertEqual(res, [1,2,3,4])\n \n res2 = yield cache.get(instq('ls'))\n self.assertEqual(res2.val, [1,2,3,4])\n \n res = yield cache.get(instq('map'))\n map = res.val\n self.assertTrue(cache.get_by_object(map) is res)\n\n ls[0] = 'zero'\n map['zero'] = 'ZERO'\n\n self.assertTrue(cache.get_by_object(map) is res)\n self.assertEqual(len(cache.note_changed_entries()), 2)\n self.assertEqual(len(cache.dirty_entries()), 2)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res2 = yield cache.get(instq('ls'))\n self.assertEqual(res2.val, ['zero',2,3,4])\n res2 = yield cache.get(instq('map'))\n self.assertEqual(res2.val, {'one':1, 'two':2, 'three':3, 'zero':'ZERO'})\n\n res = yield self.get_db_prop(instq('ls'))\n self.assertEqual(res, ['zero',2,3,4])\n res = yield self.get_db_prop(instq('map'))\n self.assertEqual(res, {'one':1, 'two':2, 'three':3, 'zero':'ZERO'})\n \n map['tt'] = 44\n yield cache.set(instq('map'), {'tt':33})\n map['tt'] = 55\n\n self.assertEqual(cache.note_changed_entries(), []) ####\n self.assertEqual(len(cache.dirty_entries()), 1)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n \n res2 = yield cache.get(instq('map'))\n self.assertEqual(res2.val, {'tt':33})\n self.assertFalse(res2.val is map)\n\n res = yield self.get_db_prop(instq('map'))\n self.assertEqual(res, {'tt':33})", "metadata": "root.TestPropcache.test_mutable_values", "header": "['class', 'TestPropcache', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 194 }, { "content": " @tornado.testing.gen_test\n def test_prop_aliasing(self):\n yield self.resetTables()\n \n # Fresh propcache for each test (don't use app.propcache).\n cache = two.propcache.PropCache(self.app)\n\n instq = lambda key: ('instanceprop', self.exiid, self.exlocid, key)\n\n # x = True; y = True; del x; del y\n\n yield cache.set(instq('xx'), True)\n yield cache.set(instq('yy'), True)\n yield cache.delete(instq('xx'))\n yield cache.delete(instq('yy'))\n\n res = yield cache.get(instq('xx'))\n self.assertTrue(res is None)\n res = yield cache.get(instq('yy'))\n self.assertTrue(res is None)\n \n self.assertTrue(cache.get_by_object(True) is None)\n\n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n\n # _t = []; x = _t; y = _t; del x; del y\n \n ls = [2,3,4]\n yield cache.set(instq('xxx'), ls)\n yield cache.set(instq('yyy'), ls)\n\n res = cache.get_by_object(ls) # might get either prop\n self.assertTrue(res.val is ls)\n self.assertTrue(res.key in ('xxx', 'yyy'))\n \n yield cache.delete(instq('xxx'))\n yield cache.delete(instq('yyy'))\n \n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n\n res = yield cache.get(instq('xxx'))\n self.assertTrue(res is None)\n res = yield cache.get(instq('yyy'))\n self.assertTrue(res is None)\n \n # _t = []; x = _t; y = _t; _t.append(1)\n\n ls = [2,3,4]\n yield cache.set(instq('xx'), ls)\n yield cache.set(instq('yy'), ls)\n\n ls.append(1)\n \n res = yield cache.get(instq('xx'))\n self.assertEqual(res.val, [2,3,4,1])\n res = yield cache.get(instq('yy'))\n self.assertEqual(res.val, [2,3,4,1])\n \n ls.insert(0, -1)\n \n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n\n res = yield cache.get(instq('xx'))\n self.assertEqual(res.val, [-1,2,3,4,1])\n res = yield cache.get(instq('yy'))\n self.assertEqual(res.val, [-1,2,3,4,1])\n\n # _t = {}; x = _t; y = _t; x['one'] = 1\n \n map = {}\n yield cache.set(instq('map'), map)\n yield cache.set(instq('map2'), map)\n\n map['one'] = 1\n \n self.assertEqual(cache.note_changed_entries(), [])\n yield cache.write_all_dirty()\n self.assertEqual(cache.dirty_entries(), [])\n\n res = yield cache.get(instq('map'))\n self.assertEqual(res.val, {'one':1})\n res = yield cache.get(instq('map2'))\n self.assertEqual(res.val, {'one':1})", "metadata": "root.TestPropcache.test_prop_aliasing", "header": "['class', 'TestPropcache', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 274 }, { "content": " def test_deepcopy(self):\n deepcopy = two.propcache.deepcopy\n \n val = None\n self.assertTrue(deepcopy(val) is val)\n val = True\n self.assertTrue(deepcopy(val) is val)\n val = 5\n self.assertTrue(deepcopy(val) is val)\n val = -2.5\n self.assertTrue(deepcopy(val) is val)\n val = ObjectId()\n self.assertTrue(deepcopy(val) is val)\n\n val = []\n res = deepcopy(val)\n self.assertFalse(val is res)\n self.assertEqual(val, res)\n val.append(1)\n self.assertNotEqual(val, res)\n \n val = {}\n res = deepcopy(val)\n self.assertFalse(val is res)\n self.assertEqual(val, res)\n\n val = [1, [2, {}], {'x':'y', 'z':[1,2]}]\n res = deepcopy(val)\n self.assertFalse(val is res)\n self.assertEqual(val, res)\n self.assertTrue(val[0] is res[0])\n self.assertFalse(val[1] is res[1])\n self.assertEqual(val[1], res[1])\n self.assertFalse(val[2] is res[2])\n self.assertEqual(val[2], res[2])\n self.assertFalse(val[2]['z'] is res[2]['z'])\n self.assertEqual(val[2]['z'], res[2]['z'])\n\n loopobj = []\n loopobj.append(loopobj)\n with self.assertRaises(TypeError):\n deepcopy(loopobj)\n \n loopobj = {}\n loopobj['key'] = loopobj\n with self.assertRaises(TypeError):\n deepcopy(loopobj)", "metadata": "root.TestDeepCopy.test_deepcopy", "header": "['class', 'TestDeepCopy', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 417 } ]
[ { "span": "self.assertTrue(instq('x') in deps)", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 43 }, { "span": "self.assertTrue(cache.get_by_object(res.val) is None)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 61 }, { "span": "self.assertTrue(res is None)", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 36 }, { "span": "self.assertTrue(res is None)", "start_line": 73, "start_column": 8, "end_line": 73, "end_column": 36 }, { "span": "self.assertTrue(instq('qqq') in deps)", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 45 }, { "span": "self.assertTrue(instq('ls') in deps)", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 44 }, { "span": "self.assertTrue(cache.get_by_object(res.val) is res)", "start_line": 90, "start_column": 8, "end_line": 90, "end_column": 60 }, { "span": "self.assertTrue(res is res2)", "start_line": 93, "start_column": 8, "end_line": 93, "end_column": 36 }, { "span": "self.assertTrue(instq('map') in deps)", "start_line": 102, "start_column": 8, "end_line": 102, "end_column": 45 }, { "span": "self.assertTrue(cache.get_by_object(res.val) is res)", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 60 }, { "span": "self.assertTrue(res is None)", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 36 }, { "span": "self.assertTrue(res is None)", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 36 }, { "span": "self.assertTrue(res is None)", "start_line": 171, "start_column": 8, "end_line": 171, "end_column": 36 }, { "span": "self.assertTrue(res is None)", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 36 }, { "span": "self.assertTrue(cache.get_by_object(map) is res)", "start_line": 233, "start_column": 8, "end_line": 233, "end_column": 56 }, { "span": "self.assertTrue(cache.get_by_object(map) is res)", "start_line": 238, "start_column": 8, "end_line": 238, "end_column": 56 }, { "span": "self.assertFalse(res2.val is map)", "start_line": 269, "start_column": 8, "end_line": 269, "end_column": 41 }, { "span": "self.assertTrue(res is None)", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 36 }, { "span": "self.assertTrue(res is None)", "start_line": 293, "start_column": 8, "end_line": 293, "end_column": 36 }, { "span": "self.assertTrue(cache.get_by_object(True) is None)", "start_line": 295, "start_column": 8, "end_line": 295, "end_column": 58 }, { "span": "self.assertTrue(res.val is ls)", "start_line": 308, "start_column": 8, "end_line": 308, "end_column": 38 }, { "span": "self.assertTrue(res.key in ('xxx', 'yyy'))", "start_line": 309, "start_column": 8, "end_line": 309, "end_column": 50 }, { "span": "self.assertTrue(res is None)", "start_line": 319, "start_column": 8, "end_line": 319, "end_column": 36 }, { "span": "self.assertTrue(res is None)", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 36 }, { "span": "self.assertTrue(deepcopy(val) is val)", "start_line": 421, "start_column": 8, "end_line": 421, "end_column": 45 }, { "span": "self.assertTrue(deepcopy(val) is val)", "start_line": 423, "start_column": 8, "end_line": 423, "end_column": 45 }, { "span": "self.assertTrue(deepcopy(val) is val)", "start_line": 425, "start_column": 8, "end_line": 425, "end_column": 45 }, { "span": "self.assertTrue(deepcopy(val) is val)", "start_line": 427, "start_column": 8, "end_line": 427, "end_column": 45 }, { "span": "self.assertTrue(deepcopy(val) is val)", "start_line": 429, "start_column": 8, "end_line": 429, "end_column": 45 }, { "span": "self.assertFalse(val is res)", "start_line": 433, "start_column": 8, "end_line": 433, "end_column": 36 }, { "span": "self.assertFalse(val is res)", "start_line": 440, "start_column": 8, "end_line": 440, "end_column": 36 }, { "span": "self.assertFalse(val is res)", "start_line": 445, "start_column": 8, "end_line": 445, "end_column": 36 }, { "span": "self.assertTrue(val[0] is res[0])", "start_line": 447, "start_column": 8, "end_line": 447, "end_column": 41 }, { "span": "self.assertFalse(val[1] is res[1])", "start_line": 448, "start_column": 8, "end_line": 448, "end_column": 42 }, { "span": "self.assertFalse(val[2] is res[2])", "start_line": 450, "start_column": 8, "end_line": 450, "end_column": 42 }, { "span": "self.assertFalse(val[2]['z'] is res[2]['z'])", "start_line": 452, "start_column": 8, "end_line": 452, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Prop", "cache_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "ops_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fre", "sh", " ", "prop", "cache", " ", "for", " ", "each", " ", "test", " ", "(", "don", "'", "t", " ", "use", " ", "app", ".", "prop", "cache", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "two_", "._", "prop", "cache_", "._", "Prop", "Cache_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deps_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "q_", "=_", "lambda_", "key_", ":_", "(_", "'", "instance", "prop", "'_", ",_", "self_", "._", "exi", "id_", ",_", "self_", "._", "ex", "loci", "d_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "some", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "mutable", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "res_", "._", "val_", ")_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pe", "ek", " ", "int", "o", " ", "cache", " ", "internals", " ", "for", " ", "addition", "al", " ", "testing_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "cache_", "._", "prop", "map_", "[_", "inst", "q_", "(_", "'", "qq", "q", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "qq", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "ls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "mutable", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "res_", "._", "val_", ")_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "res2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", ",_", "'", "three", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "key_", ",_", "'", "map", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "mutable", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", "in_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "res_", "._", "val_", ")_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "some", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "list", "tuple", "'_", ")_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "list", "tuple", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "list", "tuple", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "some", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "qq", "qq", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "qq", "qq", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", ",_", "'", "three", "'_", ":_", "3_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "qq", "qq", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Not", "Found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "x", "'_", ")_", ",_", "dependencies_", "=_", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Prop", "cache_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "mutable", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fre", "sh", " ", "prop", "cache", " ", "for", " ", "each", " ", "test", " ", "(", "don", "'", "t", " ", "use", " ", "app", ".", "prop", "cache", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "two_", "._", "prop", "cache_", "._", "Prop", "Cache_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "q_", "=_", "lambda_", "key_", ":_", "(_", "'", "instance", "prop", "'_", ",_", "self_", "._", "exi", "id_", ",_", "self_", "._", "ex", "loci", "d_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "=_", "res_", "._", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "._", "append_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res_", "._", "dirty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "has", "changed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res2_", "._", "val_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res2_", "._", "val_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "=_", "res_", "._", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "map_", ")_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "[_", "0_", "]_", "=_", "'", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "[_", "'", "zero", "'_", "]_", "=_", "'", "ZERO", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "map_", ")_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res2_", "._", "val_", ",_", "[_", "'", "zero", "'_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res2_", "._", "val_", ",_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", ",_", "'", "three", "'_", ":_", "3_", ",_", "'", "zero", "'_", ":_", "'", "ZERO", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "ls", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "'", "zero", "'_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "{_", "'", "one", "'_", ":_", "1_", ",_", "'", "two", "'_", ":_", "2_", ",_", "'", "three", "'_", ":_", "3_", ",_", "'", "zero", "'_", ":_", "'", "ZERO", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "map_", "[_", "'", "tt", "'_", "]_", "=_", "44_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ",_", "{_", "'", "tt", "'_", ":_", "33_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "[_", "'", "tt", "'_", "]_", "=_", "55_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "###", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res2_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res2_", "._", "val_", ",_", "{_", "'", "tt", "'_", ":_", "33_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "res2_", "._", "val_", "is_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "self_", "._", "get", "\\u", "db", "\\u", "prop_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "{_", "'", "tt", "'_", ":_", "33_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Prop", "cache_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "prop", "\\u", "alias", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fre", "sh", " ", "prop", "cache", " ", "for", " ", "each", " ", "test", " ", "(", "don", "'", "t", " ", "use", " ", "app", ".", "prop", "cache", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "two_", "._", "prop", "cache_", "._", "Prop", "Cache_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "q_", "=_", "lambda_", "key_", ":_", "(_", "'", "instance", "prop", "'_", ",_", "self_", "._", "exi", "id_", ",_", "self_", "._", "ex", "loci", "d_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", " ", "=", " ", "Tru", "e", ";", " ", "y", " ", "=", " ", "Tru", "e", ";", " ", "del", " ", "x", ";", " ", "del", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "xx", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "yy", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "xx", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "yy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "xx", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "yy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "True_", ")_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "t", " ", "=", " ", "[]", ";", " ", "x", " ", "=", " ", "\\u", "t", ";", " ", "y", " ", "=", " ", "\\u", "t", ";", " ", "del", " ", "x", ";", " ", "del", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "=_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "xxx", "'_", ")_", ",_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "yyy", "'_", ")_", ",_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "cache_", "._", "get", "\\u", "by", "\\u", "object_", "(_", "ls_", ")_", "#", " ", "mig", "ht", " ", "get", " ", "eit", "her", " ", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "val_", "is_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "._", "key_", "in_", "(_", "'", "xxx", "'_", ",_", "'", "yyy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "xxx", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "delete_", "(_", "inst", "q_", "(_", "'", "yyy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "xxx", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "yyy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "res_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "t", " ", "=", " ", "[]", ";", " ", "x", " ", "=", " ", "\\u", "t", ";", " ", "y", " ", "=", " ", "\\u", "t", ";", " ", "\\u", "t", ".", "append", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "=_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "xx", "'_", ")_", ",_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "yy", "'_", ")_", ",_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "xx", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "[_", "2_", ",_", "3_", ",_", "4_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "yy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "[_", "2_", ",_", "3_", ",_", "4_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "._", "insert_", "(_", "0_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "xx", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "[_", "-_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "yy", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "[_", "-_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "t", " ", "=", " ", "{};", " ", "x", " ", "=", " ", "\\u", "t", ";", " ", "y", " ", "=", " ", "\\u", "t", ";", " ", "x", "['", "one", "']", " ", "=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ",_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "set_", "(_", "inst", "q_", "(_", "'", "map", "2", "'_", ")_", ",_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "map_", "[_", "'", "one", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "note", "\\u", "change", "d\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cache_", "._", "write", "\\u", "all", "\\u", "dirty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cache_", "._", "dir", "ty", "\\u", "entries_", "(_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "{_", "'", "one", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "cache_", "._", "get_", "(_", "inst", "q_", "(_", "'", "map", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "val_", ",_", "{_", "'", "one", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "De", "ep", "Copy_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "deepcopy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deepcopy_", "=_", "two_", "._", "prop", "cache_", "._", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "deepcopy_", "(_", "val_", ")_", "is_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "deepcopy_", "(_", "val_", ")_", "is_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "deepcopy_", "(_", "val_", ")_", "is_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "-_", "2.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "deepcopy_", "(_", "val_", ")_", "is_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "Object", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "deepcopy_", "(_", "val_", ")_", "is_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "deepcopy_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "val_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "val_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "deepcopy_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "val_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "[_", "1_", ",_", "[_", "2_", ",_", "{_", "}_", "]_", ",_", "{_", "'", "x", "'_", ":_", "'", "y", "'_", ",_", "'", "z", "'_", ":_", "[_", "1_", ",_", "2_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "deepcopy_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "val_", "is_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "val_", "[_", "0_", "]_", "is_", "res_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "val_", "[_", "1_", "]_", "is_", "res_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", "[_", "1_", "]_", ",_", "res_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "val_", "[_", "2_", "]_", "is_", "res_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", "[_", "2_", "]_", ",_", "res_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "val_", "[_", "2_", "]_", "[_", "'", "z", "'_", "]_", "is_", "res_", "[_", "2_", "]_", "[_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "val_", "[_", "2_", "]_", "[_", "'", "z", "'_", "]_", ",_", "res_", "[_", "2_", "]_", "[_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loop", "obj_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop", "obj_", "._", "append_", "(_", "loop", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deepcopy_", "(_", "loop", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop", "obj_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loop", "obj_", "[_", "'", "key", "'_", "]_", "=_", "loop", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deepcopy_", "(_", "loop", "obj_", ")_" ]
[ 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, 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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 ]
Unused import
rdhyee/working-open-data-2014/notebooks/Day_14_A_Pivot_table_example.py
[ { "content": "# -*- coding: utf-8 -*-\n# <nbformat>3.0</nbformat>\n\n# <markdowncell>\n\n# A simple demonstration of pivot_table. [Reshaping and Pivot Tables — pandas 0.13.1 documentation](http://pandas.pydata.org/pandas-docs/stable/reshaping.html)\n\n# <codecell>\n\nimport pandas as pd\nfrom pandas import DataFrame, Series\n\n# <codecell>\n\ndf = DataFrame([{\n'year':1880,\n'name':'John',\n'sex': 'M',\n'births': 13\n},\n{'year':1880,\n'name':'Pat',\n'sex': 'M',\n'births': 13\n},\n{'year':1880,\n'name':'Pat',\n'sex': 'F',\n'births': 13\n},\n{\n'year':1880,\n'name':'Jane',\n'sex': 'F',\n'births': 20\n}, \n{\n'year':1881,\n'name':'John',\n'sex': 'M',\n'births': 90\n},\n{\n'year':1881,\n'name':'Jane',\n'sex': 'F',\n'births': 21\n},])\n\ndf\n\n# <codecell>\n\npt = df.pivot_table(rows='year', cols=['name','sex'])['births']\npt\n\n# <codecell>\n\n# let's make a new table in which there is M/F subindex for all names\n\nnames = set(pt.columns.get_level_values(level=0))\nsexes = set(pt.columns.get_level_values(level=1))\nnames, sexes\n\n# <codecell>\n\n# http://pandas.pydata.org/pandas-docs/stable/indexing.html#creating-a-multiindex-hierarchical-index-object\n\nnew_index = pd.MultiIndex.from_product([list(names), list(sexes)],\n names=['name','sex'])\nnew_index\n\n# <codecell>\n\n# http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.reindex.html\n\npt.T.reindex(new_index).T\n\n# <codecell>\n\npt.T.reindex(new_index).T.fillna(0)\n\n# <codecell>\n\ndf.groupby('year').apply(lambda s: s.groupby(['name','sex']).agg('sum'))\n\n# <codecell>\n\ndf.groupby('year').apply(lambda s: s.groupby(['name','sex']).agg('sum')).unstack()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from pandas import DataFrame, Series", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "nb", "format", ">", "3.0", "</", "nb", "format", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "mark", "down", "cell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "simple", " ", "demonstrat", "ion", " ", "of", " ", "piv", "ot", "\\u", "table", ".", " ", "[", "Res", "hap", "ing", " ", "and", " ", "Pivot", " ", "Table", "s", " ", "\\", "821", "2", ";", " ", "panda", "s", " ", "0.13", ".1", " ", "documentation", "](", "http", "://", "panda", "s", ".", "pyda", "ta", ".", "org", "/", "panda", "s", "-", "docs", "/", "stable", "/", "resh", "api", "ng", ".", "html", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pandas_", "import_", "Data", "Frame_", ",_", "Series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "=_", "Data", "Frame_", "(_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "188", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sex", "'_", ":_", "'", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "s", "'_", ":_", "13_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "year", "'_", ":_", "188", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Pat", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sex", "'_", ":_", "'", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "s", "'_", ":_", "13_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "year", "'_", ":_", "188", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Pat", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sex", "'_", ":_", "'", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "s", "'_", ":_", "13_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "188", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Jan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sex", "'_", ":_", "'", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "s", "'_", ":_", "20_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "188", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sex", "'_", ":_", "'", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "s", "'_", ":_", "90_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "188", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Jan", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sex", "'_", ":_", "'", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birth", "s", "'_", ":_", "21_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "=_", "df_", "._", "piv", "ot", "\\u", "table_", "(_", "rows_", "=_", "'", "year", "'_", ",_", "cols_", "=_", "[_", "'", "name", "'_", ",_", "'", "sex", "'_", "]_", ")_", "[_", "'", "birth", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "let", "'", "s", " ", "make", " ", "a", " ", "new", " ", "table", " ", "in", " ", "whi", "ch", " ", "there", " ", "is", " ", "M", "/", "F", " ", "subin", "dex", " ", "for", " ", "all", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "set_", "(_", "pt_", "._", "columns_", "._", "get", "\\u", "level", "\\u", "values_", "(_", "level_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sex", "es_", "=_", "set_", "(_", "pt_", "._", "columns_", "._", "get", "\\u", "level", "\\u", "values_", "(_", "level_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", ",_", "sex", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "panda", "s", ".", "pyda", "ta", ".", "org", "/", "panda", "s", "-", "docs", "/", "stable", "/", "indexing", ".", "html", "#", "creati", "ng", "-", "a", "-", "multi", "index", "-", "hierarchical", "-", "index", "-", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "index_", "=_", "pd_", "._", "Multi", "Index_", "._", "from", "\\u", "product_", "(_", "[_", "list_", "(_", "names_", ")_", ",_", "list_", "(_", "sex", "es_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "[_", "'", "name", "'_", ",_", "'", "sex", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "panda", "s", ".", "pyda", "ta", ".", "org", "/", "panda", "s", "-", "docs", "/", "stable", "/", "generat", "ed", "/", "panda", "s", ".", "Data", "Frame", ".", "reindex", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "._", "T_", "._", "reindex", "_", "(_", "new", "\\u", "index_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "._", "T_", "._", "reindex", "_", "(_", "new", "\\u", "index_", ")_", "._", "T_", "._", "fillna_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "._", "groupby_", "(_", "'", "year", "'_", ")_", "._", "apply_", "(_", "lambda_", "s_", ":_", "s_", "._", "groupby_", "(_", "[_", "'", "name", "'_", ",_", "'", "sex", "'_", "]_", ")_", "._", "agg_", "(_", "'", "sum", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "codec", "ell", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df_", "._", "groupby_", "(_", "'", "year", "'_", ")_", "._", "apply_", "(_", "lambda_", "s_", ":_", "s_", "._", "groupby_", "(_", "[_", "'", "name", "'_", ",_", "'", "sex", "'_", "]_", ")_", "._", "agg_", "(_", "'", "sum", "'_", ")_", ")_", "._", "unsta", "ck_", "(_", ")_" ]
[ 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
haxsaw/actuator/src/tests/config_tests.py
[ { "content": "# \n# Copyright (c) 2014 Tom Carroll\n# \n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n# \n# The above copyright notice and this permission notice shall be included in all\n# copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\n'''\nCreated on 13 Jul 2014\n'''\n\nimport threading\n\nfrom actuator import *\nfrom actuator.config import _Dependency, _ConfigTask, StructuralTask,\\\n with_config_options\nfrom actuator.infra import IPAddressable\n\nMyConfig = None\nsearch_path = [\"p1\", \"p2\", \"p3\"]\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\n\n\n \n\n\n\n\n\n#tests after this point will use these classes\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\n\n\n\n \n \n\n \nif __name__ == \"__main__\":\n do_all()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup():\n global MyConfig\n class MyTestConfig(ConfigModel):\n with_searchpath(*search_path)\n t1 = NullTask(\"nt\")\n t2 = NullTask(\"temp\")\n with_dependencies(t1 | t2)\n \n MyConfig = MyTestConfig", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def make_dep_tuple_set(config):\n return set([(d.from_task.path, d.to_task.path) for d in config.get_class_dependencies()])", "metadata": "root.make_dep_tuple_set", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def pretty_deps(deps):\n return [(\"{}-{}\".format(d.from_task.name, str(id(d.from_task))[-4:]),\n \"{}-{}\".format(d.to_task.name, str(id(d.to_task))[-4:]))\n for d in deps]", "metadata": "root.pretty_deps", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def test01():\n assert MyConfig", "metadata": "root.test01", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def test02():\n expected_path = set(search_path)\n assert expected_path == set(MyConfig.__searchpath__)", "metadata": "root.test02", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def test03():\n assert 1 == len(MyConfig.__dependencies__)", "metadata": "root.test03", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def test04():\n try:\n class T4Config(ConfigModel):\n t1 = NullTask(\"nt\")\n with_dependencies(t1 | \"other\")\n raise Exception(\"Failed to catch dependency creation with non-task\")\n except:\n assert True", "metadata": "root.test04", "header": "['module', '___EOS___']", "index": 67 }, { "content": "def test05():\n try:\n _ = _Dependency(NullTask(\"nt\"), \"other\")\n raise Exception(\"Failed to catch _Dependency creation with 'to' as non-task\")\n except:\n assert True", "metadata": "root.test05", "header": "['module', '___EOS___']", "index": 76 }, { "content": "def test06():\n try:\n _ = _Dependency(\"other\", NullTask(\"nt\"))\n raise Exception(\"Failed to catch _Dependency creation with 'from' as non-task\")\n except:\n assert True", "metadata": "root.test06", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def test07():\n assert 2 == len(MyConfig._node_dict)", "metadata": "root.test07", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def test08():\n try:\n class TC8(ConfigModel):\n t1 = NullTask(\"nt\")\n t2 = NullTask(\"nt\")\n t3 = NullTask(\"nt\")\n with_dependencies(t1 | t2,\n t2 | t3,\n t3 | t1)\n assert False, \"Cycle in dependencies was not detected\"\n except ConfigException, _:\n assert True", "metadata": "root.test08", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def test09():\n class TC9(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3)\n assert make_dep_tuple_set(TC9) == set([(\"t1\", \"t2\"), (\"t2\", \"t3\")])", "metadata": "root.test09", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def test10():\n try:\n class TC10(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3 | t1)\n assert False, \"Cycle in dependencies was not detected\"\n except ConfigException, _:\n assert True", "metadata": "root.test10", "header": "['module', '___EOS___']", "index": 114 }, { "content": "def test10a():\n try:\n class TC10a(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t1)\n assert False, \"Cycle in dependencies was not detected\"\n except ConfigException, _:\n assert True", "metadata": "root.test10a", "header": "['module', '___EOS___']", "index": 125 }, { "content": "def test11():\n try:\n class TC11(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n with_dependencies(t1 | t2 | t3 | t4)\n with_dependencies(t3 | t4 | t5)\n with_dependencies(t4 | t2)\n assert False, \"Cycle in dependencies was not detected\"\n except ConfigException, _:\n assert True", "metadata": "root.test11", "header": "['module', '___EOS___']", "index": 136 }, { "content": "def test12():\n class TC12(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(TaskGroup(t1, t2) | t3)\n assert make_dep_tuple_set(TC12) == set([(\"t1\", \"t3\"), (\"t2\", \"t3\")])", "metadata": "root.test12", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def test13():\n class TC13(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n with_dependencies(TaskGroup(t1, t2 | t3) | t4)\n assert make_dep_tuple_set(TC13) == set([(\"t2\", \"t3\"), (\"t1\", \"t4\"), (\"t3\", \"t4\")])", "metadata": "root.test13", "header": "['module', '___EOS___']", "index": 159 }, { "content": "def test14():\n class TC14(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n with_dependencies(TaskGroup(t1, t2) | TaskGroup(t3, t4))\n assert make_dep_tuple_set(TC14) == set([(\"t2\", \"t3\"), (\"t1\", \"t4\"),\n (\"t1\", \"t3\"), (\"t2\", \"t4\")])", "metadata": "root.test14", "header": "['module', '___EOS___']", "index": 168 }, { "content": "def test15():\n class TC15(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n with_dependencies(TaskGroup(t1 | t2, t3 | t4))\n assert make_dep_tuple_set(TC15) == set([(\"t1\", \"t2\"), (\"t3\", \"t4\")])", "metadata": "root.test15", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def test16():\n class TC16(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | TaskGroup(t2, t3))\n assert make_dep_tuple_set(TC16) == set([(\"t1\", \"t3\"), (\"t1\", \"t2\")])", "metadata": "root.test16", "header": "['module', '___EOS___']", "index": 187 }, { "content": "def test17():\n class TC17(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n t6 = NullTask(\"t6\", path=\"t6\")\n t7 = NullTask(\"t7\", path=\"t7\")\n t8 = NullTask(\"t8\", path=\"t8\")\n t9 = NullTask(\"t9\", path=\"t9\")\n t0 = NullTask(\"t0\", path=\"t0\")\n with_dependencies(TaskGroup(t1 | t2, TaskGroup(t3, t4)) | t5 |\n TaskGroup(TaskGroup(t6, t7, t8), t9 | t0))\n assert make_dep_tuple_set(TC17) == set([(\"t1\", \"t2\"), (\"t2\", \"t5\"),\n (\"t3\", \"t5\"), (\"t4\", \"t5\"),\n (\"t5\", \"t6\"), (\"t5\", \"t7\"),\n (\"t5\", \"t8\"), (\"t5\", \"t9\"),\n (\"t9\", \"t0\")])", "metadata": "root.test17", "header": "['module', '___EOS___']", "index": 195 }, { "content": "def test18():\n class TC18(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(TaskGroup(t1, TaskGroup(t2, TaskGroup(t3))))\n assert make_dep_tuple_set(TC18) == set()", "metadata": "root.test18", "header": "['module', '___EOS___']", "index": 215 }, { "content": "def test19():\n class TC19(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2)\n with_dependencies(t2 | t3)\n assert make_dep_tuple_set(TC19) == set([(\"t1\", \"t2\"), (\"t2\", \"t3\")])", "metadata": "root.test19", "header": "['module', '___EOS___']", "index": 223 }, { "content": "def test20():\n class TC20(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n t6 = NullTask(\"t6\", path=\"t6\")\n t7 = NullTask(\"t7\", path=\"t7\")\n t8 = NullTask(\"t8\", path=\"t8\")\n t9 = NullTask(\"t9\", path=\"t9\")\n t0 = NullTask(\"t0\", path=\"t0\")\n with_dependencies(TaskGroup(t1 | t2, TaskGroup(t3, t4)) | t5)\n with_dependencies(t5 | TaskGroup(TaskGroup(t6, t7, t8), t9 | t0))\n assert make_dep_tuple_set(TC20) == set([(\"t1\", \"t2\"), (\"t2\", \"t5\"),\n (\"t3\", \"t5\"), (\"t4\", \"t5\"),\n (\"t5\", \"t6\"), (\"t5\", \"t7\"),\n (\"t5\", \"t8\"), (\"t5\", \"t9\"),\n (\"t9\", \"t0\")])", "metadata": "root.test20", "header": "['module', '___EOS___']", "index": 232 }, { "content": "def test21():\n class TC21(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2)\n with_dependencies(t2 | t3)\n with_dependencies(t1 | t2)\n assert make_dep_tuple_set(TC21) == set([(\"t1\", \"t2\"), (\"t2\", \"t3\")])", "metadata": "root.test21", "header": "['module', '___EOS___']", "index": 252 }, { "content": "def test22():\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t3, t2 | t3)\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(TaskGroup(t1, t2) | t3)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test22", "header": "['module', '___EOS___']", "index": 262 }, { "content": "def test23():\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n with_dependencies(TaskGroup(t1, t1 | t2))\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n with_dependencies(t1 | t2)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test23", "header": "['module', '___EOS___']", "index": 277 }, { "content": "def test24():\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(TaskGroup(t1, t2, t3), t1 | t3)\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(TaskGroup(t1 | t3, t2))\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test24", "header": "['module', '___EOS___']", "index": 290 }, { "content": "def test25():\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3, t1 | TaskGroup(t2, t3))\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3, t1 | t3)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test25", "header": "['module', '___EOS___']", "index": 305 }, { "content": "def test26():\n TG = TaskGroup\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n with_dependencies(TG(TG(t1, t2, t3), t4 | t5),\n t2 | t4,\n t3 | t5)\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n with_dependencies(t2 | t4 | t5,\n t3 | t5)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test26", "header": "['module', '___EOS___']", "index": 320 }, { "content": "class Capture(object):\n \n ", "metadata": "root.Capture", "header": "['module', '___EOS___']", "index": 344 }, { "content": " def __init__(self):\n self.performed = []", "metadata": "root.Capture.__init__", "header": "['class', 'Capture', '(', 'object', ')', ':', '___EOS___']", "index": 345 }, { "content": " def __call__(self, name, task):\n self.performed.append((name, task))", "metadata": "root.Capture.__call__", "header": "['class', 'Capture', '(', 'object', ')', ':', '___EOS___']", "index": 348 }, { "content": " def pos(self, name, task):\n return self.performed.index((name, task))", "metadata": "root.Capture.pos", "header": "['class', 'Capture', '(', 'object', ')', ':', '___EOS___']", "index": 351 }, { "content": "class ReportingTask(_ConfigTask, StructuralTask):\n \n ", "metadata": "root.ReportingTask", "header": "['module', '___EOS___']", "index": 355 }, { "content": " def __init__(self, name, target=None, report=lambda n, o: (n, o), **kwargs):\n super(ReportingTask, self).__init__(name, task_role=target, **kwargs)\n self.target = target\n self.report = report", "metadata": "root.ReportingTask.__init__", "header": "['class', 'ReportingTask', '(', '_ConfigTask', ',', 'StructuralTask', ')', ':', '___EOS___']", "index": 356 }, { "content": " def get_init_args(self):\n args, kwargs = super(ReportingTask, self).get_init_args()\n try:\n kwargs.pop(\"task_role\")\n except Exception, _:\n pass\n kwargs[\"target\"] = self.target\n kwargs[\"report\"] = self.report\n return args, kwargs", "metadata": "root.ReportingTask.get_init_args", "header": "['class', 'ReportingTask', '(', '_ConfigTask', ',', 'StructuralTask', ')', ':', '___EOS___']", "index": 361 }, { "content": " def perform(self):\n comp = self.get_task_role()\n if not isinstance(comp, basestring):\n if isinstance(comp.name, basestring):\n comp = comp.name\n else:\n comp = comp.name.value()\n self.report(comp, self.name)", "metadata": "root.ReportingTask.perform", "header": "['class', 'ReportingTask', '(', '_ConfigTask', ',', 'StructuralTask', ')', ':', '___EOS___']", "index": 371 }, { "content": "class BogusServerRef(IPAddressable):\n \n admin_ip = property(get_ip)", "metadata": "root.BogusServerRef", "header": "['module', '___EOS___']", "index": 381 }, { "content": " def get_ip(self):\n return \"8.8.8.8\"", "metadata": "root.BogusServerRef.get_ip", "header": "['class', 'BogusServerRef', '(', 'IPAddressable', ')', ':', '___EOS___']", "index": 382 }, { "content": "def test27():\n cap = Capture()\n \n class PingNamespace(NamespaceModel):\n ping_target = Role(\"ping_target\", host_ref=BogusServerRef())\n ns = PingNamespace()\n \n class PingConfig(ConfigModel):\n ping_task = ReportingTask(\"ping\", target=PingNamespace.ping_target, report=cap)\n \n cfg = PingConfig()\n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert cap.performed", "metadata": "root.test27", "header": "['module', '___EOS___']", "index": 388 }, { "content": "def test28():\n cap = Capture()\n class PingNamespace(NamespaceModel):\n ping_target = Role(\"ping_target\", host_ref=BogusServerRef())\n ns = PingNamespace()\n \n class PingConfig(ConfigModel):\n t3 = ReportingTask(\"t3\", target=PingNamespace.ping_target, report=cap, repeat_count=1)\n t2 = ReportingTask(\"t2\", target=PingNamespace.ping_target, report=cap, repeat_count=1)\n t1 = ReportingTask(\"t1\", target=PingNamespace.ping_target, report=cap, repeat_count=1)\n with_dependencies(t1 | t2 | t3)\n \n cfg = PingConfig()\n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert (cap.pos(\"ping_target\", PingConfig.t1.name) <\n cap.pos(\"ping_target\", PingConfig.t2.name) <\n cap.pos(\"ping_target\", PingConfig.t3.name) )", "metadata": "root.test28", "header": "['module', '___EOS___']", "index": 404 }, { "content": "def test29():\n cap = Capture()\n class PingNamespace(NamespaceModel):\n ping_target = Role(\"ping_target\", host_ref=BogusServerRef())\n ns = PingNamespace()\n \n class PingConfig(ConfigModel):\n t3 = ReportingTask(\"t3\", target=PingNamespace.ping_target, report=cap)\n t2 = ReportingTask(\"t2\", target=PingNamespace.ping_target, report=cap)\n t1 = ReportingTask(\"t1\", target=PingNamespace.ping_target, report=cap)\n t4 = ReportingTask(\"t4\", target=PingNamespace.ping_target, report=cap)\n t5 = ReportingTask(\"t5\", target=PingNamespace.ping_target, report=cap)\n with_dependencies(t1 | t2 | t3,\n t4 | t2,\n t4 | t3,\n t5 | t3)\n \n cfg = PingConfig()\n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert (cap.pos(\"ping_target\", PingConfig.t1.name) <\n cap.pos(\"ping_target\", PingConfig.t2.name) <\n cap.pos(\"ping_target\", PingConfig.t3.name) and\n cap.performed[-1] == (\"ping_target\", PingConfig.t3.name) and\n cap.pos(\"ping_target\", PingConfig.t4.name) <\n cap.pos(\"ping_target\", PingConfig.t2.name))", "metadata": "root.test29", "header": "['module', '___EOS___']", "index": 424 }, { "content": "def test30():\n cap = Capture()\n class ElasticNamespace(NamespaceModel):\n ping_targets = MultiRole(Role(\"ping-target\", host_ref=BogusServerRef()))\n pong_targets = MultiRole(Role(\"pong-target\", host_ref=BogusServerRef()))\n ns = ElasticNamespace()\n \n class ElasticConfig(ConfigModel):\n ping = ReportingTask(\"ping\", target=ElasticNamespace.ping_targets, report=cap)\n pong = ReportingTask(\"pong\", target=ElasticNamespace.pong_targets, report=cap)\n with_dependencies(ping | pong)\n \n for i in range(5):\n _ = ns.ping_targets[i]\n \n cfg = ElasticConfig()\n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert (len(ns.ping_targets) == 5 and\n (set([\"0\", \"1\", \"2\", \"3\", \"4\"]) == set(ns.ping_targets.keys())) and\n len(ns.pong_targets) == 0)", "metadata": "root.test30", "header": "['module', '___EOS___']", "index": 452 }, { "content": "def test31():\n class VarCapture(_ConfigTask):\n def __init__(self, name, task_role, **kwargs):\n super(VarCapture, self).__init__(name, task_role=task_role, **kwargs)\n self.vars = {}\n \n def perform(self):\n vv = self._model_instance.namespace_model_instance.comp.get_visible_vars()\n self.vars.update({v.name:v.get_value(self.get_task_role())\n for v in vv.values()})\n \n class SimpleNS(NamespaceModel):\n with_variables(Var(\"ID\", \"wrong\"),\n Var(\"ONE\", \"1\"),\n Var(\"TWO\", \"2\"),\n Var(\"THREE\", \"3\"))\n comp = Role(\"test-comp\", host_ref=\"!{ID}\").add_variable(Var(\"ID\", \"right!\"),\n Var(\"THREE\", \"drei\"))\n \n class SimpleCfg(ConfigModel):\n comp_task = VarCapture(\"varcap\", SimpleNS.comp)\n \n ns = SimpleNS()\n cfg = SimpleCfg()\n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert (cfg.comp_task.vars[\"ID\"] == \"right!\" and\n cfg.comp_task.vars[\"THREE\"] == \"drei\" and\n cfg.comp_task.vars[\"ONE\"] == \"1\" and\n cfg.comp_task.vars[\"TWO\"] == \"2\")", "metadata": "root.test31", "header": "['module', '___EOS___']", "index": 475 }, { "content": "def test32():\n class VarCapture(_ConfigTask):\n def __init__(self, name, task_role, **kwargs):\n super(VarCapture, self).__init__(name, task_role=task_role, **kwargs)\n self.vars = {}\n \n def perform(self):\n vv = self._model_instance.namespace_model_instance.get_visible_vars()\n self.vars.update({v.name:v.get_value(self.get_task_role())\n for v in vv.values()})\n \n class SimpleNS(NamespaceModel):\n with_variables(Var(\"ID\", \"wrong\"),\n Var(\"ONE\", \"1\"),\n Var(\"TWO\", \"2\"),\n Var(\"THREE\", \"3\"))\n comp = Role(\"test-comp\", host_ref=\"!{ID}\").add_variable(Var(\"ID\", \"right!\"),\n Var(\"THREE\", \"drei\"))\n \n class SimpleCfg(ConfigModel):\n comp_task = VarCapture(\"varcap\", SimpleNS.comp)\n \n ns = SimpleNS()\n cfg = SimpleCfg()\n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert (cfg.comp_task.vars[\"ID\"] == \"wrong\" and\n cfg.comp_task.vars[\"THREE\"] == \"3\" and\n cfg.comp_task.vars[\"ONE\"] == \"1\" and\n cfg.comp_task.vars[\"TWO\"] == \"2\")", "metadata": "root.test32", "header": "['module', '___EOS___']", "index": 507 }, { "content": "def test33():\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3, t1 | t2 & t3)\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3, t1 | t3)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test33", "header": "['module', '___EOS___']", "index": 539 }, { "content": "def test34():\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3, t1 | (t2 & t3))\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n with_dependencies(t1 | t2 | t3, t1 | t3)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test34", "header": "['module', '___EOS___']", "index": 554 }, { "content": "def test35():\n #this is a re-statement of test26 using '&' instead of\n #TasgGroup (TG). It's a pretty literal translation,\n #although algebraically one set of parends isn't needed.\n TG = TaskGroup\n class First(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n with_dependencies((t1 & t2 & t3) & (t4 | t5),\n t2 | t4,\n t3 | t5)\n \n class Second(ConfigModel):\n t1 = NullTask(\"t1\", path=\"t1\")\n t2 = NullTask(\"t2\", path=\"t2\")\n t3 = NullTask(\"t3\", path=\"t3\")\n t4 = NullTask(\"t4\", path=\"t4\")\n t5 = NullTask(\"t5\", path=\"t5\")\n with_dependencies(t2 | t4 | t5,\n t3 | t5)\n \n assert make_dep_tuple_set(First) == make_dep_tuple_set(Second)", "metadata": "root.test35", "header": "['module', '___EOS___']", "index": 569 }, { "content": "def test36():\n class NS(NamespaceModel):\n grid = MultiRole(Role(\"grid\", host_ref=\"127.0.0.1\"))\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", NullTask(\"gp\", path=\"gp\"), NS.grid)\n cfg = Cfg()\n \n for i in range(5):\n _ = ns.grid[i]\n cfg.set_namespace(ns)\n cfg.grid_prep.fix_arguments()\n \n assert len(cfg.grid_prep.instances) == 5", "metadata": "root.test36", "header": "['module', '___EOS___']", "index": 595 }, { "content": "def test37():\n class NS(NamespaceModel):\n grid = MultiRole(Role(\"grid\", host_ref=\"127.0.0.1\"))\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", NullTask(\"gp\", path=\"gp\"), NS.grid)\n cfg = Cfg()\n \n _ = ns.grid[0]\n cfg.set_namespace(ns)\n cfg.grid_prep.fix_arguments()\n \n assert (len(cfg.grid_prep.instances) == 1 and\n cfg.grid_prep.instances.value()[0].name == \"gp-grid_0\")", "metadata": "root.test37", "header": "['module', '___EOS___']", "index": 611 }, { "content": "def test38():\n class NS(NamespaceModel):\n grid = MultiRole(Role(\"grid\", host_ref=\"127.0.0.1\"))\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", NullTask(\"gp\", path=\"gp\"), NS.grid)\n cfg = Cfg()\n \n _ = ns.grid[0]\n cfg.set_namespace(ns)\n cfg.grid_prep.fix_arguments()\n \n assert (len(cfg.grid_prep.instances) == 1 and\n cfg.grid_prep.instances.value()[0].name == \"gp-grid_0\")", "metadata": "root.test38", "header": "['module', '___EOS___']", "index": 627 }, { "content": "def test39():\n cap = Capture()\n \n class NS(NamespaceModel):\n grid = MultiRole(Role(\"grid\", host_ref=\"127.0.0.1\"))\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", ReportingTask(\"rt\", report=cap),\n NS.grid)\n cfg = Cfg()\n \n for i in range(5):\n _ = ns.grid[i]\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert len(cfg.grid_prep.instances) == 5 and len(cap.performed) == 5", "metadata": "root.test39", "header": "['module', '___EOS___']", "index": 643 }, { "content": "def test40():\n cap = Capture()\n \n class NS(NamespaceModel):\n grid = MultiRole(Role(\"grid\", host_ref=\"127.0.0.1\"))\n static = Role(\"static\", host_ref=\"127.0.0.1\")\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", ReportingTask(\"rt\", report=cap),\n NS.grid)\n before = ReportingTask(\"before\", target=NS.static, report=cap)\n after = ReportingTask(\"after\", target=NS.static, report=cap)\n with_dependencies(before | grid_prep | after)\n cfg = Cfg()\n \n for i in range(3):\n _ = ns.grid[i]\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert (len(cfg.grid_prep.instances) == 3 and\n len(cap.performed) == 5 and\n (cap.pos(\"static\", \"before\") < cap.pos(\"grid_0\", \"rt-grid_0\") and\n cap.pos(\"static\", \"before\") < cap.pos(\"grid_1\", \"rt-grid_1\") and\n cap.pos(\"static\", \"before\") < cap.pos(\"grid_2\", \"rt-grid_2\") and\n cap.pos(\"static\", \"after\") > cap.pos(\"grid_0\", \"rt-grid_0\") and\n cap.pos(\"static\", \"after\") > cap.pos(\"grid_1\", \"rt-grid_1\") and\n cap.pos(\"static\", \"after\") > cap.pos(\"grid_2\", \"rt-grid_2\")))", "metadata": "root.test40", "header": "['module', '___EOS___']", "index": 663 }, { "content": "def test41():\n cap = Capture()\n \n class NS(NamespaceModel):\n grid = MultiRole(Role(\"grid\", host_ref=\"127.0.0.1\"))\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", ReportingTask(\"rt\", report=cap),\n NS.q.grid)\n cfg = Cfg()\n \n for i in range(5):\n _ = ns.grid[i]\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert len(cfg.grid_prep.instances) == 5 and len(cap.performed) == 5", "metadata": "root.test41", "header": "['module', '___EOS___']", "index": 694 }, { "content": "def test42():\n cap = Capture()\n \n class NS(NamespaceModel):\n grid1 = MultiRole(Role(\"grid1\", host_ref=\"127.0.0.1\"))\n grid2 = MultiRole(Role(\"grid2\", host_ref=\"127.0.0.1\"))\n ns = NS()\n \n class Cfg(ConfigModel):\n grid_prep = MultiTask(\"grid_prep\", ReportingTask(\"rt\", report=cap),\n NS.q.union(NS.q.grid1, NS.q.grid2))\n cfg = Cfg()\n \n for i in range(5):\n _ = ns.grid1[i]\n for i in range(3):\n _ = ns.grid2[i]\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n no_delay=True)\n ea.perform_config()\n assert len(cfg.grid_prep.instances) == 8 and len(cap.performed) == 8", "metadata": "root.test42", "header": "['module', '___EOS___']", "index": 714 }, { "content": "def test43():\n \"\"\"\n test43: set a default task performance host using the 'default_task_role'\n kwarg of with_config_options(), and then create a task with no task_role.\n create an instance of the config, and see that get_task_host() on the\n config's task returns the role's get_ip address\n \"\"\"\n cap = Capture()\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=\"127.0.0.1\")\n ns = NS()\n \n class Cfg(ConfigModel):\n with_config_options(default_task_role=NS.task_performer)\n a_task = ReportingTask(\"atask\", report=cap)\n cfg = Cfg()\n cfg.set_namespace(ns)\n \n assert cfg.a_task.get_task_host() == \"127.0.0.1\"", "metadata": "root.test43", "header": "['module', '___EOS___']", "index": 737 }, { "content": "def test44():\n \"\"\"\n test44: like test43, but get the task host from a StaticServer in the\n infra model\n \"\"\"\n cap = Capture()\n class Infra(InfraModel):\n setup_server = StaticServer(\"setup_helper\", \"127.0.0.1\")\n infra = Infra(\"helper\")\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=Infra.setup_server)\n ns = NS()\n ns.set_infra_model(infra)\n \n class Cfg(ConfigModel):\n with_config_options(default_task_role=NS.task_performer)\n a_task = ReportingTask(\"atask\", report=cap)\n cfg = Cfg()\n cfg.set_namespace(ns)\n \n assert cfg.a_task.get_task_host() == \"127.0.0.1\"", "metadata": "root.test44", "header": "['module', '___EOS___']", "index": 758 }, { "content": "def test44a():\n \"\"\"\n test44a: like test44, setting the role on the task instead of getting\n it via the default for the config model\n \"\"\"\n cap = Capture()\n class Infra(InfraModel):\n setup_server = StaticServer(\"setup_helper\", \"127.0.0.1\")\n infra = Infra(\"helper\")\n infra.setup_server.fix_arguments()\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=Infra.setup_server)\n ns = NS()\n ns.set_infra_model(infra)\n ns.task_performer.fix_arguments()\n \n class Cfg(ConfigModel):\n a_task = ReportingTask(\"atask\", report=cap, target=NS.task_performer)\n cfg = Cfg()\n cfg.set_namespace(ns)\n cfg.a_task.fix_arguments()\n \n assert cfg.a_task.get_task_host() == \"127.0.0.1\"", "metadata": "root.test44a", "header": "['module', '___EOS___']", "index": 781 }, { "content": "def test45():\n \"\"\"\n test45: check if you drive config tasks from a nested config class\n \"\"\"\n class Infra(InfraModel):\n setup_server = StaticServer(\"setup_helper\", \"127.0.0.1\")\n infra = Infra(\"helper\")\n infra.setup_server.fix_arguments()\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=Infra.setup_server)\n ns = NS()\n ns.set_infra_model(infra)\n ns.task_performer.fix_arguments()\n \n cap = Capture()\n class InnerCfg(ConfigModel):\n task = ReportingTask(\"inner_task\", report=cap)\n \n class OuterCfg(ConfigModel):\n wrapped_task = ConfigClassTask(\"wrapper\", InnerCfg, task_role=NS.task_performer)\n \n cfg = OuterCfg()\n cfg.set_namespace(ns)\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n infra_model_instance=infra, no_delay=True)\n try:\n ea.perform_config()\n except ExecutionException, e:\n import traceback\n for task, etype, value, tb in ea.get_aborted_tasks():\n print \">>>Task {} failed with the following:\".format(task.name)\n traceback.print_exception(etype, value, tb)\n print\n assert False, e.message\n\n assert len(cap.performed) == 1", "metadata": "root.test45", "header": "['module', '___EOS___']", "index": 806 }, { "content": "def test46():\n \"\"\"\n test46: wrap a config class with a sequence of tasks in ConfigClassTask\n wrapper and ensure they all get performed in order\n \"\"\"\n class Infra(InfraModel):\n setup_server = StaticServer(\"setup_helper\", \"127.0.0.1\")\n infra = Infra(\"helper\")\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=Infra.setup_server)\n ns = NS()\n ns.set_infra_model(infra)\n \n cap = Capture()\n class InnerCfg(ConfigModel):\n t1 = ReportingTask(\"inner_task1\", report=cap)\n t2 = ReportingTask(\"inner_task2\", report=cap)\n t3 = ReportingTask(\"inner_task3\", report=cap)\n with_dependencies(t1 | t2 | t3)\n \n class OuterCfg(ConfigModel):\n wrapped_task = ConfigClassTask(\"wrapper\", InnerCfg, task_role=NS.task_performer)\n \n cfg = OuterCfg()\n cfg.set_namespace(ns)\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n infra_model_instance=infra, no_delay=True)\n try:\n ea.perform_config()\n except ExecutionException, e:\n import traceback\n for task, etype, value, tb in ea.get_aborted_tasks():\n print \">>>Task {} failed with the following:\".format(task.name)\n traceback.print_exception(etype, value, tb)\n print\n assert False, e.message\n\n assert (len(cap.performed) == 3 and\n cap.pos(\"tp\", \"inner_task1\") < cap.pos(\"tp\", \"inner_task2\") and\n cap.pos(\"tp\", \"inner_task2\") < cap.pos(\"tp\", \"inner_task3\"))", "metadata": "root.test46", "header": "['module', '___EOS___']", "index": 845 }, { "content": "def test47():\n \"\"\"\n test47: wrap a config class with a sequence of tasks in ConfigClassTask\n wrapper, then drive the creation of instances of the ConfigClassTask\n with a MultiTask wrapper.\n \"\"\"\n class IPGen(object):\n def __init__(self):\n self.host_part = 0\n \n def __call__(self, context):\n self.host_part += 1\n return \"127.0.0.{}\".format(self.host_part)\n ipgen = IPGen()\n \n class Infra(InfraModel):\n setup_server = MultiResource(StaticServer(\"setup_helper\", ipgen))\n infra = Infra(\"helper\")\n \n class NS(NamespaceModel):\n task_role = MultiRole(Role(\"tp\",\n host_ref=ctxt.model.infra.setup_server[ctxt.name]))\n ns = NS()\n ns.set_infra_model(infra)\n for i in range(3):\n _ = ns.task_role[i]\n \n cap = Capture()\n class InnerCfg(ConfigModel):\n t1 = ReportingTask(\"inner_task1\", report=cap)\n t2 = ReportingTask(\"inner_task2\", report=cap)\n t3 = ReportingTask(\"inner_task3\", report=cap)\n with_dependencies(t1 | t2 | t3)\n \n class OuterCfg(ConfigModel):\n wrapped_task = MultiTask(\"setupSuite\",\n ConfigClassTask(\"wrapper\", InnerCfg),\n NS.q.task_role.all())\n \n cfg = OuterCfg()\n cfg.set_namespace(ns)\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n infra_model_instance=infra, no_delay=True)\n try:\n ea.perform_config()\n except ExecutionException, e:\n import traceback\n for task, etype, value, tb in ea.get_aborted_tasks():\n print \">>>Task {} failed with the following:\".format(task.name)\n traceback.print_exception(etype, value, tb)\n print\n assert False, e.message\n\n assert len(cap.performed) == 9", "metadata": "root.test47", "header": "['module', '___EOS___']", "index": 888 }, { "content": "def test48():\n \"\"\"\n test48: wrap a config class with a sequence of tasks in ConfigClassTask\n wrapper and ensure they all get performed in order, and the set up a final\n task in the outer config class and ensure that is is performed last\n \"\"\"\n class Infra(InfraModel):\n setup_server = StaticServer(\"setup_helper\", \"127.0.0.1\")\n infra = Infra(\"helper\")\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=Infra.setup_server)\n default = Role(\"default\", host_ref=\"127.0.1.1\")\n ns = NS()\n ns.set_infra_model(infra)\n \n cap = Capture()\n class InnerCfg(ConfigModel):\n t1 = ReportingTask(\"inner_task1\", report=cap)\n t2 = ReportingTask(\"inner_task2\", report=cap)\n t3 = ReportingTask(\"inner_task3\", report=cap)\n with_dependencies(t1 | t2 | t3)\n \n class OuterCfg(ConfigModel):\n wrapped_task = ConfigClassTask(\"wrapper\", InnerCfg, task_role=NS.task_performer)\n final = ReportingTask(\"final\", target=NS.default, report=cap)\n with_dependencies(wrapped_task | final)\n \n cfg = OuterCfg()\n cfg.set_namespace(ns)\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n infra_model_instance=infra, no_delay=True)\n try:\n ea.perform_config()\n except ExecutionException, e:\n import traceback\n for task, etype, value, tb in ea.get_aborted_tasks():\n print \">>>Task {} failed with the following:\".format(task.name)\n traceback.print_exception(etype, value, tb)\n print\n assert False, e.message\n\n assert (len(cap.performed) == 4 and\n cap.pos(\"tp\", \"inner_task1\") < cap.pos(\"tp\", \"inner_task2\") and\n cap.pos(\"tp\", \"inner_task2\") < cap.pos(\"tp\", \"inner_task3\") and\n cap.pos(\"tp\", \"inner_task3\") < cap.pos(\"default\", \"final\"))", "metadata": "root.test48", "header": "['module', '___EOS___']", "index": 944 }, { "content": "def test49():\n \"\"\"\n test49: wrap a config class with a sequence of tasks in ConfigClassTask\n wrapper and ensure they all get performed in order, and then set up\n initial and final tasks in the outer config and make sure everything is\n happening in the right order\n \"\"\"\n class Infra(InfraModel):\n setup_server = StaticServer(\"setup_helper\", \"127.0.0.1\")\n infra = Infra(\"helper\")\n \n class NS(NamespaceModel):\n task_performer = Role(\"tp\", host_ref=Infra.setup_server)\n default = Role(\"default\", host_ref=\"127.0.1.1\")\n ns = NS()\n ns.set_infra_model(infra)\n \n cap = Capture()\n class InnerCfg(ConfigModel):\n t1 = ReportingTask(\"inner_task1\", report=cap)\n t2 = ReportingTask(\"inner_task2\", report=cap)\n t3 = ReportingTask(\"inner_task3\", report=cap)\n \n with_dependencies(t1 | t2 | t3)\n \n class OuterCfg(ConfigModel):\n wrapped_task = ConfigClassTask(\"wrapper\", InnerCfg, task_role=NS.task_performer)\n initial = ReportingTask(\"initial\", target=NS.default, report=cap)\n final = ReportingTask(\"final\", target=NS.default, report=cap)\n \n with_dependencies(initial | wrapped_task | final)\n \n cfg = OuterCfg()\n cfg.set_namespace(ns)\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n infra_model_instance=infra, no_delay=True)\n try:\n ea.perform_config()\n except ExecutionException, e:\n import traceback\n for task, etype, value, tb in ea.get_aborted_tasks():\n print \">>>Task {} failed with the following:\".format(task.name)\n traceback.print_exception(etype, value, tb)\n print\n assert False, e.message\n\n assert (len(cap.performed) == 5 and\n cap.pos(\"tp\", \"inner_task1\") < cap.pos(\"tp\", \"inner_task2\") and\n cap.pos(\"tp\", \"inner_task2\") < cap.pos(\"tp\", \"inner_task3\") and\n cap.pos(\"tp\", \"inner_task3\") < cap.pos(\"default\", \"final\") and\n cap.pos(\"default\", \"initial\") < cap.pos(\"tp\", \"inner_task1\"))", "metadata": "root.test49", "header": "['module', '___EOS___']", "index": 992 }, { "content": "def test50():\n \"\"\"\n test50: wrap a config class with a sequence of tasks in ConfigClassTask\n wrapper, then drive the creation of instances of the ConfigClassTask\n with a MultiTask wrapper.\n \"\"\"\n class IPGen(object):\n def __init__(self):\n self.host_part = 0\n \n def __call__(self, context):\n self.host_part += 1\n return \"127.0.0.{}\".format(self.host_part)\n ipgen = IPGen()\n \n class Infra(InfraModel):\n setup_server = MultiResource(StaticServer(\"setup_helper\", ipgen))\n infra = Infra(\"helper\")\n \n class NS(NamespaceModel):\n task_role = MultiRole(Role(\"tp\",\n host_ref=ctxt.model.infra.setup_server[ctxt.name]))\n default = Role(\"default\", \"127.0.1.1\")\n ns = NS()\n ns.set_infra_model(infra)\n for i in range(3):\n _ = ns.task_role[i]\n \n cap = Capture()\n class InnerCfg(ConfigModel):\n t1 = ReportingTask(\"inner_task1\", report=cap)\n t2 = ReportingTask(\"inner_task2\", report=cap)\n t3 = ReportingTask(\"inner_task3\", report=cap)\n with_dependencies(t1 | t2 | t3)\n \n class OuterCfg(ConfigModel):\n wrapped_task = MultiTask(\"setupSuite\",\n ConfigClassTask(\"wrapper\", InnerCfg),\n NS.q.task_role.all())\n initial = ReportingTask(\"initial\", target=NS.default, report=cap)\n final = ReportingTask(\"final\", target=NS.default, report=cap)\n \n with_dependencies(initial | wrapped_task | final)\n \n cfg = OuterCfg()\n cfg.set_namespace(ns)\n \n ea = ExecutionAgent(config_model_instance=cfg, namespace_model_instance=ns,\n infra_model_instance=infra, no_delay=True)\n try:\n ea.perform_config()\n except ExecutionException, e:\n import traceback\n for task, etype, value, tb in ea.get_aborted_tasks():\n print \">>>Task {} failed with the following:\".format(task.name)\n traceback.print_exception(etype, value, tb)\n print\n assert False, e.message\n\n assert (len(cap.performed) == 11 and\n cap.pos(\"default\", \"final\") == len(cap.performed) -1 and\n cap.pos(\"default\", \"initial\") == 0)", "metadata": "root.test50", "header": "['module', '___EOS___']", "index": 1045 }, { "content": "def test51():\n class SkipemNS(NamespaceModel):\n with_variables(Var(\"ONE\", \"1\"),\n Var(\"TWO\", \"2\"),\n Var(\"THREE\", \"!{ONE}+!{TWO}\", in_env=False))\n r = Role(\"me\", host_ref=\"127.0.0.1\")\n ns = SkipemNS()\n \n class SkipConfig(ConfigModel):\n t = NullTask(\"env-test\", task_role=SkipemNS.r)\n \n cfg = SkipConfig()\n cfg.set_namespace(ns)\n \n assert \"THREE\" in cfg.t.task_variables() and \"THREE\" not in cfg.t.task_variables(for_env=True)", "metadata": "root.test51", "header": "['module', '___EOS___']", "index": 1108 }, { "content": "def do_all():\n setup()\n for k, v in globals().items():\n if k.startswith(\"test\") and callable(v):\n v()", "metadata": "root.do_all", "header": "['module', '___EOS___']", "index": 1125 } ]
[ { "span": "import threading", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Tom", " ", "Carr", "oll", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "13", " ", "Ju", "l", " ", "2014", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "actuator", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "actuator", "_", "._", "config_", "import_", "\\u", "Dependency_", ",_", "\\u", "Config", "Task_", ",_", "Structur", "al", "Task_", ",_", "with", "\\u", "config", "\\u", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "actuator", "_", "._", "infra", "_", "import_", "IPA", "ddress", "able_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "My", "Config_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "path_", "=_", "[_", "\"", "p1", "\"_", ",_", "\"", "p2", "\"_", ",_", "\"", "p3", "\"_", "]_", "\\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\\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_", "\\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_", "#", "tests", " ", "after", " ", "this", " ", "point", " ", "will", " ", "use", " ", "these", " ", "classes_", "\\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\\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_", "\\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\\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_", "\\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 ", " _", "do", "\\u", "all_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "My", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "My", "Test", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with", "\\u", "search", "path_", "(_", "*_", "search", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "temp", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "My", "Config_", "=_", "My", "Test", "Config_", "\\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_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "set_", "(_", "[_", "(_", "d_", "._", "from", "\\u", "task_", "._", "path_", ",_", "d_", "._", "to", "\\u", "task_", "._", "path_", ")_", "for_", "d_", "in_", "config_", "._", "get", "\\u", "class", "\\u", "dependencies_", "(_", ")_", "]_", ")_", "\\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_", "pretty", "\\u", "deps_", "(_", "deps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "\"{}", "-{}", "\"_", "._", "format_", "(_", "d_", "._", "from", "\\u", "task_", "._", "name_", ",_", "str_", "(_", "id_", "(_", "d_", "._", "from", "\\u", "task_", ")_", ")_", "[_", "-_", "4_", ":_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"{}", "-{}", "\"_", "._", "format_", "(_", "d_", "._", "to", "\\u", "task_", "._", "name_", ",_", "str_", "(_", "id_", "(_", "d_", "._", "to", "\\u", "task_", ")_", ")_", "[_", "-_", "4_", ":_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "d_", "in_", "deps_", "]_", "\\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_", "test0", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "My", "Config_", "\\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_", "test0", "2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "path_", "=_", "set_", "(_", "search", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "expected", "\\u", "path_", "==_", "set_", "(_", "My", "Config_", "._", "\\u\\u", "search", "path\\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_", "def_", "test0", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "1_", "==_", "len_", "(_", "My", "Config_", "._", "\\u\\u", "dependen", "cies", "\\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_", "def_", "test0", "4_", "(_", ")_", ":_", "\\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 ", " _", "class_", "T", "4", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "\"", "other", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Fail", "ed", " ", "to", " ", "catch", " ", "dependen", "cy", " ", "creati", "on", " ", "with", " ", "non", "-", "task", "\"_", ")_", "\\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 ", " _", "assert_", "True_", "\\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_", "test0", "5_", "(_", ")_", ":_", "\\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 ", " _", "\\u_", "=_", "\\u", "Dependency_", "(_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", ",_", "\"", "other", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Fail", "ed", " ", "to", " ", "catch", " ", "\\u", "Dependenc", "y", " ", "creati", "on", " ", "with", " ", "'", "to", "'", " ", "as", " ", "non", "-", "task", "\"_", ")_", "\\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 ", " _", "assert_", "True_", "\\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_", "test0", "6_", "(_", ")_", ":_", "\\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 ", " _", "\\u_", "=_", "\\u", "Dependency_", "(_", "\"", "other", "\"_", ",_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Fail", "ed", " ", "to", " ", "catch", " ", "\\u", "Dependenc", "y", " ", "creati", "on", " ", "with", " ", "'", "from", "'", " ", "as", " ", "non", "-", "task", "\"_", ")_", "\\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 ", " _", "assert_", "True_", "\\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_", "test0", "7_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "2_", "==_", "len_", "(_", "My", "Config_", "._", "\\u", "node", "\\u", "dict_", ")_", "\\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_", "test0", "8_", "(_", ")_", ":_", "\\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 ", " _", "class_", "TC", "8_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "nt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t2_", "|_", "t3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "|_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "\"", "Cycle", " ", "in", " ", "dependen", "cies", " ", "was", " ", "not", " ", "detect", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Exception_", ",_", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "True_", "\\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_", "test0", "9_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "9_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "9_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t3", "\"_", ")_", "]_", ")_", "\\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_", "test", "10_", "(_", ")_", ":_", "\\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 ", " _", "class_", "TC", "10_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", "|_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "\"", "Cycle", " ", "in", " ", "dependen", "cies", " ", "was", " ", "not", " ", "detect", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Exception_", ",_", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "True_", "\\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_", "test", "10", "a_", "(_", ")_", ":_", "\\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 ", " _", "class_", "TC", "10", "a_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "\"", "Cycle", " ", "in", " ", "dependen", "cies", " ", "was", " ", "not", " ", "detect", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Exception_", ",_", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "True_", "\\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_", "test", "11_", "(_", ")_", ":_", "\\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 ", " _", "class_", "TC", "11_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", "|_", "t4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t3_", "|_", "t4_", "|_", "t5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t4_", "|_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "\"", "Cycle", " ", "in", " ", "dependen", "cies", " ", "was", " ", "not", " ", "detect", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Exception_", ",_", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "True_", "\\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_", "test", "12_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "12_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "t2_", ")_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "12_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t3", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t3", "\"_", ")_", "]_", ")_", "\\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_", "test", "13_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "13_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "t2_", "|_", "t3_", ")_", "|_", "t4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "13_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t2", "\"_", ",_", "\"", "t3", "\"_", ")_", ",_", "(_", "\"", "t1", "\"_", ",_", "\"", "t", "4", "\"_", ")_", ",_", "(_", "\"", "t3", "\"_", ",_", "\"", "t", "4", "\"_", ")_", "]_", ")_", "\\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_", "test", "14_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "14_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "t2_", ")_", "|_", "Task", "Group_", "(_", "t3_", ",_", "t4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "14_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t2", "\"_", ",_", "\"", "t3", "\"_", ")_", ",_", "(_", "\"", "t1", "\"_", ",_", "\"", "t", "4", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t1", "\"_", ",_", "\"", "t3", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t", "4", "\"_", ")_", "]_", ")_", "\\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_", "test", "15_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "15_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", "|_", "t2_", ",_", "t3_", "|_", "t4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "15_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", ",_", "(_", "\"", "t3", "\"_", ",_", "\"", "t", "4", "\"_", ")_", "]_", ")_", "\\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_", "test", "16_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "16_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "Task", "Group_", "(_", "t2_", ",_", "t3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "16_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t3", "\"_", ")_", ",_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", "]_", ")_", "\\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_", "test", "17_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "17_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t6", "_", "=_", "Null", "Task_", "(_", "\"", "t6", "\"_", ",_", "path_", "=_", "\"", "t6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "7_", "=_", "Null", "Task_", "(_", "\"", "t", "7", "\"_", ",_", "path_", "=_", "\"", "t", "7", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "8_", "=_", "Null", "Task_", "(_", "\"", "t", "8", "\"_", ",_", "path_", "=_", "\"", "t", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "9_", "=_", "Null", "Task_", "(_", "\"", "t", "9", "\"_", ",_", "path_", "=_", "\"", "t", "9", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t0_", "=_", "Null", "Task_", "(_", "\"", "t0", "\"_", ",_", "path_", "=_", "\"", "t0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", "|_", "t2_", ",_", "Task", "Group_", "(_", "t3_", ",_", "t4_", ")_", ")_", "|_", "t5", "_", "|_", "\\u\\u\\uNL\\u\\u\\u_", "Task", "Group_", "(_", "Task", "Group_", "(_", "t6", "_", ",_", "t", "7_", ",_", "t", "8_", ")_", ",_", "t", "9_", "|_", "t0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "17_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t5", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t3", "\"_", ",_", "\"", "t5", "\"_", ")_", ",_", "(_", "\"", "t", "4", "\"_", ",_", "\"", "t5", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t5", "\"_", ",_", "\"", "t6", "\"_", ")_", ",_", "(_", "\"", "t5", "\"_", ",_", "\"", "t", "7", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t5", "\"_", ",_", "\"", "t", "8", "\"_", ")_", ",_", "(_", "\"", "t5", "\"_", ",_", "\"", "t", "9", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t", "9", "\"_", ",_", "\"", "t0", "\"_", ")_", "]_", ")_", "\\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_", "test", "18_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "18_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "Task", "Group_", "(_", "t2_", ",_", "Task", "Group_", "(_", "t3_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "18_", ")_", "==_", "set_", "(_", ")_", "\\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_", "test", "19_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "19_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "19_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t3", "\"_", ")_", "]_", ")_", "\\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_", "test", "20_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "20_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t6", "_", "=_", "Null", "Task_", "(_", "\"", "t6", "\"_", ",_", "path_", "=_", "\"", "t6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "7_", "=_", "Null", "Task_", "(_", "\"", "t", "7", "\"_", ",_", "path_", "=_", "\"", "t", "7", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "8_", "=_", "Null", "Task_", "(_", "\"", "t", "8", "\"_", ",_", "path_", "=_", "\"", "t", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "9_", "=_", "Null", "Task_", "(_", "\"", "t", "9", "\"_", ",_", "path_", "=_", "\"", "t", "9", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t0_", "=_", "Null", "Task_", "(_", "\"", "t0", "\"_", ",_", "path_", "=_", "\"", "t0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", "|_", "t2_", ",_", "Task", "Group_", "(_", "t3_", ",_", "t4_", ")_", ")_", "|_", "t5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t5", "_", "|_", "Task", "Group_", "(_", "Task", "Group_", "(_", "t6", "_", ",_", "t", "7_", ",_", "t", "8_", ")_", ",_", "t", "9_", "|_", "t0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "20_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t5", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t3", "\"_", ",_", "\"", "t5", "\"_", ")_", ",_", "(_", "\"", "t", "4", "\"_", ",_", "\"", "t5", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t5", "\"_", ",_", "\"", "t6", "\"_", ")_", ",_", "(_", "\"", "t5", "\"_", ",_", "\"", "t", "7", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t5", "\"_", ",_", "\"", "t", "8", "\"_", ")_", ",_", "(_", "\"", "t5", "\"_", ",_", "\"", "t", "9", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "t", "9", "\"_", ",_", "\"", "t0", "\"_", ")_", "]_", ")_", "\\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_", "test", "21_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "TC", "21_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "TC", "21_", ")_", "==_", "set_", "(_", "[_", "(_", "\"", "t1", "\"_", ",_", "\"", "t2", "\"_", ")_", ",_", "(_", "\"", "t2", "\"_", ",_", "\"", "t3", "\"_", ")_", "]_", ")_", "\\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_", "test", "22_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t3_", ",_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "t2_", ")_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "23_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "t1_", "|_", "t2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "24_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", ",_", "t2_", ",_", "t3_", ")_", ",_", "t1_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "Task", "Group_", "(_", "t1_", "|_", "t3_", ",_", "t2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "25_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "t1_", "|_", "Task", "Group_", "(_", "t2_", ",_", "t3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "t1_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "26_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TG", "_", "=_", "Task", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "TG", "_", "(_", "TG", "_", "(_", "t1_", ",_", "t2_", ",_", "t3_", ")_", ",_", "t4_", "|_", "t5", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t2_", "|_", "t4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "|_", "t5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t2_", "|_", "t4_", "|_", "t5", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "|_", "t5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "Capture_", "(_", "object_", ")_", ":_", "\\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_", "Capture_", "(_", "object_", ")_", ":_", "\\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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "perform", "ed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Capture_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "name_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "perform", "ed_", "._", "append_", "(_", "(_", "name_", ",_", "task_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Capture_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pos_", "(_", "self_", ",_", "name_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "perform", "ed_", "._", "index_", "(_", "(_", "name_", ",_", "task_", ")_", ")_", "\\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_", "Report", "ing", "Task_", "(_", "\\u", "Config", "Task_", ",_", "Structur", "al", "Task_", ")_", ":_", "\\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_", "Report", "ing", "Task_", "(_", "\\u", "Config", "Task_", ",_", "Structur", "al", "Task_", ")_", ":_", "\\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_", ",_", "name_", ",_", "target_", "=_", "None_", ",_", "report_", "=_", "lambda_", "n_", ",_", "o_", ":_", "(_", "n_", ",_", "o_", ")_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Report", "ing", "Task_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "task", "\\u", "role_", "=_", "target_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target_", "=_", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "report_", "=_", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "ing", "Task_", "(_", "\\u", "Config", "Task_", ",_", "Structur", "al", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "init", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", ",_", "kwargs_", "=_", "super_", "(_", "Report", "ing", "Task_", ",_", "self_", ")_", "._", "get", "\\u", "init", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "pop_", "(_", "\"", "task", "\\u", "role", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "\\u_", ":_", "\\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_", "kwargs_", "[_", "\"", "target", "\"_", "]_", "=_", "self_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "\"", "report", "\"_", "]_", "=_", "self_", "._", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "args_", ",_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Report", "ing", "Task_", "(_", "\\u", "Config", "Task_", ",_", "Structur", "al", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "=_", "self_", "._", "get", "\\u", "task", "\\u", "role_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "comp_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "comp_", "._", "name_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "=_", "comp_", "._", "name_", "\\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 ", " _", "comp_", "=_", "comp_", "._", "name_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "report_", "(_", "comp_", ",_", "self_", "._", "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_", "class_", "Bo", "gus", "Server", "Ref_", "(_", "IPA", "ddress", "able_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin", "\\u", "ip_", "=_", "property_", "(_", "get", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bo", "gus", "Server", "Ref_", "(_", "IPA", "ddress", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "8.8", ".8", ".8", "\"_", "\\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_", "test", "27_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ping", "Namespace_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ping", "\\u", "target_", "=_", "Role_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "host", "\\u", "ref_", "=_", "Bo", "gus", "Server", "Ref_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Ping", "Namespace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ping", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ping", "\\u", "task_", "=_", "Report", "ing", "Task_", "(_", "\"", "ping", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Ping", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cap_", "._", "perform", "ed_", "\\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_", "test", "28_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Ping", "Namespace_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ping", "\\u", "target_", "=_", "Role_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "host", "\\u", "ref_", "=_", "Bo", "gus", "Server", "Ref_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Ping", "Namespace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ping", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "t3", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ",_", "repeat", "\\u", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "t2", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ",_", "repeat", "\\u", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "t1", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ",_", "repeat", "\\u", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Ping", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t1_", "._", "name_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t2_", "._", "name_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t3_", "._", "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_", "test", "29_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Ping", "Namespace_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ping", "\\u", "target_", "=_", "Role_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "host", "\\u", "ref_", "=_", "Bo", "gus", "Server", "Ref_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Ping", "Namespace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ping", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "t3", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "t2", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "t1", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Report", "ing", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Report", "ing", "Task_", "(_", "\"", "t5", "\"_", ",_", "target_", "=_", "Ping", "Namespace_", "._", "ping", "\\u", "target_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t4_", "|_", "t2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t4_", "|_", "t3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t5", "_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Ping", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t1_", "._", "name_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t2_", "._", "name_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t3_", "._", "name_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "perform", "ed_", "[_", "-_", "1_", "]_", "==_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t3_", "._", "name_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t4_", "._", "name_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "ping", "\\u", "target", "\"_", ",_", "Ping", "Config_", "._", "t2_", "._", "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_", "test", "30_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Elast", "ic", "Namespace_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ping", "\\u", "targets_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "ping", "-", "target", "\"_", ",_", "host", "\\u", "ref_", "=_", "Bo", "gus", "Server", "Ref_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pong", "\\u", "targets_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "pong", "-", "target", "\"_", ",_", "host", "\\u", "ref_", "=_", "Bo", "gus", "Server", "Ref_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Elast", "ic", "Namespace_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Elast", "ic", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ping_", "=_", "Report", "ing", "Task_", "(_", "\"", "ping", "\"_", ",_", "target_", "=_", "Elast", "ic", "Namespace_", "._", "ping", "\\u", "targets_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pong", "_", "=_", "Report", "ing", "Task_", "(_", "\"", "pong", "\"_", ",_", "target_", "=_", "Elast", "ic", "Namespace_", "._", "pong", "\\u", "targets_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "ping_", "|_", "pong", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "ping", "\\u", "targets_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Elast", "ic", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "ns_", "._", "ping", "\\u", "targets_", ")_", "==_", "5_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "set_", "(_", "[_", "\"", "0", "\"_", ",_", "\"", "1", "\"_", ",_", "\"", "2", "\"_", ",_", "\"", "3", "\"_", ",_", "\"", "4", "\"_", "]_", ")_", "==_", "set_", "(_", "ns_", "._", "ping", "\\u", "targets_", "._", "keys_", "(_", ")_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "ns_", "._", "pong", "\\u", "targets_", ")_", "==_", "0_", ")_", "\\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_", "test", "31_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Var", "Capture_", "(_", "\\u", "Config", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "task", "\\u", "role_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Var", "Capture_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "task", "\\u", "role_", "=_", "task", "\\u", "role_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vars_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vv_", "=_", "self_", "._", "\\u", "model", "\\u", "instance_", "._", "namespace", "\\u", "model", "\\u", "instance_", "._", "comp_", "._", "get", "\\u", "visi", "ble", "\\u", "vars_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vars_", "._", "update_", "(_", "{_", "v_", "._", "name_", ":_", "v_", "._", "get", "\\u", "value_", "(_", "self_", "._", "get", "\\u", "task", "\\u", "role_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", "in_", "vv_", "._", "values_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with", "\\u", "variables_", "(_", "Var_", "(_", "\"", "ID", "\"_", ",_", "\"", "wrong", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "ONE", "\"_", ",_", "\"", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "TWO", "\"_", ",_", "\"", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "THREE", "\"_", ",_", "\"", "3", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "Role_", "(_", "\"", "test", "-", "comp", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"!", "{", "ID", "}\"_", ")_", "._", "add", "\\u", "variable_", "(_", "Var_", "(_", "\"", "ID", "\"_", ",_", "\"", "right", "!\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "THREE", "\"_", ",_", "\"", "dre", "i", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp", "\\u", "task_", "=_", "Var", "Capture_", "(_", "\"", "var", "cap", "\"_", ",_", "Simple", "NS_", "._", "comp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Simple", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "Simple", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "ID", "\"_", "]_", "==_", "\"", "right", "!\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "THREE", "\"_", "]_", "==_", "\"", "dre", "i", "\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "ONE", "\"_", "]_", "==_", "\"", "1", "\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "TWO", "\"_", "]_", "==_", "\"", "2", "\"_", ")_", "\\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_", "test", "32_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Var", "Capture_", "(_", "\\u", "Config", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "task", "\\u", "role_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Var", "Capture_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "task", "\\u", "role_", "=_", "task", "\\u", "role_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vars_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vv_", "=_", "self_", "._", "\\u", "model", "\\u", "instance_", "._", "namespace", "\\u", "model", "\\u", "instance_", "._", "get", "\\u", "visi", "ble", "\\u", "vars_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vars_", "._", "update_", "(_", "{_", "v_", "._", "name_", ":_", "v_", "._", "get", "\\u", "value_", "(_", "self_", "._", "get", "\\u", "task", "\\u", "role_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", "in_", "vv_", "._", "values_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with", "\\u", "variables_", "(_", "Var_", "(_", "\"", "ID", "\"_", ",_", "\"", "wrong", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "ONE", "\"_", ",_", "\"", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "TWO", "\"_", ",_", "\"", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "THREE", "\"_", ",_", "\"", "3", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "Role_", "(_", "\"", "test", "-", "comp", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"!", "{", "ID", "}\"_", ")_", "._", "add", "\\u", "variable_", "(_", "Var_", "(_", "\"", "ID", "\"_", ",_", "\"", "right", "!\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "THREE", "\"_", ",_", "\"", "dre", "i", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp", "\\u", "task_", "=_", "Var", "Capture_", "(_", "\"", "var", "cap", "\"_", ",_", "Simple", "NS_", "._", "comp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Simple", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "Simple", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "ID", "\"_", "]_", "==_", "\"", "wrong", "\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "THREE", "\"_", "]_", "==_", "\"", "3", "\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "ONE", "\"_", "]_", "==_", "\"", "1", "\"_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "comp", "\\u", "task_", "._", "vars_", "[_", "\"", "TWO", "\"_", "]_", "==_", "\"", "2", "\"_", ")_", "\\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_", "test", "33_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "t1_", "|_", "t2_", "&_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "t1_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "34_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "t1_", "|_", "(_", "t2_", "&_", "t3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ",_", "t1_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "35_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "is", " ", "a", " ", "re", "-", "statem", "ent", " ", "of", " ", "test", "2", "6", " ", "usi", "ng", " ", "'&", "'", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Ta", "sg", "Group", " ", "(", "TG", ").", " ", "It", "'", "s", " ", "a", " ", "pretty", " ", "literal", " ", "translatio", "n", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "alth", "ou", "gh", " ", "algebra", "ical", "ly", " ", "one", " ", "set", " ", "of", " ", "paren", "ds", " ", "isn", "'", "t", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TG", "_", "=_", "Task", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "First_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "(_", "t1_", "&_", "t2_", "&_", "t3_", ")_", "&_", "(_", "t4_", "|_", "t5", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t2_", "|_", "t4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "|_", "t5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Second", "_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Null", "Task_", "(_", "\"", "t1", "\"_", ",_", "path_", "=_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Null", "Task_", "(_", "\"", "t2", "\"_", ",_", "path_", "=_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Null", "Task_", "(_", "\"", "t3", "\"_", ",_", "path_", "=_", "\"", "t3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t4_", "=_", "Null", "Task_", "(_", "\"", "t", "4", "\"_", ",_", "path_", "=_", "\"", "t", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "=_", "Null", "Task_", "(_", "\"", "t5", "\"_", ",_", "path_", "=_", "\"", "t5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t2_", "|_", "t4_", "|_", "t5", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "|_", "t5", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "First_", ")_", "==_", "make", "\\u", "dep", "\\u", "tuple", "\\u", "set_", "(_", "Second", "_", ")_", "\\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_", "test", "36_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Null", "Task_", "(_", "\"", "gp", "\"_", ",_", "path_", "=_", "\"", "gp", "\"_", ")_", ",_", "NS_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "grid_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "grid", "\\u", "prep_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "5_", "\\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_", "test", "37_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Null", "Task_", "(_", "\"", "gp", "\"_", ",_", "path_", "=_", "\"", "gp", "\"_", ")_", ",_", "NS_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "=_", "ns_", "._", "grid_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "grid", "\\u", "prep_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", "._", "value_", "(_", ")_", "[_", "0_", "]_", "._", "name_", "==_", "\"", "gp", "-", "grid", "\\u", "0", "\"_", ")_", "\\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_", "test", "38_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Null", "Task_", "(_", "\"", "gp", "\"_", ",_", "path_", "=_", "\"", "gp", "\"_", ")_", ",_", "NS_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "=_", "ns_", "._", "grid_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "grid", "\\u", "prep_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", "._", "value_", "(_", ")_", "[_", "0_", "]_", "._", "name_", "==_", "\"", "gp", "-", "grid", "\\u", "0", "\"_", ")_", "\\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_", "test", "39_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Report", "ing", "Task_", "(_", "\"", "rt", "\"_", ",_", "report_", "=_", "cap_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "grid_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "5_", "and_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "5_", "\\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_", "test", "40_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static_", "=_", "Role_", "(_", "\"", "static", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Report", "ing", "Task_", "(_", "\"", "rt", "\"_", ",_", "report_", "=_", "cap_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "before_", "=_", "Report", "ing", "Task_", "(_", "\"", "bef", "ore", "\"_", ",_", "target_", "=_", "NS_", "._", "static_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "after_", "=_", "Report", "ing", "Task_", "(_", "\"", "after", "\"_", ",_", "target_", "=_", "NS_", "._", "static_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "before_", "|_", "grid", "\\u", "prep_", "|_", "after_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "grid_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "3_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "5_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cap_", "._", "pos_", "(_", "\"", "static", "\"_", ",_", "\"", "bef", "ore", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "grid", "\\u", "0", "\"_", ",_", "\"", "rt", "-", "grid", "\\u", "0", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "static", "\"_", ",_", "\"", "bef", "ore", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "grid", "\\u", "1", "\"_", ",_", "\"", "rt", "-", "grid", "\\u", "1", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "static", "\"_", ",_", "\"", "bef", "ore", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "grid", "\\u", "2", "\"_", ",_", "\"", "rt", "-", "grid", "\\u", "2", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "static", "\"_", ",_", "\"", "after", "\"_", ")_", ">_", "cap_", "._", "pos_", "(_", "\"", "grid", "\\u", "0", "\"_", ",_", "\"", "rt", "-", "grid", "\\u", "0", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "static", "\"_", ",_", "\"", "after", "\"_", ")_", ">_", "cap_", "._", "pos_", "(_", "\"", "grid", "\\u", "1", "\"_", ",_", "\"", "rt", "-", "grid", "\\u", "1", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "static", "\"_", ",_", "\"", "after", "\"_", ")_", ">_", "cap_", "._", "pos_", "(_", "\"", "grid", "\\u", "2", "\"_", ",_", "\"", "rt", "-", "grid", "\\u", "2", "\"_", ")_", ")_", ")_", "\\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_", "test", "41_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Report", "ing", "Task_", "(_", "\"", "rt", "\"_", ",_", "report_", "=_", "cap_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "._", "q_", "._", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "grid_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "5_", "and_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "5_", "\\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_", "test", "42_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "1_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "1", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid", "2_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "grid", "2", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid", "\\u", "prep_", "=_", "Multi", "Task_", "(_", "\"", "grid", "\\u", "prep", "\"_", ",_", "Report", "ing", "Task_", "(_", "\"", "rt", "\"_", ",_", "report_", "=_", "cap_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "._", "q_", "._", "union_", "(_", "NS_", "._", "q_", "._", "grid", "1_", ",_", "NS_", "._", "q_", "._", "grid", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "grid", "1_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "grid", "2_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cfg_", "._", "grid", "\\u", "prep_", "._", "instances_", ")_", "==_", "8_", "and_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "8_", "\\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_", "test", "43_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "3", ":", " ", "set", " ", "a", " ", "default", " ", "task", " ", "perform", "anc", "e", " ", "host", " ", "usi", "ng", " ", "the", " ", "'", "default", "\\u", "task", "\\u", "role", "'", "\\", "10", ";", " ", " ", " ", " ", "kwarg", " ", "of", " ", "with", "\\u", "config", "\\u", "options", "()", ",", " ", "and", " ", "then", " ", "create", " ", "a", " ", "task", " ", "with", " ", "no", " ", "task", "\\u", "role", ".", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "an", " ", "instance", " ", "of", " ", "the", " ", "config", ",", " ", "and", " ", "see", " ", "tha", "t", " ", "get", "\\u", "task", "\\u", "host", "()", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "config", "'", "s", " ", "task", " ", "return", "s", " ", "the", " ", "role", "'", "s", " ", "get", "\\u", "ip", " ", "address", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with", "\\u", "config", "\\u", "options_", "(_", "default", "\\u", "task", "\\u", "role_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "task_", "=_", "Report", "ing", "Task_", "(_", "\"", "ata", "sk", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "cfg_", "._", "a", "\\u", "task_", "._", "get", "\\u", "task", "\\u", "host_", "(_", ")_", "==_", "\"", "127", ".0", ".0", ".1", "\"_", "\\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_", "test", "44_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "4", ":", " ", "like", " ", "test", "4", "3", ",", " ", "but", " ", "get", " ", "the", " ", "task", " ", "host", " ", "from", " ", "a", " ", "Static", "Server", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "infra", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "Infra", "_", "._", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with", "\\u", "config", "\\u", "options_", "(_", "default", "\\u", "task", "\\u", "role_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "task_", "=_", "Report", "ing", "Task_", "(_", "\"", "ata", "sk", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "cfg_", "._", "a", "\\u", "task_", "._", "get", "\\u", "task", "\\u", "host_", "(_", ")_", "==_", "\"", "127", ".0", ".0", ".1", "\"_", "\\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_", "test", "4", "4a", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "4a", ":", " ", "like", " ", "test", "4", "4", ",", " ", "setti", "ng", " ", "the", " ", "role", " ", "on", " ", "the", " ", "task", " ", "inst", "ead", " ", "of", " ", "getti", "ng", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "via", " ", "the", " ", "default", " ", "for", " ", "the", " ", "config", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infra", "_", "._", "setup", "\\u", "server_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "Infra", "_", "._", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "task", "\\u", "perform", "er_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "task_", "=_", "Report", "ing", "Task_", "(_", "\"", "ata", "sk", "\"_", ",_", "report_", "=_", "cap_", ",_", "target_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "a", "\\u", "task_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "cfg_", "._", "a", "\\u", "task_", "._", "get", "\\u", "task", "\\u", "host_", "(_", ")_", "==_", "\"", "127", ".0", ".0", ".1", "\"_", "\\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_", "test", "45_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "5", ":", " ", "check", " ", "if", " ", "you", " ", "drive", " ", "config", " ", "task", "s", " ", "from", " ", "a", " ", "nest", "ed", " ", "config", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infra", "_", "._", "setup", "\\u", "server_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "Infra", "_", "._", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "task", "\\u", "perform", "er_", "._", "fix", "\\u", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "In", "ner", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Out", "er", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "\\u", "task_", "=_", "Config", "Class", "Task_", "(_", "\"", "wrapp", "er", "\"_", ",_", "In", "ner", "Cfg_", ",_", "task", "\\u", "role_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Out", "er", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infra", "\\u", "model", "\\u", "instance_", "=_", "infra", "_", ",_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", ",_", "etype_", ",_", "value_", ",_", "tb_", "in_", "ea_", "._", "get", "\\u", "abort", "ed", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\">>>", "Task", " ", "{}", " ", "fail", "ed", " ", "with", " ", "the", " ", "follow", "ing", ":\"_", "._", "format_", "(_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exception_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "1_", "\\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_", "test", "46_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "6", ":", " ", "wrap", " ", "a", " ", "config", " ", "class", " ", "with", " ", "a", " ", "sequence", " ", "of", " ", "task", "s", " ", "in", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", " ", "and", " ", "ensure", " ", "the", "y", " ", "all", " ", "get", " ", "perform", "ed", " ", "in", " ", "order", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "Infra", "_", "._", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "In", "ner", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "1", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "2", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "3", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Out", "er", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "\\u", "task_", "=_", "Config", "Class", "Task_", "(_", "\"", "wrapp", "er", "\"_", ",_", "In", "ner", "Cfg_", ",_", "task", "\\u", "role_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Out", "er", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infra", "\\u", "model", "\\u", "instance_", "=_", "infra", "_", ",_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", ",_", "etype_", ",_", "value_", ",_", "tb_", "in_", "ea_", "._", "get", "\\u", "abort", "ed", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\">>>", "Task", " ", "{}", " ", "fail", "ed", " ", "with", " ", "the", " ", "follow", "ing", ":\"_", "._", "format_", "(_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exception_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "3_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "1", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "2", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "2", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "3", "\"_", ")_", ")_", "\\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_", "test", "47_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "7", ":", " ", "wrap", " ", "a", " ", "config", " ", "class", " ", "with", " ", "a", " ", "sequence", " ", "of", " ", "task", "s", " ", "in", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", ",", " ", "then", " ", "drive", " ", "the", " ", "creati", "on", " ", "of", " ", "instance", "s", " ", "of", " ", "the", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "a", " ", "Multi", "Task", " ", "wrapp", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "IP", "Gen_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "host", "\\u", "part_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "host", "\\u", "part_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "127", ".0", ".0", ".{}", "\"_", "._", "format_", "(_", "self_", "._", "host", "\\u", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ip", "gen_", "=_", "IP", "Gen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Multi", "Resource_", "(_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "ip", "gen_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "role_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "tp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "ref_", "=_", "ctxt_", "._", "model_", "._", "infra", "_", "._", "setup", "\\u", "server_", "[_", "ctxt_", "._", "name_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "task", "\\u", "role_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "In", "ner", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "1", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "2", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "3", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Out", "er", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "\\u", "task_", "=_", "Multi", "Task_", "(_", "\"", "setup", "Suit", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Config", "Class", "Task_", "(_", "\"", "wrapp", "er", "\"_", ",_", "In", "ner", "Cfg_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "._", "q_", "._", "task", "\\u", "role_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Out", "er", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infra", "\\u", "model", "\\u", "instance_", "=_", "infra", "_", ",_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", ",_", "etype_", ",_", "value_", ",_", "tb_", "in_", "ea_", "._", "get", "\\u", "abort", "ed", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\">>>", "Task", " ", "{}", " ", "fail", "ed", " ", "with", " ", "the", " ", "follow", "ing", ":\"_", "._", "format_", "(_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exception_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "9_", "\\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_", "test", "48_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "8", ":", " ", "wrap", " ", "a", " ", "config", " ", "class", " ", "with", " ", "a", " ", "sequence", " ", "of", " ", "task", "s", " ", "in", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", " ", "and", " ", "ensure", " ", "the", "y", " ", "all", " ", "get", " ", "perform", "ed", " ", "in", " ", "order", ",", " ", "and", " ", "the", " ", "set", " ", "up", " ", "a", " ", "final", "\\", "10", ";", " ", " ", " ", " ", "task", " ", "in", " ", "the", " ", "outer", " ", "config", " ", "class", " ", "and", " ", "ensure", " ", "tha", "t", " ", "is", " ", "is", " ", "perform", "ed", " ", "last", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "Infra", "_", "._", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "Role_", "(_", "\"", "default", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".1", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "In", "ner", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "1", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "2", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "3", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Out", "er", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "\\u", "task_", "=_", "Config", "Class", "Task_", "(_", "\"", "wrapp", "er", "\"_", ",_", "In", "ner", "Cfg_", ",_", "task", "\\u", "role_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final_", "=_", "Report", "ing", "Task_", "(_", "\"", "final", "\"_", ",_", "target_", "=_", "NS_", "._", "default_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "wrapp", "ed", "\\u", "task_", "|_", "final_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Out", "er", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infra", "\\u", "model", "\\u", "instance_", "=_", "infra", "_", ",_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", ",_", "etype_", ",_", "value_", ",_", "tb_", "in_", "ea_", "._", "get", "\\u", "abort", "ed", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\">>>", "Task", " ", "{}", " ", "fail", "ed", " ", "with", " ", "the", " ", "follow", "ing", ":\"_", "._", "format_", "(_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exception_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "4_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "1", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "2", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "2", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "3", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "3", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "default", "\"_", ",_", "\"", "final", "\"_", ")_", ")_", "\\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_", "test", "49_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "4", "9", ":", " ", "wrap", " ", "a", " ", "config", " ", "class", " ", "with", " ", "a", " ", "sequence", " ", "of", " ", "task", "s", " ", "in", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", " ", "and", " ", "ensure", " ", "the", "y", " ", "all", " ", "get", " ", "perform", "ed", " ", "in", " ", "order", ",", " ", "and", " ", "then", " ", "set", " ", "up", "\\", "10", ";", " ", " ", " ", " ", "initial", " ", "and", " ", "final", " ", "task", "s", " ", "in", " ", "the", " ", "outer", " ", "config", " ", "and", " ", "make", " ", "sure", " ", "every", "thing", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "happ", "eni", "ng", " ", "in", " ", "the", " ", "right", " ", "order", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "perform", "er_", "=_", "Role_", "(_", "\"", "tp", "\"_", ",_", "host", "\\u", "ref_", "=_", "Infra", "_", "._", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "Role_", "(_", "\"", "default", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".1", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "In", "ner", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "1", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "2", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "3", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Out", "er", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "\\u", "task_", "=_", "Config", "Class", "Task_", "(_", "\"", "wrapp", "er", "\"_", ",_", "In", "ner", "Cfg_", ",_", "task", "\\u", "role_", "=_", "NS_", "._", "task", "\\u", "perform", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "=_", "Report", "ing", "Task_", "(_", "\"", "initial", "\"_", ",_", "target_", "=_", "NS_", "._", "default_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final_", "=_", "Report", "ing", "Task_", "(_", "\"", "final", "\"_", ",_", "target_", "=_", "NS_", "._", "default_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "initial_", "|_", "wrapp", "ed", "\\u", "task_", "|_", "final_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Out", "er", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infra", "\\u", "model", "\\u", "instance_", "=_", "infra", "_", ",_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", ",_", "etype_", ",_", "value_", ",_", "tb_", "in_", "ea_", "._", "get", "\\u", "abort", "ed", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\">>>", "Task", " ", "{}", " ", "fail", "ed", " ", "with", " ", "the", " ", "follow", "ing", ":\"_", "._", "format_", "(_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exception_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "5_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "1", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "2", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "2", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "3", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "3", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "default", "\"_", ",_", "\"", "final", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "default", "\"_", ",_", "\"", "initial", "\"_", ")_", "<_", "cap_", "._", "pos_", "(_", "\"", "tp", "\"_", ",_", "\"", "inner", "\\u", "task", "1", "\"_", ")_", ")_", "\\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_", "test", "50_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "test", "50", ":", " ", "wrap", " ", "a", " ", "config", " ", "class", " ", "with", " ", "a", " ", "sequence", " ", "of", " ", "task", "s", " ", "in", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "wrapp", "er", ",", " ", "then", " ", "drive", " ", "the", " ", "creati", "on", " ", "of", " ", "instance", "s", " ", "of", " ", "the", " ", "Config", "Class", "Task", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "a", " ", "Multi", "Task", " ", "wrapp", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "IP", "Gen_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "host", "\\u", "part_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "host", "\\u", "part_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "127", ".0", ".0", ".{}", "\"_", "._", "format_", "(_", "self_", "._", "host", "\\u", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ip", "gen_", "=_", "IP", "Gen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Infra", "_", "(_", "Infra", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "Multi", "Resource_", "(_", "Static", "Server_", "(_", "\"", "setup", "\\u", "help", "er", "\"_", ",_", "ip", "gen_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "infra", "_", "=_", "Infra", "_", "(_", "\"", "help", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "role_", "=_", "Multi", "Role_", "(_", "Role_", "(_", "\"", "tp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "ref_", "=_", "ctxt_", "._", "model_", "._", "infra", "_", "._", "setup", "\\u", "server_", "[_", "ctxt_", "._", "name_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "Role_", "(_", "\"", "default", "\"_", ",_", "\"", "127", ".0", ".1", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "set\\u", "infra", "\\u", "model_", "(_", "infra", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "ns_", "._", "task", "\\u", "role_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cap_", "=_", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "In", "ner", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "1", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "2", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "Report", "ing", "Task_", "(_", "\"", "inner", "\\u", "task", "3", "\"_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "t1_", "|_", "t2_", "|_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Out", "er", "Cfg_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "\\u", "task_", "=_", "Multi", "Task_", "(_", "\"", "setup", "Suit", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Config", "Class", "Task_", "(_", "\"", "wrapp", "er", "\"_", ",_", "In", "ner", "Cfg_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "NS_", "._", "q_", "._", "task", "\\u", "role_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "=_", "Report", "ing", "Task_", "(_", "\"", "initial", "\"_", ",_", "target_", "=_", "NS_", "._", "default_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final_", "=_", "Report", "ing", "Task_", "(_", "\"", "final", "\"_", ",_", "target_", "=_", "NS_", "._", "default_", ",_", "report_", "=_", "cap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "dependencies_", "(_", "initial_", "|_", "wrapp", "ed", "\\u", "task_", "|_", "final_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Out", "er", "Cfg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ea_", "=_", "Execut", "ion", "Agent_", "(_", "config", "\\u", "model", "\\u", "instance_", "=_", "cfg_", ",_", "namespace", "\\u", "model", "\\u", "instance_", "=_", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infra", "\\u", "model", "\\u", "instance_", "=_", "infra", "_", ",_", "no", "\\u", "delay_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ea_", "._", "perform", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "task_", ",_", "etype_", ",_", "value_", ",_", "tb_", "in_", "ea_", "._", "get", "\\u", "abort", "ed", "\\u", "tasks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\">>>", "Task", " ", "{}", " ", "fail", "ed", " ", "with", " ", "the", " ", "follow", "ing", ":\"_", "._", "format_", "(_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exception_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "False_", ",_", "e_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "==_", "11_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "default", "\"_", ",_", "\"", "final", "\"_", ")_", "==_", "len_", "(_", "cap_", "._", "perform", "ed_", ")_", "-_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "cap_", "._", "pos_", "(_", "\"", "default", "\"_", ",_", "\"", "initial", "\"_", ")_", "==_", "0_", ")_", "\\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_", "test", "51_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Ski", "pe", "m", "NS_", "(_", "Names", "pace", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with", "\\u", "variables_", "(_", "Var_", "(_", "\"", "ONE", "\"_", ",_", "\"", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "TWO", "\"_", ",_", "\"", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Var_", "(_", "\"", "THREE", "\"_", ",_", "\"!", "{", "ONE", "}+", "!", "{", "TWO", "}\"_", ",_", "in", "\\u", "env_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Role_", "(_", "\"", "me", "\"_", ",_", "host", "\\u", "ref_", "=_", "\"", "127", ".0", ".0", ".1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "Ski", "pe", "m", "NS_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ski", "p", "Config_", "(_", "Config", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "Null", "Task_", "(_", "\"", "env", "-", "test", "\"_", ",_", "task", "\\u", "role_", "=_", "Ski", "pe", "m", "NS_", "._", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Ski", "p", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set\\u", "namespace_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\"", "THREE", "\"_", "in_", "cfg_", "._", "t_", "._", "task", "\\u", "variables_", "(_", ")_", "and_", "\"", "THREE", "\"_", "not_", "in_", "cfg_", "._", "t_", "._", "task", "\\u", "variables_", "(_", "for", "\\u", "env_", "=_", "True_", ")_", "\\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_", "do", "\\u", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "globals_", "(_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "._", "startswith_", "(_", "\"", "test", "\"_", ")_", "and_", "callable_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "(_", ")_", "\\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,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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, 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 ]
Import of deprecated module
catap/namebench/nb_third_party/dns/entropy.py
[ { "content": " def __init__(self, seed=None):\n self.pool_index = 0\n self.digest = None\n self.next_byte = 0\n self.lock = _threading.Lock()\n try:\n import hashlib\n self.hash = hashlib.sha1()\n self.hash_len = 20\n except:\n try:\n import sha\n self.hash = sha.new()\n self.hash_len = 20\n except:\n import md5\n self.hash = md5.new()\n self.hash_len = 16\n self.pool = '\\0' * self.hash_len\n if not seed is None:\n self.stir(seed)\n self.seeded = True\n else:\n self.seeded = False", "metadata": "root.EntropyPool.__init__", "header": "['class', 'EntropyPool', '(', 'object', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "sha", "start_line": 34, "start_column": 23, "end_line": 34, "end_column": 26 }, { "span": "md5", "start_line": 38, "start_column": 23, "end_line": 38, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "class_", "Entr", "opy", "Pool_", "(_", "object_", ")_", ":_", "\\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_", ",_", "seed_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pool", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "digest_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "next", "\\u", "byte_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "\\u", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash_", "=_", "hashlib_", "._", "sha1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash", "\\u", "len_", "=_", "20_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash_", "=_", "sha_", "._", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash", "\\u", "len_", "=_", "20_", "\\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 ", " _", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash_", "=_", "md5_", "._", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash", "\\u", "len_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pool_", "=_", "'\\\\", "0", "'_", "*_", "self_", "._", "hash", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "seed_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sti", "r_", "(_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seede", "d_", "=_", "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 ", " _", "self_", "._", "seede", "d_", "=_", "False_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]